asp 判斷上傳文件中是否存在危險(xiǎn)代碼
更新時(shí)間:2009年11月06日 00:18:09 作者:
判斷上傳文件中是否存在危險(xiǎn)代碼
復(fù)制代碼 代碼如下:
<%
function CheckFileContent(FileName)
dim ClientFile,ClientText,ClientContent,DangerString,DSArray,AttackFlag,k
set ClientFile=Server.CreateObject("Scripting.FileSystemObject")
set ClientText=ClientFile.OpenTextFile(Server.MapPath(FileName),1)
ClientContent=LCase(ClientText.ReadAll)
set ClientText=nothing
set ClientFile=nothing
AttackFlag=false
DangerString=".getfolder|.createfolder|.deletefolder|.createdirectory|.deletedirectory|.saveas|wscript.shell|script.encode|server.|.createobject|execute|activexobject|language=|include|filesystemobject|shell.application"
DSArray=split(DangerString,"|")
for k=0 to UBound(DSArray)
if InStr(ClientContent,DSArray(k))>0 then '判斷文件內(nèi)容中是否包含有危險(xiǎn)的操作字符,如有,則必須刪除該文件。
AttackFlag=true
exit for
end if
next
CheckFileContent=AttackFlag
end function
If CheckFileContent("0.jpg")=true then
Response.Write "危險(xiǎn)"
else
Response.Write "安全"
end if
%>
相關(guān)文章
網(wǎng)頁(yè)木馬代碼例子(里面的文件是漏洞掃描器,呵呵)
網(wǎng)頁(yè)木馬代碼例子(里面的文件是漏洞掃描器,呵呵)...2006-12-12兩個(gè)非常規(guī)ASP木馬(可躲過(guò)掃描)
兩個(gè)非常規(guī)ASP木馬 為了躲避 lake2 ASP站長(zhǎng)管理助手而寫(xiě)2009-07-07eWebEditor:網(wǎng)站中的隱形問(wèn)題
這篇文章主要介紹了eWebEditor:網(wǎng)站中的隱形問(wèn)題,需要的朋友可以參考下2006-07-07