關於查找ASP木馬的程序你了解多少呢?對於ASP木馬感興趣的朋友們現在就跟錯新小編去看看具體內容吧,希望對你有所幫助。
源碼,另存為asp文件即可使用:
<%@LANGUAGE=VBSCRIPTCODEPAGE=936%>
<%
'設置密碼
PASSWORD=security
dimReport
ifrequest.QueryString(act)=loginthen
ifrequest.Form(pwd)=PASSWORDthensession(pig)=1
endif
%>
<%IfSession(pig)<>1then%>
Password:
<%
else
ifrequest.QueryString(act)<>scanthen
%>
填入你要檢查的路徑:
*網站根目錄的相對路徑,填/即檢查整個網站;.為程序所在目錄
你要幹什麼:
查ASP木馬
搜索符合條件之文件
--------------如果搜索文件需將以下內容填寫完整------------------
查找內容:
*要查找的字符串,不填就只進行日期檢查
修改日期:
size=20>
*多個日期用;隔開,任意日期填寫ALL
文件類型:
*類型之間用,隔開,*表示所有類型
<%
else
server.ScriptTimeout=600
ifrequest.Form(path)=then
response.Write(NoHack)
response.End()
endif
ifrequest.Form(path)=/then
TmpPath=Server.MapPath(/)
elseifrequest.Form(path)=.then
TmpPath=Server.MapPath(.)
else
TmpPath=Server.MapPath(/)&/&request.Form(path)
endif
timer1=timer
Sun=0
SumFiles=0
SumFolders=1
Ifrequest.Form(radiobutton)=swsThen
DimFileExt=asp,cer,asa,cdx
CallShowAllFile(TmpPath)
Else
Ifrequest.Form(path)=orrequest.Form(Search_Date)=orrequest.Form(Search_FileExt)=Then
response.Write(緝捕條件不完全,恕難從命
請返回重新輸入)
response.End()
EndIf
DimFileExt=request.Form(Search_fileExt)
CallShowAllFile2(TmpPath)
EndIf
%>
ScanWebShell--ASPSecurityForHacking
掃描完畢!一共檢查文件夾<%=SumFolders%>個,文件<%=SumFiles%>個,發現可疑點<%=Sun%>個
<%Ifrequest.Form(radiobutton)=swsThen%>
文件相對路徑
特徵碼
描述
創建/修改時間
<%else%>
文件相對路徑
文件創建時間
修改時間
<%endif%>
<%=Report%>
<%
timer2=timer
thetime=cstr(int(((timer2-timer1)*10000)+0.5)/10)
response.write
本頁執行共用了&thetime&毫秒
endif
endif
%>
本程序取自雷客圖ASP站長安全助手的ASP木馬查找和可疑文件搜索功能
poweredbylake2(Build20060615)
<%
'遍歷處理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))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=該文件被&InFile&文件包含執行
EndIf
SetFSOs=CreateObject(Scripting.FileSystemObject)
onerrorresumenext
setofile=fsos.OpenTextFile(FilePath)
filetxt=Lcase(ofile.readall())
IferrThenExitSubendif
iflen(filetxt)>0then
'特徵碼檢查
filetxt=vbcrlf&filetxt
temp=&replace(FilePath,server.MapPath(/)&/,,1,1,1)&
'CheckWScr&DoMyBest&ipt.Shell
Ifinstr(filetxt,Lcase(WScr&DoMyBest&ipt.Shell))orInstr(filetxt,Lcase(clsid:72C24DD5-D70A&DoMyBest&-438B-8A42-98424B88AFB8))then
Report=Report&&temp&WScr&DoMyBest&ipt.Shell或者clsid:72C24DD5-D70A&DoMyBest&-438B-8A42-98424B88AFB8危險組件,一般被ASP木馬利用&infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
Endif
'CheckShe&DoMyBest&ll.Application
Ifinstr(filetxt,Lcase(She&DoMyBest&ll.Application))orInstr(filetxt,Lcase(clsid:13709620-C27&DoMyBest&9-11CE-A49E-444553540000))then
Report=Report&&temp&She&DoMyBest&ll.Application或者clsid:13709620-C27&DoMyBest&9-11CE-A49E-444553540000危險組件,一般被ASP木馬利用&infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
EndIf
'Check.Encode
SetregEx=NewRegExp
regEx.IgnoreCase=True
regEx.Global=True
regEx.Pattern=/bLANGUAGE/s*=/s*[]?/s*(vbscript|jscript|javascript).encode/b
IfregEx.Test(filetxt)Then
Report=Report&&temp&(vbscript|jscript|javascript).Encode似乎腳本被加密了&infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
EndIf
'CheckmyASPbackdoor:(
regEx.Pattern=/bEv&al/b
IfregEx.Test(filetxt)Then
Report=Report&&temp&Ev&ale&val()函數可以執行任意ASP代碼,被一些後門利用。其形式一般是:ev&al(X)
但是javascript代碼中也可以使用,有可能是誤報。 &infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
EndIf
'Checkexe&cutebackdoor
regEx.Pattern=[^.]/bExe&cute/b
IfregEx.Test(filetxt)Then
Report=Report&&temp&Exec&utee&xecute()函數可以執行任意ASP代碼,被一些後門利用。其形式一般是:ex&ecute(X)
&infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
EndIf
'----------------------StartUpdate200605031-----------------------------
'Check.Create&TextFileand.OpenText&File
regEx.Pattern=/.(Open|Create)TextFile/b
IfregEx.Test(filetxt)Then
Report=Report&&temp&.CreateTextFile|.OpenTextFile使用了FSO的CreateTextFile|OpenTextFile函數讀寫文件&infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
EndIf
'Check.SaveT&oFile
regEx.Pattern=/.SaveToFile/b
IfregEx.Test(filetxt)Then
Report=Report&&temp&.SaveToFile使用了Stream的SaveToFile函數寫文件&infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
EndIf
'Check.&Save
regEx.Pattern=/.Save/b
IfregEx.Test(filetxt)Then
Report=Report&&temp&.Save使用了XMLHTTP的Save函數寫文件&infiles&&GetDateCreate(filepath)&
&GetDateModify(filepath)&
Sun=Sun+1
EndIf
'------------------End----------------------------
SetregEx=Nothing
'Checkincludefile
SetregEx=NewRegExp
regEx.IgnoreCase=True
regEx.Global=True
regEx.Pattern=
以上就是查找ASP木馬的程序,你學會了嗎?