濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > 一個(gè)查ASP木馬的小東東

一個(gè)查ASP木馬的小東東

熱門(mén)標(biāo)簽:電話(huà)機(jī)器人銷(xiāo)售公司嗎 客服外呼系統(tǒng)呼叫中心 土地證宗地圖標(biāo)注符號(hào) 成都銷(xiāo)售外呼系統(tǒng)公司 vue 地圖標(biāo)注拖拽 鎮(zhèn)江云外呼系統(tǒng)怎么樣 自動(dòng)外呼系統(tǒng)怎么防止封卡 保定電銷(xiāo)機(jī)器人軟件 電話(huà)機(jī)器人案例
關(guān)于查ASP木馬的程序,記得半年前在八進(jìn)制發(fā)了一個(gè)測(cè)試版(具體的URL:http://forum.eviloctal.com/read-htm-tid-19665.html),得到很多朋友的指導(dǎo),學(xué)到了很多東西,非常感謝他們?,F(xiàn)在我發(fā)的這個(gè)升級(jí)版,修補(bǔ)了以前的bug,加入了對(duì)一些組件寫(xiě)文件函數(shù)的檢測(cè),更加趨于完美了,個(gè)人認(rèn)為想繞過(guò)去有點(diǎn)難度哦。
這回的默認(rèn)密碼是security
當(dāng)然啦,哈哈,lake2“比武招親”,歡迎各位朋友提出繞過(guò)檢測(cè)的馬馬來(lái),一經(jīng)證實(shí),lake2將把我自己寫(xiě)的某ASP木馬“嫁”給他^_^ 特別有創(chuàng)意的,送你一個(gè)我最新弄出來(lái)的腳本,具體嘛,嘿嘿,到時(shí)候就知道啦。
戰(zhàn)書(shū)已下,誰(shuí)來(lái)迎戰(zhàn)?
源碼,另存為asp文件即可使用:

%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
%
'設(shè)置密碼
PASSWORD = "security"

dim Report

if request.QueryString("act")="login" then
  if request.Form("pwd") = PASSWORD then session("pig")=1
end if
%>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
html>
head>
meta http-equiv="Content-Type" content="text/html; charset=gb2312">
title>Scan WebShell -- ASPSecurity For Hacking/title>
style type="text/css">
!--
body,td,th {
  font-size: 12px;
}
-->
/style>
/head>
body>
%If Session("pig") > 1 then%>
form name="form1" method="post" action="?act=login">
 div align="center">Password: 
 input name="pwd" type="password" size="15"> 
 input type="submit" name="Submit" value="提交">
 /div>
/form>
%
else
  if request.QueryString("act")>"scan" then
%>
        form action="?act=scan" method="post" name="form1">
         p>b>填入你要檢查的路徑:/b>
         input name="path" type="text" style="border:1px solid #999" value="." size="30" />
         br>
        * 網(wǎng)站根目錄的相對(duì)路徑,填“\”即檢查整個(gè)網(wǎng)站;“.”為程序所在目錄br>
        br>
        你要干什么: 
        input name="radiobutton" type="radio" value="sws" checked>
        查ASP木馬
        input type="radio" name="radiobutton" value="sf">

        搜索符合條件之文件br>
        br>
        -------------- 如果搜索文件需將以下內(nèi)容填寫(xiě)完整 ------------------br>
        br>
        查找內(nèi)容:
 input name="Search_Content" type="text" id="Search_Content" style="border:1px solid #999" size="20">
* 要查找的字符串,不填就只進(jìn)行日期檢查br/>
修改日期:
input name="Search_Date" type="text" style="border:1px solid #999" value="%=Left(Now(),InStr(now()," ")-1)%>" size="20">
* 多個(gè)日期用;隔開(kāi),任意日期填寫(xiě)a href="#" onClick="javascript:form1.Search_Date.value='ALL'">ALL/a>br/>
文件類(lèi)型:
input name="Search_FileExt" type="text" style="border:1px solid #999" value="*" size="20">
* 類(lèi)型之間用,隔開(kāi),*表示所有類(lèi)型        br>
       br>
       input type="submit" value=" 開(kāi)始掃描 " style="background:#fff;border:1px solid #999;padding:2px 2px 0px 2px;margin:4px;border-width:1px 3px 1px 3px" />
     /p>
/form>
%
  else
    server.ScriptTimeout = 600
    if request.Form("path")="" then
      response.Write("No Hack")
      response.End()
    end if
    if request.Form("path")="\" then
      TmpPath = Server.MapPath("\")
    elseif request.Form("path")="." then
      TmpPath = Server.MapPath(".")
    else
      TmpPath = Server.MapPath("\")"\"request.Form("path")
    end if
    timer1 = timer
    Sun = 0
    SumFiles = 0
    SumFolders = 1
    If request.Form("radiobutton") = "sws" Then
      DimFileExt = "asp,cer,asa,cdx"
      Call ShowAllFile(TmpPath)
    Else
      If request.Form("path") = "" or request.Form("Search_Date") = "" or request.Form("Search_FileExt") = "" Then
        response.Write("緝捕條件不完全,恕難從命br>br>a href='javascript:history.go(-1);'>請(qǐng)返回重新輸入/a>")
        response.End()
      End If
      DimFileExt = request.Form("Search_fileExt")
      Call ShowAllFile2(TmpPath)
    End If
%>
table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
 tr>
 th> Scan WebShell -- ASPSecurity For Hacking
 /tr>
 tr>
 td class="CPanel" style="padding:5px;line-height:170%;clear:both;font-size:12px">
 div id="updateInfo" style="background:ffffe1;border:1px solid #89441f;padding:4px;display:none">/div>
掃描完畢!一共檢查文件夾font color="#FF0000">%=SumFolders%>/font>個(gè),文件font color="#FF0000">%=SumFiles%>/font>個(gè),發(fā)現(xiàn)可疑點(diǎn)font color="#FF0000">%=Sun%>/font>個(gè)
  table width="100%" border="0" cellpadding="0" cellspacing="0">
   tr>
     td valign="top">
       table width="100%" border="1" cellpadding="0" cellspacing="0" style="padding:5px;line-height:170%;clear:both;font-size:12px">
       tr>
%If request.Form("radiobutton") = "sws" Then%>
       td width="20%">文件相對(duì)路徑/td>
       td width="20%">特征碼/td>
       td width="40%">描述/td>
       td width="20%">創(chuàng)建/修改時(shí)間/td>
%else%> 
       td width="50%">文件相對(duì)路徑/td>
       td width="25%">文件創(chuàng)建時(shí)間/td>
       td width="25%">修改時(shí)間/td>
%end if%>
       /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>font size=""2"">本頁(yè)執(zhí)行共用了"thetime"毫秒/font>"
  end if
end if

%>
hr>
div align="center">本程序取自a >雷客圖ASP站長(zhǎng)安全助手/a>的ASP木馬查找和可疑文件搜索功能br>
powered by a  target=_blank>lake2/a> ( Build 20060615 ) /div>
/body>
/html>
%

'遍歷處理path及其子目錄所有文件
Sub ShowAllFile(Path)
  Set FSO = CreateObject("Scripting.FileSystemObject")
  if not fso.FolderExists(path) then exit sub
  Set f = FSO.GetFolder(Path)
  Set fc2 = f.files
  For Each myfile in fc2
    If CheckExt(FSO.GetExtensionName(path"\"myfile.name)) Then
      Call ScanFile(PathTemp"\"myfile.name, "")
      SumFiles = SumFiles + 1
    End If
  Next
  Set fc = f.SubFolders
  For Each f1 in fc
    ShowAllFile path"\"f1.name
    SumFolders = SumFolders + 1
 Next
  Set FSO = Nothing
End Sub

'檢測(cè)文件
Sub ScanFile(FilePath, InFile)
  If InFile > "" Then
    Infiles = "font color=red>該文件被a href=""http://"Request.Servervariables("server_name")"/"tURLEncode(InFile)""" target=_blank>" InFile  "/a>文件包含執(zhí)行/font>"
  End If
  Set FSOs = CreateObject("Scripting.FileSystemObject")
  on error resume next
  set ofile = fsos.OpenTextFile(FilePath)
  filetxt = Lcase(ofile.readall())
  If err Then Exit Sub end if
  if len(filetxt)>0 then
    '特征碼檢查
    filetxt = vbcrlf  filetxt
    temp = "a href=""http://"Request.Servervariables("server_name")"/"tURLEncode(replace(replace(FilePath,server.MapPath("\")"\","",1,1,1),"\","/"))""" target=_blank>"replace(FilePath,server.MapPath("\")"\","",1,1,1)"/a>"
      'Check "WScr"DoMyBest"ipt.Shell"
      If instr( filetxt, Lcase("WScr"DoMyBest"ipt.Shell") ) or Instr( 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>font color=red>危險(xiǎn)組件,一般被ASP木馬利用/font>"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End if
      'Check "She"DoMyBest"ll.Application"
      If instr( filetxt, Lcase("She"DoMyBest"ll.Application") ) or Instr( 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>font color=red>危險(xiǎn)組件,一般被ASP木馬利用/font>"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End If
      'Check .Encode
      Set regEx = New RegExp
      regEx.IgnoreCase = True
      regEx.Global = True
      regEx.Pattern = "\bLANGUAGE\s*=\s*[""]?\s*(vbscript|jscript|javascript).encode\b"
      If regEx.Test(filetxt) Then
        Report = Report"tr>td>"temp"/td>td>(vbscript|jscript|javascript).Encode/td>td>font color=red>似乎腳本被加密了/font>"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End If
      'Check my ASP backdoor :(
      regEx.Pattern = "\bEv""al\b"
      If regEx.Test(filetxt) Then
        Report = Report"tr>td>"temp"/td>td>Ev""al/td>td>e""val()函數(shù)可以執(zhí)行任意ASP代碼,被一些后門(mén)利用。其形式一般是:ev""al(X)br>但是javascript代碼中也可以使用,有可能是誤報(bào)。"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End If
      'Check execute backdoor
      regEx.Pattern = "[^.]\bExe""cute\b"
      If regEx.Test(filetxt) Then
        Report = Report"tr>td>"temp"/td>td>Exec""ute/td>td>font color=red>e""xecute()函數(shù)可以執(zhí)行任意ASP代碼,被一些后門(mén)利用。其形式一般是:ex""ecute(X)/font>br>"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End If
      '----------------------Start Update 200605031-----------------------------
      'Check .CreateTextFile and .OpenTextFile
      regEx.Pattern = "\.(Open|Create)TextFile\b"
      If regEx.Test(filetxt) Then
        Report = Report"tr>td>"temp"/td>td>.CreateTextFile|.OpenTextFile/td>td>使用了FSO的CreateTextFile|OpenTextFile函數(shù)讀寫(xiě)文件"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End If
      'Check .SaveToFile
      regEx.Pattern = "\.SaveToFile\b"
      If regEx.Test(filetxt) Then
        Report = Report"tr>td>"temp"/td>td>.SaveToFile/td>td>使用了Stream的SaveToFile函數(shù)寫(xiě)文件"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End If
      'Check .Save
      regEx.Pattern = "\.Save\b"
      If regEx.Test(filetxt) Then
        Report = Report"tr>td>"temp"/td>td>.Save/td>td>使用了XMLHTTP的Save函數(shù)寫(xiě)文件"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
      End If
      '------------------ End ----------------------------
      Set regEx = Nothing

    'Check include file
    Set regEx = New RegExp
    regEx.IgnoreCase = True
    regEx.Global = True
    regEx.Pattern = "!--\s*#include\s*file\s*=\s*"".*"""
    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, replace(FilePath,server.MapPath("\")"\","",1,1,1) )
        SumFiles = SumFiles + 1
      End If
    Next
    Set Matches = Nothing
    Set regEx = Nothing

    'Check include virtual
    Set regEx = New RegExp
    regEx.IgnoreCase = True
    regEx.Global = True
    regEx.Pattern = "!--\s*#include\s*virtual\s*=\s*"".*"""
    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( Server.MapPath("\")"\"tFile, replace(FilePath,server.MapPath("\")"\","",1,1,1) )
        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, replace(FilePath,server.MapPath("\")"\","",1,1,1) )
        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]*|\()[^""]\)"
    If regEx.Test(filetxt) Then
      Report = Report"tr>td>"temp"/td>td>Server.Exec""ute/td>td>font color=red>不能跟蹤檢查Server.e""xecute()函數(shù)執(zhí)行的文件。請(qǐng)管理員自行檢查/font>br>"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
      Sun = Sun + 1
    End If
    Set Matches = Nothing
    Set regEx = Nothing

    'Check RunatScript
    Set XregEx = New RegExp
    XregEx.IgnoreCase = True
    XregEx.Global = True
    XregEx.Pattern = "scr""ipt\s*(.|\n)*?runat\s*=\s*""?server""?(.|\n)*?>"
    Set XMatches = XregEx.Execute(filetxt)
    For Each Match in XMatches
      tmpLake2 = Mid(Match.Value, 1, InStr(Match.Value, ">"))
      srcSeek = InStr(1, tmpLake2, "src", 1)
      If srcSeek > 0 Then
        srcSeek2 = instr(srcSeek, tmpLake2, "=")
        For i = 1 To 50
          tmp = Mid(tmpLake2, srcSeek2 + i, 1)
          If tmp > " " and tmp > chr(9) and tmp > vbCrLf Then
            Exit For
          End If
        Next
        If tmp = """" Then
          tmpName = Mid(tmpLake2, srcSeek2 + i + 1, Instr(srcSeek2 + i + 1, tmpLake2, """") - srcSeek2 - i - 1)
        Else
          If InStr(srcSeek2 + i + 1, tmpLake2, " ") > 0 Then tmpName = Mid(tmpLake2, srcSeek2 + i, Instr(srcSeek2 + i + 1, tmpLake2, " ") - srcSeek2 - i) Else tmpName = tmpLake2
          If InStr(tmpName, chr(9)) > 0 Then tmpName = Mid(tmpName, 1, Instr(1, tmpName, chr(9)) - 1)
          If InStr(tmpName, vbCrLf) > 0 Then tmpName = Mid(tmpName, 1, Instr(1, tmpName, vbcrlf) - 1)
          If InStr(tmpName, ">") > 0 Then tmpName = Mid(tmpName, 1, Instr(1, tmpName, ">") - 1)
        End If
        Call ScanFile( Mid(FilePath,1,InStrRev(FilePath,"\"))tmpName , replace(FilePath,server.MapPath("\")"\","",1,1,1))
        SumFiles = SumFiles + 1
      End If
    Next
    Set Matches = Nothing
    Set regEx = Nothing

    'Check Crea""teObject
    Set regEx = New RegExp
    regEx.IgnoreCase = True
    regEx.Global = True
    regEx.Pattern = "CreateO""bject[ |\t]*\(.*\)"
    Set Matches = regEx.Execute(filetxt)
    For Each Match in Matches
      If Instr(Match.Value, "") or Instr(Match.Value, "+") or Instr(Match.Value, """") = 0 or Instr(Match.Value, "(") > InStrRev(Match.Value, "(") Then
        Report = Report"tr>td>"temp"/td>td>Creat""eObject/td>td>Crea""teObject函數(shù)使用了變形技術(shù)??赡苁钦`報(bào)"infiles"/td>td>"GetDateCreate(filepath)"br>"GetDateModify(filepath)"/td>/tr>"
        Sun = Sun + 1
        exit sub
      End If
    Next
    Set Matches = Nothing
    Set regEx = Nothing
  end if
  set ofile = nothing
  set fsos = nothing
End Sub

'檢查文件后綴,如果與預(yù)定的匹配即返回TRUE
Function CheckExt(FileExt)
  If DimFileExt = "*" Then CheckExt = True
  Ext = Split(DimFileExt,",")
  For i = 0 To Ubound(Ext)
    If Lcase(FileExt) = Ext(i) Then 
      CheckExt = True
      Exit Function
    End If
  Next
End Function

Function GetDateModify(filepath)
  Set fso = CreateObject("Scripting.FileSystemObject")
 Set f = fso.GetFile(filepath) 
  s = f.DateLastModified 
  set f = nothing
  set fso = nothing
  GetDateModify = s
End Function

Function GetDateCreate(filepath)
  Set fso = CreateObject("Scripting.FileSystemObject")
 Set f = fso.GetFile(filepath) 
  s = f.DateCreated 
  set f = nothing
  set fso = nothing
  GetDateCreate = s
End Function

Function tURLEncode(Str)
  temp = Replace(Str, "%", "%25")
  temp = Replace(temp, "#", "%23")
  temp = Replace(temp, "", "%26")
  tURLEncode = temp
End Function

Sub ShowAllFile2(Path)
  Set FSO = CreateObject("Scripting.FileSystemObject")
  if not fso.FolderExists(path) then exit sub
  Set f = FSO.GetFolder(Path)
  Set fc2 = f.files
  For Each myfile in fc2
    If CheckExt(FSO.GetExtensionName(path"\"myfile.name)) Then
      Call IsFind(Path"\"myfile.name)
      SumFiles = SumFiles + 1
    End If
  Next
  Set fc = f.SubFolders
  For Each f1 in fc
    ShowAllFile2 path"\"f1.name
    SumFolders = SumFolders + 1
 Next
  Set FSO = Nothing
End Sub

Sub IsFind(thePath)
  theDate = GetDateModify(thePath)
  on error resume next
  theTmp = Mid(theDate, 1, Instr(theDate, " ") - 1)
  if err then exit Sub

  xDate = Split(request.Form("Search_Date"),";")

  If request.Form("Search_Date") = "ALL" Then ALLTime = True

  For i = 0 To Ubound(xDate)
    If theTmp = xDate(i) or ALLTime = True Then 
      If request("Search_Content") > "" Then
        Set FSOs = CreateObject("Scripting.FileSystemObject")
        set ofile = fsos.OpenTextFile(thePath, 1, false, -2)
        filetxt = Lcase(ofile.readall())
        If Instr( filetxt, LCase(request.Form("Search_Content"))) > 0 Then
          temp = "a href=""http://"Request.Servervariables("server_name")"/"tURLEncode(Replace(replace(thePath,server.MapPath("\")"\","",1,1,1),"\","/"))""" target=_blank>"replace(thePath,server.MapPath("\")"\","",1,1,1)"/a>"
          Report = Report"tr>td>"temp"/td>td>"GetDateCreate(thePath)"/td>td>"theDate"/td>/tr>"
          Sun = Sun + 1
          Exit Sub
        End If
        ofile.close()
        Set ofile = Nothing
        Set FSOs = Nothing
      Else
        temp = "a href=""http://"Request.Servervariables("server_name")"/"tURLEncode(Replace(replace(thePath,server.MapPath("\")"\","",1,1,1),"\","/"))""" target=_blank>"replace(thePath,server.MapPath("\")"\","",1,1,1)"/a>"
        Report = Report"tr>td>"temp"/td>td>"GetDateCreate(thePath)"/td>td>"theDate"/td>/tr>"
        Sun = Sun + 1
        Exit Sub
      End If
    End If
  Next

End Sub
%>

標(biāo)簽:臺(tái)灣 成都 內(nèi)江 麗江 天津 重慶 公主嶺 懷化

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《一個(gè)查ASP木馬的小東東》,本文關(guān)鍵詞  一個(gè),查,ASP,木馬,的,小,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《一個(gè)查ASP木馬的小東東》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于一個(gè)查ASP木馬的小東東的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    上蔡县| 无为县| 永和县| 奇台县| 简阳市| 原平市| 托克逊县| 延安市| 东源县| 铁岭市| 陆河县| 唐山市| 林芝县| 双流县| 陆丰市| 通道| 淮安市| 旌德县| 云和县| 比如县| 樟树市| 柳林县| 麻阳| 三穗县| 衢州市| 上饶市| 桓仁| 延津县| 沁源县| 博白县| 固始县| 开原市| 武汉市| 调兵山市| 乐亭县| 西贡区| 威宁| 井研县| 丰城市| 云霄县| 德庆县|