Skip to content

Instantly share code, notes, and snippets.

@pawlos
Created October 22, 2016 13:05
Show Gist options
  • Select an option

  • Save pawlos/2ead2a3e46004e1949a22e94e5785ed0 to your computer and use it in GitHub Desktop.

Select an option

Save pawlos/2ead2a3e46004e1949a22e94e5785ed0 to your computer and use it in GitHub Desktop.
Python script to extract char of the flag
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