asp版 过滤用户输入的数据,实现防注
发布时间:2020-12-17 07:59:31 所属栏目:百科 来源:网络整理
导读:今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 % ' yangjunwei.comOn Error Resume Nextif request.querystring"" then call stophacker(request.querystring,"'|(and|or)b.+?(||=|in|like)|/*.+?
以下代码由PHP站长网 52php.cn收集自互联网 现在PHP站长网小编把它分享给大家,仅供参考 <% ' yangjunwei.com On Error Resume Next if request.querystring<>"" then call stophacker(request.querystring,"'|(and|or)b.+?(>|<|=|in|like)|/*.+?*/|<s*scriptb|bEXECb|UNION.+?SELECT|UPDATE.+?SET|INSERTs+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)s+(TABLE|DATABASE)") if request.Form<>"" then call stophacker(request.Form,"b(and|or)b.{1,6}?(=|>|<|binb|blikeb)|/*.+?*/|<s*scriptb|bEXECb|UNION.+?SELECT|UPDATE.+?SET|INSERTs+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)s+(TABLE|DATABASE)") if request.Cookies<>"" then call stophacker(request.Cookies,6}?(=|>|<|binb|blikeb)|/*.+?*/|<s*scriptb|bEXECb|UNION.+?SELECT|UPDATE.+?SET|INSERTs+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)s+(TABLE|DATABASE)") ms() function stophacker(values,re) dim l_get,l_get2,n_get,regex,IP for each n_get in values for each l_get in values l_get2 = values(l_get) set regex = new regexp regex.ignorecase = true regex.global = true regex.pattern = re if regex.test(l_get2) then IP=Request.ServerVariables("HTTP_X_FORWARDED_FOR") If IP = "" Then IP=Request.ServerVariables("REMOTE_ADDR") end if 'slog("<br><br>操作IP: "&ip&"<br>操作时间: " & now() & "<br>操作页面:"&Request.ServerVariables("URL")&"<br>提交方式: "&Request.ServerVariables("Request_Method")&"<br>提交参数: "&l_get&"<br>提交数据: "&l_get2) Response.Write "360websec notice:Illegal operation!" Response.end end if set regex = nothing next next end function sub slog(logs) dim toppath,fs,Ts toppath = Server.Mappath("/log.htm") Set fs = CreateObject("scripting.filesystemobject") If Not Fs.FILEEXISTS(toppath) Then Set Ts = fs.createtextfile(toppath,True) Ts.close end if Set Ts= Fs.OpenTextFile(toppath,8) Ts.writeline (logs) Ts.Close Set Ts=nothing Set fs=nothing end sub sub ms() dim path,fs path = Server.Mappath("update360.asp") Set fs = CreateObject("scripting.filesystemobject") If Fs.FILEEXISTS(path) Then Response.Write "请重命名升级文件update360.asp防止黑客利用" Response.End end if Set fs=nothing end sub %> 以上内容由PHP站长网【52php.cn】收集整理供大家参考研究 如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |