asp中防止脚本注入攻击

<%
  SQL_injdata = "'|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
  SQL_inj = split(SQL_Injdata,"|")

  If Request.QueryString<>"" Then
    For Each SQL_Get In Request.QueryString
      For SQL_Data=0 To Ubound(SQL_inj)
        if instr(Request.QueryString(SQL_Get),Sql_Inj(Sql_DATA))>0 Then
          Response.Write "<script Language=JavaScript>alert('非法连接!!')</script>"
          Response.end
        end if
      next
    Next
  End If

  If Request.Form<>"" Then
    For Each Sql_Post In Request.Form
      For SQL_Data=0 To Ubound(SQL_inj)
        if instr(Request.Form(Sql_Post),Sql_Inj(Sql_DATA))>0 Then
          Response.Write "<script Language=JavaScript>alert('非法连接!!')</script>"
    Response.end
        end if
      next
    next
  end if
%>

 

阅读更多
个人分类: WEB开发
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭