-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path26.py
executable file
·30 lines (29 loc) · 857 Bytes
/
26.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
print "send mail to [email protected] with subject and body as sorry:"
print """Never mind that.
Have you found my broken zip?
md5: bbb8b499a0eef99b52c7f13f4e78c24b
Can you believe what one mistake can lead to?"""
good = "bbb8b499a0eef99b52c7f13f4e78c24b"
import md5,zipfile,sys
f = open("mybroken.zip")
odata = f.read()
dic = []
for n in range(256):
dic.append(chr(n))
i = 0
try:
for chr in odata:
for rp in dic:
ndata = list(odata)
ndata[i] = rp
cmd5 = md5.new("".join(ndata)).hexdigest()
if cmd5 == good:
raise Exception
i += 1
sys.stdout.write(".")
except Exception:
f.close()
open("26.zip","wb").write("".join(ndata))
zipfile.ZipFile("26.zip").extractall()
print "Please check ",zipfile.ZipFile("26.zip").namelist()[0]