asp 업로드 파일 에 위험 코드 가 있 는 지 판단


<%
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 ' , , 。
AttackFlag=true
exit for
end if

next

CheckFileContent=AttackFlag
end function

If CheckFileContent("0.jpg")=true then
Response.Write " "
else
Response.Write " "
end if
%>

좋은 웹페이지 즐겨찾기