8月网站中过毒,随手写的一个
程序代码:
<%
' ASP Rewriter By multiple1902
Server.ScriptTimeout=200
Const VirusStr="<iframe src=http://******.htm width=0 height=0></iframe>"
'病毒frame字符串,只针对固定不变的字符串有用,会规律变化或者不规律变化的就要用正则表达式匹配或者字符串操作了
Dim fso
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Dim Folder,A_File
Set Folder=fso.GetFolder(Server.MapPath("./"))
Response.Write Folder.Path
ReplaceFolder(Folder)
Sub ReplaceFolder(Folder)
Dim SubFolder
For Each SubFolder In Folder.SubFolders
ReplaceFolder(SubFolder)
Next ' SubFolder
Dim SubFile
For Each SubFile In Folder.Files
ReplaceFile(SubFile.Path)
Next
End Sub
Sub ReplaceFile(FileName)
On Error Resume Next
If Instr(LCase(FileName),"htm")+Instr(LCase(FileName),"php")=0 then Exit Sub
Dim Content
Content=fso.GetFile(FileName).OpenAsTextStream().ReadAll()
If Content="" Then Exit Sub
If Instr(Content,VirusStr)=0 Then Exit Sub
Content=Replace(Content,VirusStr,"")
Response.Write FileName & "
"
Call fso.OpenTextFile(FileName,2,1).Write(Content)
'Response.Write Server.HtmlEncode(Content)
End Sub
%>