Skip to content

Commit 6018ed3

Browse files
JINGJING
authored andcommitted
完成图片URL破解
1 parent 7cb128d commit 6018ed3

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

comic-img.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python
2+
#encoding:utf-8
3+
4+
import re, urllib, urllib2, cookielib, ConfigParser, string
5+
6+
regex = re.compile(r"return p}.+\[(.+)\]")
7+
regex2 = re.compile(r"\'([\w+\|]+)\'")
8+
regex3 = re.compile(r"%\w")
9+
10+
conf = ConfigParser.ConfigParser()
11+
conf.read("conf_comic")
12+
13+
section = "dmzj"
14+
cfg = {}
15+
for option in conf.options(section):
16+
cfg[option] = conf.get(section, option)
17+
18+
socket = urllib2.urlopen(cfg["test_url_img"])
19+
content = socket.read()
20+
socket.close()
21+
22+
rs = regex.findall(content)[0]
23+
shortcut = rs[1]
24+
urls = map(lambda x : x[2:-1], rs.replace("\\", "").split(","))
25+
26+
codes = regex2.findall(content)[1].split("|")
27+
28+
a = {}
29+
30+
index = string.digits + string.letters
31+
32+
for i, x in enumerate(index):
33+
try:
34+
a[x] = codes[i]
35+
except IndexError:
36+
pass
37+
except:
38+
print "error"
39+
40+
41+
output = []
42+
for x in urls:
43+
s = ""
44+
for i, c in enumerate(x):
45+
if c in index:
46+
if a[c] != "":
47+
s += a[c]
48+
else:
49+
s += c
50+
else:
51+
s += c
52+
53+
output.append(s)
54+
55+
56+
with open("img-analyse-output.txt", "w") as f:
57+
for x in output:
58+
f.write(cfg["root_img"]+ shortcut + x + "\n")

0 commit comments

Comments
 (0)