Skip to content

Instantly share code, notes, and snippets.

@w4fz5uck5
Forked from enigma0x3/ConvertShellcode.py
Created September 3, 2019 15:42
Show Gist options
  • Save w4fz5uck5/99f3424fd33718b22a2a6a396641e6aa to your computer and use it in GitHub Desktop.
Save w4fz5uck5/99f3424fd33718b22a2a6a396641e6aa to your computer and use it in GitHub Desktop.
import binascii
import sys
file_name = sys.argv[1]
with open (file_name) as f:
hexdata = binascii.hexlify(f.read())
hexlist = map(''.join, zip(hexdata[::2], hexdata[1::2]))
shellcode = ''
for i in hexlist:
shellcode += "0x{},".format(i)
shellcode = shellcode[:-1]
output = open('shellcode.txt', 'w')
output.write(shellcode)
output.close()
print "Shellcode written to shellcode.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment