复制代码 代码如下:
<%
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
%>
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!