介绍
游戏介绍
平时自己学python,大家肯定很是无聊,推荐一个很早之前的网页版python闯关游戏——Python Challenge,虽然说这个网站很早了,但是很有意思,你会发现这些游戏一点也不简单,基本都需要通过编程来解决……
有意思的是,这是个解谜游戏,所以需要你细心去发现线索,破解谜底,并且考察的知识量也不是很小,很有意思。
游戏链接:http://www.pythonchallenge.com/
界面是这样的:
点击图中Click here to get challenged
开始挑战。
全解(持续更新)
Python challenge 全解(持续更新中,建议收藏)
基础知识
重点必看
第8关我们得到了一个账号和密码:huge
.file
,这个需要牢牢记住,因为后面的关卡,基本都需要登录。
第18关
找不同。。。。查看源代码:
<html>
<head>
<title>can you tell the difference?</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<br><br>
<center>
<font color="gold">
<img src="balloons.jpg" border="0"/>
<!-- it is more obvious that what you might think -->
</body>
</html>
有一句话有用:<!-- it is more obvious that what you might think -->
,这样看来,很明显,就是明亮度不一样,试了几次:http://www.pythonchallenge.com/pc/return/brightness.html
打开链接,结果还是这样:
再次查看源代码吧:
<html>
<head>
<title>can you tell the difference?</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<br><br>
<center>
<font color="gold">
<img src="balloons.jpg" border="0"/>
<!-- maybe consider deltas.gz -->
</body>
</html>
多了一句话<!-- maybe consider deltas.gz -->
,还是套路啊……
试试链接:http://www.pythonchallenge.com/pc/return/deltas.gz
,是一个压缩包,下载了再说。。
打开是这样:
数据分为两部分,,,这时候再联想到题目是找不同,所以寻找相关的库解决:
import gzip,difflib
data = gzip.open("deltas.gz")
data_one,data_two = [],[]
for line in data:
data_one.append(line[:53].decode()+"\n")
data_two.append(line[56:].decode())
compare = difflib.Differ().compare(data_one,data_two) #此函数会将两个文件块互相比较,"+"开头的行是data_one中有data_two中没有的,"-"是data_two中有data_one中没有的内容,
file = open("file.png","wb")
file1 = open("file1.png","wb")
file2 = open("file2.png","wb")
for line in compare:
bs = bytes([int(o,16) for o in line[2:].strip().split(" ") if o])
if line[0] == '+':
file1.write(bs)
elif line[0] == '-':
file2.write(bs)
else:
file.write(bs)
得到结果:
输入链接试一下,需要登陆,账号和密码就是butter
和fly
结果链接
http://www.pythonchallenge.com/pc/hex/bin.html
账号:butter
密码:fly
第19关预告
有什么异常???
最后,大家不妨关注一下可怜的我。。