pythonchallenge Level 26
第26关地址:http://www.pythonchallenge.com/pc/hex/decent.html
查看源码
标题:be a man - apologize!
提示:
you've got his e-mail
Hurry up, I'm missing the boat
apologize,e-mail 想到第19关发邮件得到的回复
发邮件sorry给leopold.moz@pythonchallenge.com
得到回复:
Never mind that.
Have you found my broken zip?
md5: bbb8b499a0eef99b52c7f13f4e78c24b
Can you believe what one mistake can lead to?
根据回复信息
想到第24关获得的mybroken.zip,里面的mybroken.gif打不开,是有一个字节错了
按照邮件里面的md5码,修复这个zip包
不清楚是哪个字节损坏,循环替换修复验证,当md5相等时修复完成。
from hashlib import md5 data = open('mybroken.zip', 'rb').read() for i in range(len(data)): for c in range(256): newChr = chr(c).encode('latin1') mistake = chr(data[i]).encode('latin1') new_data = data[:i] + newChr + data[i + 1:] md5value = md5(new_data).hexdigest() if md5value == 'bbb8b499a0eef99b52c7f13f4e78c24b': print('损坏位置: ', i, '损坏字节:', mistake, '修复字节: ', newChr) with open('repaired.zip', 'wb') as f: f.write(new_data) print('mybroken.zip 修复完成,新文件 repaired.zip! ') break
得到一个新的压缩包,解压得到mybroken.gif
打开:http://www.pythonchallenge.com/pc/hex/speed.html
根据提示Hurry up, I'm missing the boat
得到speedboat
获得下一关地址:http://www.pythonchallenge.com/pc/hex/speedboat.html
本文来自博客园,作者:OTAKU_nicole,转载请注明原文链接:https://www.cnblogs.com/nicole-zhang/p/15566714.html