Created
October 22, 2016 13:05
-
-
Save pawlos/2ead2a3e46004e1949a22e94e5785ed0 to your computer and use it in GitHub Desktop.
Python script to extract char of the flag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import base64 | |
| import string | |
| from urllib2 import Request, build_opener, HTTPCookieProcessor, HTTPHandler, quote | |
| import cookielib | |
| cj = cookielib.CookieJar() | |
| opener = build_opener(HTTPCookieProcessor(cj), HTTPHandler()) | |
| for char in xrange(0x20, 0x7f): | |
| pref = 'flag:' | |
| url = "https://cthulhu.fluxfingers.net:1505/?user="+quote(pref+chr(char)+'') | |
| req = Request(url) | |
| print pref+chr(char)+'', | |
| f = opener.open(req) | |
| cookie_val = cj._cookies['cthulhu.fluxfingers.net']['/']['auth'].value | |
| decoded = base64.b64decode(cookie_val) | |
| print len(decoded) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment