分析:这个比第一关来的简单。用post命令,从30开始递减尝试。
代码:
# -*- coding:utf-8 -*-
__author__ = "Bohn"
import requests
PswWrong = "您输入的密码错误, 请重新输入"
URL = "http://www.heibanke.com/lesson/crawler_ex01/"
index = 30
while(True):
data = {"username":"Bohn_Six", "password":index}
r = requests.post(URL, data).text
if PswWrong not in r:
print("密码是 " + str(index))
break
print("密码%d是错误的" % index)
index -= 1