-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathevil.py
More file actions
35 lines (27 loc) · 1.04 KB
/
evil.py
File metadata and controls
35 lines (27 loc) · 1.04 KB
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
31
32
33
34
35
#!/usr/bin/python
# http://www.pythonchallenge.com/pc/return/evil.html
import urllib
import Image
# downlaod file with password
# user: huge passwd: file
url="http://huge:file@www.pythonchallenge.com/pc/return/evil1.jpg"
filename=url.split('/')[-1]
urllib.urlretrieve(url,filename)
# filename ends with 1, so we try to get more
for i in range(1,10):
url="http://huge:file@www.pythonchallenge.com/pc/return/evil%d.jpg" % i
filename=url.split('/')[-1]
urllib.urlretrieve(url,filename)
# evil2.jpg shows "not jpg - .gfx"
# so we get evil2.gfx
url="http://huge:file@www.pythonchallenge.com/pc/return/evil2.gfx"
filename=url.split('/')[-1]
urllib.urlretrieve(url,filename)
# observe gfx file, no results ...
# deal the data into 5 equal piles and save those piles to disc
info = urllib.urlopen('http://huge:file@www.pythonchallenge.com/pc/return/evil2.gfx').read()
for i in range(5):
file = open("evil_0%d.jpg" % i, "wb")
file.write(info[i::5])
file.close()
# from image generated, we get disproportional