Skip to content

Instantly share code, notes, and snippets.

@edermi
Last active November 12, 2021 12:47
Show Gist options
  • Save edermi/e465058a08e9e744ea9765c473835796 to your computer and use it in GitHub Desktop.
Save edermi/e465058a08e9e744ea9765c473835796 to your computer and use it in GitHub Desktop.
import sys
def main():
with open(sys.argv[1], 'rb') as f:
shellcode = f.read()
hexlified = ['0x{:02X}'.format(b) for b in shellcode]
with open(sys.argv[2], 'w') as f:
f.write(','.join(hexlified))
sys.stderr.write("Shellcode length: {}".format(len(shellcode)))
if __name__ == '__main__':
try:
main()
except IndexError:
print("Usage: shellcode_to_hex_array beacon.bin beacon.hex")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment