说明: http://www.pythonchallenge.com/
pythonchallenge是在学习openstack的时候,介绍python语言时推荐的一个游戏解密网站,自己看了一下,有些问题还是很有难度的,有时候在家里搞搞,有时候午休时间在公司搞搞,记录自己过关斩将的历程~~仅供娱乐。
0. 第0关 http://www.pythonchallenge.com/pc/def/0.html
其实我没注意到这个2^38, 第一眼看到提示语,说试试修改url,于是我把0改成1,访问:
http://www.pythonchallenge.com/pc/def/1.html,网页提示: 2**38 is much much larger.
OK,用python计算2**38 =274877906944
访问http://www.pythonchallenge.com/pc/def/274877906944.html 进入第1关
1. 第1关:http://www.pythonchallenge.com/pc/def/map.html
一眼看出来K-L-M, O-P-Q, E-F-G,每个字母后面第二个字母,写段代码,将这行紫色的字母都换成后面第二个字母。
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Administrator
#
# Created: 17/09/2015
# Copyright: (c) Administrator 2015
# Licence: <your licence>
#-------------------------------------------------------------------------------
import string
def main():
in_characters = "abcdefghijklmnopqrstuvwxyz"
out_characters = "cdefghijklmnopqrstuvwxyzab"
transtab = string.maketrans(in_characters, out_characters)
print "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.".translate(transtab)
pass
if __name__ == '__main__':
main()
输出结果:
i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url. |
这句话提示把这个替换关系应用在url上,下一关地址就是:http://www.pythonchallenge.com/pc/def/ocr.html
2. 第二关:http://www.pythonchallenge.com/pc/def/ocr.html
第一感觉是看橙色的提示,说是在page source里,右击页面,查看页面源代码, 看到下面这段隐藏文字:
说找到这堆符号中,少有的字母,python一下:
import string
def main(): a = """%%$@_$^__#)^)&!_+]!*@&^}@[@%]()%+$&[(_@%+%$*^@$^!+]!&_#)_*}{}}!}_]$[%}@[{_@#_^{*@##&{#&{&)*%(]{
{([*}@[@&]+!!*{)!}{%+{))])[!^})+)$]#{*+^((@^@}$[**$&^{$!@#$%)!@(&...下面省略,太长了""" for c in a:
if c in string.ascii_letters:
print c,
print ""
pass
if __name__ == '__main__':
main()
输出结果:
e q u a l i t y |
试试http://www.pythonchallenge.com/pc/def/equality.html 进入第三关
3. 第3关:http://www.pythonchallenge.com/pc/def/equality.html
好吧, 这个题目完全是考我可怜的英语水平啊,surrounded by EXACTLY three big bodyguards on each of its sides, 再看看蜡烛,我想应该是一个小写字母,左边和右边都正好有3个大写字母,不多不少。
那字符串在哪里呢?从第2关的经验猜,查看页面源代码,可以看到这样的隐藏字符串:
直接上python:
import string
import sys
def main():
a="""kAewtloYgcFQaJNhHVGxXDiQmzjfcpYbzxlWrVcqsmUbCunkfxZWDZjUZMiGqhRRiUvGmYmvnJIHEmbT
MUKLECKdCthezSYBpIElRnZugFAxDRtQPpyeCBgBfaRVvvguRXLvkAdLOeCKxsDUvBBCwdpMMWmuELeGENihrpCLhujoBqPRDPvfzcwadMMMbkmkzCCzoTPfbRlzBqMblmxTxNniNoCufprWXxgHZpldkoLCrHJq。。。下面省略,太TM长了"""
lines = a.splitlines()
c = 80
r = 1250
arr = []
for i in range(0, r):
for j in range(3,