Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
let_us_have_hex stitcher try
[submodule "4a65eadfbdc81b5eeb43"]
path = 4a65eadfbdc81b5eeb43
url =
import sys
def dostitch():
first = "497a78705032357759326873634855675a43526c595341675044317a494852685a484a70636d39684c6e6c6f4b4434354369"
data = [line.strip() for line in open("4a65eadfbdc81b5eeb43/hexes").readlines()]
datastitch = first
i = 0
while (i < len(datastitch)):
i += 1
for line in data:
if line.startswith(datastitch[i:]):
overlap = len(datastitch[i:])
if overlap < 25:
return datastitch
print "match with overlap %i" % overlap
datastitch = datastitch[:i] + line
return datastitch
def toascii(data):
import binascii
return binascii.unhexlify(data)
def unbase64(data):
import binascii
length = len(data)
for takelen in [length, length-1, length-2]:
return binascii.a2b_base64(data[:takelen])
except binascii.Error, e:
raise e
def split(data):
c = ''.join(data[i] for i in range(0, len(data), 2))
php = ''.join(data[i] for i in range(1, len(data), 2))
return c, php
data = dostitch()
asciidata = toascii(data)
rawdata = unbase64(asciidata)
c, php = split(rawdata)
print "C code"
print "========"
print c
print ""
print "PHP code"
print "========"
print php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment