来来来,难得今天有点时间,闯关继续
照旧,先进入闯关入口,看一看这一关是怎么回事:http://www.pythonchallenge.com/pc/def/channel.html

单纯的从网页页面上来看, 一个有拉锁的图片, 下面一个写有‘ PayPal Donate’的按钮
首先点击 这个按钮, 它是一个支付页面, 希望能够捐赠一点资金来支持 python change 这个项目,明显的和闯关无关。
那我们还得照例,查看这个网页的源码:
<html><!-- <-- zip -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>now there are pairs</title>
<link rel="stylesheet" type="text/css" href="./now there are pairs_files/style.css">
</head>
<body>
<center>
<img src="./now there are pairs_files/channel.jpg">
<br>
<!-- The following has nothing to do with the riddle itself. I just
thought it would be the right point to offer you to donate to the
Python Challenge project. Any amount will be greatly appreciated.
-thesamet
-->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="thesamet@gmail.com">
<input type="hidden" name="item_name" value="Python Challenge donations">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="bn" value="PP-DonationsBF">
<input type="image" src="./now there are pairs_files/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="./now there are pairs_files/pixel.gif" width="1" height="1">
</form>
</center></body></html>
这一关其实真的很迷惑,我们看完网页源码,其实没有什么有用的信息.
再次仔细观察,也就两段注释可能有用‘ <!-- <-- zip --> ‘ 以及 ’The following has nothing to do with the riddle itself. I just thought it would be the right point to offer you to donate to the Python Challenge project. Any amount will be greatly appreciated.’
那第二段注释的内容是说:
以下与谜语本身无关。我只是
认为这是正确的点,提供你捐赠给
挑战项目。任何金额将不胜感激。
- thesamet
所以也就剩下第一段注释有用了.
思路是什么呢? 一个可能是本关卡跟 zip 这个包有关,python里面带的有这个模块, 另外呢, 需要重新替换网址。
先尝试替换网址吧:
按照之前的闯关规则, 替换成:http://www.pythonchallenge.com/pc/def/zip.html
但是网页提示如下:
yes. find the zip. 看来思路是正确了,但是明显这个替换方式不对
那么,再次尝试:http://www.pythonchallenge.com/pc/def/channel.zip
这样我们就得到了一个 zip 文件: channel.zip
本地解压这个压缩文件,随便打开一个,发现跟之前的关卡 类似,但是同时注意到, 这里有一个readme文件,先看这个:
welcome to my zipped list.
hint1: start from 90052
hint2: answer is inside the zip
所以呢, 处理这些个文件,得先从90050.txt开始处理了
#!/usr/bin/python
# coding:utf-8
start_file_name='90052'
while True:
f= open('channel/%s.txt' % start_file_name)
data= f.read()
new_number = data.split(' ')[-1]
print 'data is : %s '% data,
print 'current number is : %s' % new_number
f.close()
if new_number:
if new_number.isdigit():
start_file_name=new_number
else:
print 'The final data is : %s' % data
break
else:
print 'The final data is : %s' % data
break
执行上面这段程序,最后得到了这句话:
The final data is : Collect the comments.
那其实呢,也就是说,谜底并不是说直接写在文件中内
需要再次使用别的方法来解决这个问题。
那么我们就得再次回到网页源码的提示上来
python 里面没有 zip这个包,但是有一个叫做 zipfile 的
因此这个谜底的关键还在于这个 zipfile
#!/usr/bin/python
# coding:utf-8
import zipfile
zf=zipfile.ZipFile('channel.zip')
start_file_name='90052'
zc=[]
while True:
f= open('channel/%s.txt' % start_file_name)
data= f.read()
new_number = data.split(' ')[-1]
print 'data is : %s '% data,
print 'current number is : %s' % new_number
f.close()
zc.append(zf.getinfo(start_file_name+'.txt').comment) # 只用在每一个文件查看结束之后,提取出来它的文档说明信息即可
print zf.getinfo(start_file_name+'.txt').comment #ZipInfo.comment: 获取文档说明。
if new_number:
if new_number.isdigit():
start_file_name=new_number
else:
print 'The final data is : %s' % data
break
else:
print 'The final data is : %s' % data
break
print ''.join(zc) #最终将所有的文档信息聚合到一起同时打印,即可得到最终信息
print zf.getinfo('90052.txt').comment
#for i in zf.infolist():
# print i,i.filename,i.file_size,i.header_offset
print zf.namelist()[2] #直接获取压缩包中的文档名字
print zf.read(zf.namelist()[3]) #直接获取压缩包中的文档内容 最后得到的信息如下:
The final data is : Collect the comments.
****************************************************************
****************************************************************
** **
** OO OO XX YYYY GG GG EEEEEE NN NN **
** OO OO XXXXXX YYYYYY GG GG EEEEEE NN NN **
** OO OO XXX XXX YYY YY GG GG EE NN NN **
** OOOOOOOO XX XX YY GGG EEEEE NNNN **
** OOOOOOOO XX XX YY GGG EEEEE NN **
** OO OO XXX XXX YYY YY GG GG EE NN **
** OO OO XXXXXX YYYYYY GG GG EEEEEE NN **
** OO OO XX YYYY GG GG EEEEEE NN **
** **
****************************************************************
**************************************************************
这样我们得到下一关的地址:HOCKEY
然后再重新排列组合一下,得到了:
oxygen
那么下一关的网址就是:http://www.pythonchallenge.com/pc/def/oxygen.html
(程序后续补上,暂时先到这了)
http://www.pythonchallenge.com/pc/def/oxygen.html
|