Skip to content

Instantly share code, notes, and snippets.

@enigma0x3
Forked from rvrsh3ll/ConvertShellcode.py
Created October 25, 2018 21:01
Show Gist options
  • Save enigma0x3/f81269de6041de626c92cae414e54fed to your computer and use it in GitHub Desktop.
Save enigma0x3/f81269de6041de626c92cae414e54fed to your computer and use it in GitHub Desktop.

Revisions

  1. @rvrsh3ll rvrsh3ll revised this gist Feb 21, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ConvertShellcode.py
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    import binascii
    import array
    import sys


    with open ('beacon.bin') as f:
    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 = ''
  2. @rvrsh3ll rvrsh3ll created this gist Feb 21, 2017.
    16 changes: 16 additions & 0 deletions ConvertShellcode.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    import binascii
    import array


    with open ('beacon.bin') 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"