Python Helper Utilities for SEH Overwrite Based Exploits
from helper import *
- pattern
payload = pattern_create(3000)
- offset
nSEH_offset = pattern_offset('0x39644338')
egghunter_offset = pattern_offset('3Av4')
- padding
payload = pattern_create(egghunter_offset)
payload += egghunter
payload += fill(payload, farjmp_offset)
payload += farjmp
payload += fill(payload, nSEH_offset)
- save_file
save_file("payload.txt", payload)
- packing
def u8(x):
return struct.unpack("<B", x)[0]
def u16(x):
return struct.unpack("<H", x)[0]
def u32(x):
return struct.unpack("<I", x)[0]
def u64(x):
return struct.unpack("<Q", x)[0]
def p8(x):
return struct.pack("<B", x)
def p16(x):
return struct.pack("<H", x)
def p32(x):
return struct.pack("<I", x)
def p64(x):
return struct.pack("<Q", x)
- logging
def log(x):
print(x)
def debug(x):
log("[*] {:s}".format(x)) if DEBUG else None
def ok(x):
log("[+] {:s}".format(x))
def err(x):
log("[-] {:s}".format(x))
def warn(x):
log("[!] {:s}".format(x))