My problem is in this code:
try:
PassL = open(sys.argv[3], "r").readlines()
print "[+] Passwords:",len(PassL),"\n"
except(IOError):
print "[-] Error: Check your wordlist path\n"
sys.exit(1)
for word in PassL:
word = word.replace("\r","").replace("\n","")
login_form_seq = [
('log', sys.argv[2]),
('pwd', word),
('rememberme', 'forever'),
('wp-submit', 'Login >>'),
('redirect_to', 'wp-admin/')]
try:
login_form_data = urllib.urlencode(login_form_seq)
opener = urllib2.build_opener()
except:
print'Unknown ERROR'
try:
OP = opener.open(host, login_form_data).read()
except(urllib2.URLError), msg:
print msg
OP = ""
else:
'wrong?'
if re.search("WordPress requires Cookies",OP):
print "[-] Failed: WordPress has cookies enabled\n"
sys.exit(1)
#Change this response if different. (language)
if re.search("<strong>ERROR</strong>",OP):
print "[-] Login Failed :",word
else:
print "\n[!] Login Successfull:",'[#]The Information:',sys.argv[2],':',word
So the problem is, I provide sys.argv[2]
and that gets the txt
file. For example:
www.py wow.txt
Then in my python script I try to login to a web site with the password in wow.txt. The problem is, I put 15 passwords in wow.txt
and my www.py
script reads the last line!
The purpose of the script is because I forget a lot of my Wordpress accounts (around six accounts), and actually am thinking of trying 25 passwords for each. So make it easy for me -- don't say "go and try it manually", just give me the code or the right way.