在线扫描探测检查asp站点木马后门的程序

编程入门 行业动态 更新时间:2024-10-14 14:16:14
复制代码 代码如下:<%@language="vbscript"codepage="936"%> <% '设置登陆密码,使用前务必修改此密码 password="www.pifoo" '其他扫描设置 dimfileext="asp,cer,asa,cdx"'文件类型扩展名列表,不在此列表的将不被扫描 maxfilesize=51200'500k,超过此文件大小的文件(一般不是木马),将不被扫描 timeout=600'如果扫描超过600秒,脚本将终止 'jspadmin@asp.web.csdn=阿笨狗=飞云修改于2006.07.07 '获取最新修改版本,请关注www.51sjk/Upload/Articles/1/0/257/257214_20210630000444891 'qq:33323489email:subaoliang@etangguestbook:www.51sjk/Upload/Articles/1/0/257/257214_20210630000448048.jpg dimreport ifrequest.querystring("act")="login"then ifrequest.form("pifoo")=passwordthensession("pifoo")="#)\'www.pifoo" endif %> <!doctypehtmlpublic"-//w3c//dtdhtml4.01transitional//en""www.w3/tr/html4/loose.dtd"> <html> <head> <metahttp-equiv="content-type"content="text/html;charset=utf-8"> <title>asp木马、后门探测器</title> </head> <body> <%ifsession("pifoo")<>"#)\'www.pifoo"then%> <formname="form1"method="post"action="?act=login"> <divalign="center">password: <inputname="pifoo"type="password"size="15"> <inputtype="submit"name="submit"value="提交"> </div> </form> <% else ifrequest.querystring("act")<>"scan"then %> <formaction="?act=scan"method="post"> <b>填入你要检查的路径:</b> <inputname="path"type="text"style="border:1pxsolid#999"value="."size="30"/> <br> *网站根目录的相对路径,填""即检查整个网站;"."为程序所在目录 <br> <br> <inputtype="submit"value="开始扫描"style="background:#fff;border:1pxsolid#999;padding:2px2px0px2px;margin:4px;border-width:1px3px1px3px"/> </form> <% else server.scripttimeout=timeout sun=0 sumfiles=0 sumfolders=1 ifrequest.form("path")=""then response.write("没有发现被入侵的迹象.") response.end() endif timer1=timer ifrequest.form("path")=""then tmppath=server.mappath("") elseifrequest.form("path")="."then tmppath=server.mappath(".") else tmppath=server.mappath("")&""&request.form("path") endif callshowallfile(tmppath) %> <tablewidth="100%"border="0"cellpadding="0"cellspacing="0"class="ccontent"> <tr> <th>asp木马、后门、漏洞扫描探测 </tr> <tr> <tdclass="cpanel"style="padding:5px;line-height:170%;clear:both;font-size:12px"> <divid="updateinfo"style="background:ffffe1;border:1pxsolid#89441f;padding:4px;display:none"></div> 扫描完毕!一共检查文件夹<fontcolor="#ff0000"><%=sumfolders%></font>个,文件<fontcolor="#ff0000"><%=sumfiles%></font>个,发现可疑点<fontcolor="#ff0000"><%=sun%></font>个 <tablewidth="100%"border="0"cellpadding="0"cellspacing="0"> <tr> <tdvalign="top"> <tablewidth="100%"border="1"cellpadding="0"cellspacing="0"style="padding:5px;line-height:170%;clear:both;font-size:12px"> <tr> <tdwidth="20%">文件相对路径</td> <tdwidth="20%">特征码</td> <tdwidth="40%">描述</td> <tdwidth="20%">创建/修改时间</td> </tr> <p> <%=report%> <br/></p> </table></td> </tr> </table> </td></tr></table> <% timer2=timer thetime=cstr(int(((timer2-timer1)*10000)+0.5)/10) response.write"<br><fontsize=""2"">本页执行共用了"&thetime&"毫秒</font>" endif endif %> <hr> <divalign="center"><br> modifiedby<atarget=_blank>jspadmin</a>at2006.07.07 </div> </body> </html> <% '遍历处理path及其子目录所有文件 subshowallfile(path) setfso=createobject("scripting.filesystemobject") ifnotfso.folderexists(path)thenexitsub setf=fso.getfolder(path) setfc2=f.files foreachmyfileinfc2 ifcheckext(fso.getextensionname(path&""&myfile.name))and(myfile.size<=maxfilesize)then callscanfile(path&temp&""&myfile.name,"") sumfiles=sumfiles+1 endif next setfc=f.subfolders foreachf1infc showallfilepath&""&f1.name sumfolders=sumfolders+1 next setfso=nothing endsub '检测文件 subscanfile(filepath,infile) ifinfile<>""then infiles="该文件被<ahref="""&request.servervariables("server_name")&""&infile&"""target=_blank>"&infile&"</a>文件包含执行" endif setfsos=createobject("scripting.filesystemobject") onerrorresumenext setofile=fsos.opentextfile(filepath) filetxt=lcase(ofile.readall()) iferrthenexitsubendif iflen(filetxt)>0then '特征码检查 temp="<ahref="""&request.servervariables("server_name")&""&replace(filepath,server.mappath("")&"","",1,1,1)&"""target=_blank>"&replace(filepath,server.mappath("")&"","",1,1,1)&"</a>" 'check"wscr"&domybest&"ipt.shell" ifinstr(filetxt,lcase("wscr"&domybest&"ipt.shell"))orinstr(filetxt,lcase("clsid:72c24dd5-d70a"&domybest&"-438b-8a42-98424b88afb8"))then report=report&"<tr><td>"&temp&"</td><td>wscr"&domybest&"ipt.shell或者clsid:72c24dd5-d70a"&domybest&"-438b-8a42-98424b88afb8</td><td>危险组件,一般被asp木马利用。"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>" sun=sun+1 endif 'check"she"&domybest&"ll.application" ifinstr(filetxt,lcase("she"&domybest&"ll.application"))orinstr(filetxt,lcase("clsid:13709620-c27"&domybest&"9-11ce-a49e-444553540000"))then report=report&"<tr><td>"&temp&"</td><td>she"&domybest&"ll.application或者clsid:13709620-c27"&domybest&"9-11ce-a49e-444553540000</td><td>危险组件,一般被asp木马利用。"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>" sun=sun+1 endif 'check.encode setregex=newregexp regex.ignorecase=true regex.global=true regex.pattern="@\s*language\s*=\s*[""]?\s*(vbscript|jscript|javascript).encode\b" ifregex.test(filetxt)then report=report&"<tr><td>"&temp&"</td><td>(vbscript|jscript|javascript).encode</td><td>似乎脚本被加密了,一般asp文件是不会加密的。"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>" sun=sun+1 endif 'checkmyaspbackdoor:( regex.pattern="\bev"&"al\b" ifregex.test(filetxt)then report=report&"<tr><td>"&temp&"</td><td>ev"&"al</td><td>e"&"val()函数可以执行任意asp代码,被一些后门利用。其形式一般是:ev"&"al(x)<br>但是javascript代码中也可以使用,有可能是误报。"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>" sun=sun+1 endif 'checkexe&cutebackdoor regex.pattern="[^.]\bexe"&"cute\b" ifregex.test(filetxt)then report=report&"<tr><td>"&temp&"</td><td>exec"&"ute</td><td>e"&"xecute()函数可以执行任意asp代码,被一些后门利用。其形式一般是:ex"&"ecute(x)。<br>"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>" sun=sun+1 endif setregex=nothing '检查包含文件 setregex=newregexp regex.ignorecase=true regex.global=true regex.pattern="<!--\s*#include\s*file\s*=\s*"".*""" setmatches=regex.execute(filetxt) foreachmatchinmatches tfile=replace(mid(match.value,instr(match.value,"""")+1,len(match.value)-instr(match.value,"""")-1),"/","") ifnotcheckext(fsos.getextensionname(tfile))then callscanfile(mid(filepath,1,instrrev(filepath,""))&tfile,replace(filepath,server.mappath("")&"","",1,1,1)) sumfiles=sumfiles+1 endif next setmatches=nothing setregex=nothing '检查虚拟目录 setregex=newregexp regex.ignorecase=true regex.global=true regex.pattern="<!--\s*#include\s*virtual\s*=\s*"".*""" setmatches=regex.execute(filetxt) foreachmatchinmatches tfile=replace(mid(match.value,instr(match.value,"""")+1,len(match.value)-instr(match.value,"""")-1),"/","") ifnotcheckext(fsos.getextensionname(tfile))then callscanfile(server.mappath("")&""&tfile,replace(filepath,server.mappath("")&"","",1,1,1)) sumfiles=sumfiles+1 endif next setmatches=nothing setregex=nothing '检查特殊命令:server&.execute|transfer setregex=newregexp regex.ignorecase=true regex.global=true regex.pattern="server.(exec"&"ute|transfer)([\t]*|\()"".*""" setmatches=regex.execute(filetxt) foreachmatchinmatches tfile=replace(mid(match.value,instr(match.value,"""")+1,len(match.value)-instr(match.value,"""")-1),"/","") ifnotcheckext(fsos.getextensionname(tfile))then callscanfile(mid(filepath,1,instrrev(filepath,""))&tfile,replace(filepath,server.mappath("")&"","",1,1,1)) sumfiles=sumfiles+1 endif next setmatches=nothing setregex=nothing 'checkserver&.execute|transfer setregex=newregexp regex.ignorecase=true regex.global=true regex.pattern="server.(exec"&"ute|transfer)([\t]*|\()[^""]\)" ifregex.test(filetxt)then report=report&"<tr><td>"&temp&"</td><td>server.exec"&"ute</td><td>不能跟踪检查server.e"&"xecute()函数执行的文件。请管理员自行检查。<br>"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>" sun=sun+1 endif setmatches=nothing setregex=nothing '检查createobject命令crea"&"teobject setregex=newregexp regex.ignorecase=true regex.global=true regex.pattern="createo"&"bject[|\t]*\(.*\)" setmatches=regex.execute(filetxt) foreachmatchinmatches ifinstr(match.value,"&")orinstr(match.value,"+")orinstr(match.value,"""")=0orinstr(match.value,"(")<>instrrev(match.value,"(")then report=report&"<tr><td>"&temp&"</td><td>creat"&"eobject</td><td>crea"&"teobject函数使用了变形技术,仔细复查。"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>" sun=sun+1 exitsub endif next setmatches=nothing setregex=nothing endif setofile=nothing setfsos=nothing endsub '检查文件后缀,如果与预定的匹配即返回true functioncheckext(fileext) ifdimfileext="*"thencheckext=true ext=split(dimfileext,",") fori=0toubound(ext) iflcase(fileext)=ext(i)then checkext=true exitfunction endif next endfunction functiongetdatemodify(filepath) setfso=createobject("scripting.filesystemobject") setf=fso.getfile(filepath) s=f.datelastmodified setf=nothing setfso=nothing getdatemodify=s endfunction functiongetdatecreate(filepath) setfso=createobject("scripting.filesystemobject") setf=fso.getfile(filepath) s=f.datecreated setf=nothing setfso=nothing getdatecreate=s endfunction %>

【asp木马探测器】-在线扫描探测检查asp站点木马后门的程序

可以在线扫描检查探测站点内的所有asp程序代码,检测代码中是否含有危险代码

目前检测的特征码有:createobject、execute、shell.application、wscript.shell、eval、include......等。

对程序的改进是:增加扩展名后缀列表自定义、扫描文件大小限制、扫描超时限制、session验证改复杂了一点点......

具体请自己打开原始代码查看。

使用后,要么及时删除,要么将登陆密码改掉,尽量改复杂点。(虽然这个程序不会直接提供在线打开文件的功能,但仍然有可能被hacker利用)

准备下一个修改版本加入检查iframe特征码的功能,目前太多站点都是被人挂了iframe,当然,那只是表现,具体漏洞根源还是在程序或其他方面。

[注意:解压密码和默认登陆密码都是]

原作者:雷客图jspadmin=阿笨狗=飞云 修改于2006.07.07'获取最新修改版本,请关注'qq:33323489 email:subaoliang@etang guestbook:www.51sjk/Upload/Articles/1/0/257/257214_20210630000448048.jpg

  • 0
  • 0
  • 0
  • 0
  • 0

更多推荐

在线扫描探测检查asp站点木马后门的程序

本文发布于:2023-06-11 00:14:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/622019.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:在线   后门   木马   站点   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!