雷客图 站长安全助手 vbs版代码(asp 木马查找)

2019-01-16 02:56:05王振洲

        
        'Check include file not with "&'
        Set regEx = New RegExp
        regEx.IgnoreCase = True
        regEx.Global = True
        regEx.Pattern = "<!--s*#includes+(file|virtual)s*=s*.*-->"
        Set Matches = regEx.Execute(filetxt)
        For Each Match in Matches
            tFile = Replace(Trim(Mid(Match.Value, Instr(Match.Value, "=") + 1, Len(Match.Value) - Instr(Match.Value, "=") - 1)),"/","")
            If Left(tFile, 1)="'" Then
                tFile = Mid(tFile, 2, InStr(2, tFile, "'", 1) - 2)
            ElseIf Left(tFile, 1)="""" Then
                tFile = Mid(tFile, 2, InStr(2, tFile, """", 1) - 2)
            Else
                tFile = Replace(tFile, Chr(9), " ")
                If InStr(tFile, " ") <> 0 Then
                    tFile = Left(tFile, InStr( tFile, " ") - 1)
                Else
                    tFile = Left(tFile, InStr( tFile, "-") - 1)
                End If
            End If
            If Not CheckExt(FSOs.GetExtensionName(tFile)) Then
                Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,""))&tFile, FilePath)
                SumFiles = SumFiles + 1
            End If
        Next
        Set Matches = Nothing
        Set regEx = Nothing

        'Check Server&.Execute|Transfer
        Set regEx = New RegExp
        regEx.IgnoreCase = True
        regEx.Global = True
        regEx.Pattern = "Server.(Exec"&"ute|Transfer)([ t]*|()"".*?"""
        Set Matches = regEx.Execute(filetxt)
        For Each Match in Matches
            tFile = Replace(Mid(Match.Value, Instr(Match.Value, """") + 1, Len(Match.Value) - Instr(Match.Value, """") - 1),"/","")
            If Not CheckExt(FSOs.GetExtensionName(tFile)) Then
                Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,""))&tFile, FilePath)
                SumFiles = SumFiles + 1
            End If
        Next
        Set Matches = Nothing
        Set regEx = Nothing