Python Challenge level 17: “eat?”
Level 17 is cookie related, so urllib usage is needed once again.
Hint 1: cookies in the photo. Unambiguous!
Hint 2: there’s a thumbnail of the image from level 4
So, we’ll have to investiagate the http headers. Interestingly, we find out something in level 4.
Fact 1: “info=you+should+have+followed+busynothing…;” is a cookie set by level 4.
Fact 2: busynothing is another linkedlist, and has a chinging cookie!
Fact 3: once obtained every piece, the info seems to be a quote_plus string from a BZ2 chunk of data
The code for this part of the riddle would be:
import urllib,re,bz2
url='http://www.pythonchallenge.com/pc/def/linkedlist.php?busynothing='
seed="12345"
info=''
while True:
req=urllib.urlopen(url+seed)
text=req.read()
seed=''.join(re.findall(r"busynothing is (\d+)",text))
cookies=req.info().getheaders('Set-Cookie')[0]
byte=cookies.split(';')[0].split('=')[1]
info+=byte
try :
int(seed)
print " Info:",byte,"t Next:",seed
except :
print " Info:",byte,"t Last:",text
break
print "info:",bz2.decompress(urllib.unquote_plus(info))
is it the 26th already? call his father and inform him that “the flowers are on their way”. he’ll understand.
This one is intricate. Lets use level 13′s phonebook to find Mozart’s father’s phone. His name was Leopold by the way:
violin
From there to here, and stuck again. The only hint now is the page title: “it’s me. what do you want?”
Now it’s time to give him the message. After some trial and error and no RPC errors seen, setting a cookie with the message will show itself as the way to go.
from urllib2 import Request,urlopen
from urllib import quote_plus
info='the flowers are on their way'
url='http://www.pythonchallenge.com/pc/stuff/violin.php'
req = Request(url, headers={'Cookie': 'info=' + quote_plus(info)})
print urlopen(req).read()
oh well, don’t you dare to forget the balloons
Balloons! Finally Level 18.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
In the line
seed=”.join(re.findall(r”busynothing is (d+)”,text))
the d+ should read \d+
For some reason the slashes were deleted from this and several other code snippets. Thanks for noticing! :)
hi! Thats a wonderful edu blog. I think edu stands for quality (=