Python Challenge - Level 26
- Link: http://www.pythonchallenge.com/pc/hex/decent.html
- Username: butter
- Password: fly
Problem
Hurry up, I'm missing the boat
Solution
Send the email to [email protected]
and get the response:
From: [email protected] Subject: Re: sorry Date:
Never mind that.
Have you found my broken zip?
md5: bbb8b499a0eef99b52c7f13f4e78c24b
Can you believe what one mistake can lead to?
As indicated there's only "one mistake". Try to modify the data and check by md5 code.
import hashlib
def search_and_save():
for i in range(len(data)):
for j in range(256):
newData = data[:i] + bytes([j]) + data[i + 1:]
if hashlib.md5(newData).hexdigest() == md5code:
open('repaired.zip', 'wb').write(newData)
return
md5code = 'bbb8b499a0eef99b52c7f13f4e78c24b'
data = open('maze/mybroken.zip', 'rb').read()
search_and_save()
The result is a picture with word "speed", plus the text:
Hurry up, I'm missing the boat
The final answer is speedboat
Next Level
http://www.pythonchallenge.com/pc/hex/speedboat.html
Python 2 to 3
md5
module is deprecated, usehashlib.md5()
open()
without explicitly specifyingrb
will use the defaultutf-8
codec for decoding.