ASP防止SQL注入的360解决方案
2013-05-19 08:11
274 查看
<% On Error Resume Next if request.querystring<>"" then call stophacker(request.querystring,"'|(and|or)\b.+?(>|<|=|in|like)|/\*.+?\*/|<\s*script\b|\bEXEC\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\s+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}?(=|>|<|\bin\b|\blike\b)|/\*.+?\*/|<\s*script\b|\bEXEC\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\s+(TABLE|DATABASE)") if request.Cookies<>"" then call stophacker(request.Cookies,"\b(and|or)\b.{1,6}?(=|>|<|\bin\b|\blike\b)|/\*.+?\*/|<\s*script\b|\bEXEC\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\s+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 %>
相关文章推荐
- asp.net 360通用防护代码,防止sql注入与xss跨站漏洞攻击
- 防止sql注入 参数化解决方案
- asp 防止SQL注入代码
- ASP.Net中防止刷新自动触发事件的解决方案
- ASP.Net防止刷新自动触发事件的解决方案
- ASP.NET MVC 5使用Filter过滤Action参数防止sql注入,让你代码安全简洁
- asp.net sql防止sql注入
- js asp c# 防止sql注入
- asp.net如何防止SQL注入
- asp 防止SQL注入
- ASP.NET防止Sql注入的解决方法
- ASP.NET如何防止SQL注入
- asp.net 2.0 防止密码框被清空的解决方案
- ASP.Net防止刷新自动触发事件的解决方案
- ASP.Net防止刷新自动触发事件的解决方案
- ASP防止跨站脚本和SQL注入代码
- ASP.Net防止刷新自动触发事件的解决方案
- 从别人的一个“如何防止SQL注入“的帖子联想出来的一个有趣的解决方案”
- 防止asp中的access数据库被下载的解决方案
- asp.net防止sql注入,删除关键字的一个重要方法