这一关很是麻烦……
首先通过cookies的提示,需要查看cookies信息,然后知道需要回到第四关,然后用busynothing 替代 nothing,重复第四关的遍历,不过这次需要收集的是每一个页面的cookies信息,然后利用bz2处理这些信息,然后再回到第13关打电话给mozart的老爹…用获得的信息修改新页面的cookies,最后得到谜底,真是太复杂了……
import re,bz2,urllib2,urllib,cookielib
info = []
cookies = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
urllib2.install_opener(opener)
nothing = str(12345)
for i in range(400):
path = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?busynothing='
text = urllib.urlopen(path+nothing).read()
r = urllib2.Request(path+nothing)
yy = str(urllib2.urlopen(r).info())
info.append((re.findall('info=(.{0,4});' , yy)))
a = re.findall(r'(\d+)',text)
#print i, text ,info
if a == []:
break
nothing = str(a[len(a)-1])
s = ''.join([k for i in info for k in i])
print s
print bz2.decompress(urllib.unquote_plus(s))
import xmlrpclib
server = xmlrpclib.Server(r'http://www.pythonchallenge.com/pc/phonebook.php')
print server.system.listMethods()
print server.system.methodHelp('phone')
print server.phone('Leopold')
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