ASPSecurity SQL 防注入

简介:
 <%
'************** ASPSecurity SQL 防注入**************
' Copyright 2006
' Create:2006-4-06
' Update:2006-6-01
'***************************************************
 
If Request.Form<>"" Then StopInjection(Request.Form)
If Request.QueryString<>"" Then StopInjection(Request.QueryString)
If Request.Cookies<>"" Then StopInjection(Request.Cookies)
 
 
Function StopInjection(values)
 For Each N_Get In values
  Dim L_Get, L_Get2
  For Each L_Get In values
   L_Get2 = values(L_Get)
   Set regEx = New RegExp
   regEx.IgnoreCase = True
   regEx.Global = True
   regEx.Pattern = "(\bselect\b|\sand\s|'|\sdeclare\s)"
   If regEx.Test(L_Get2) Then
    Alert()
    response.End()
   End If
   Set regEx = Nothing
  Next
 Next
End Function 
 
 
Sub Alert()
 Dim str
 str = "<"&"Script Language=JavaScript"&">"
 str = str & "alert('== 雷客图ASP站长安全助手检测到了危险字符,已经禁止本次提交 ==\n');window.close();"
 str = str & "<"&"/Script"&">"
 response.write  str
End Sub
%>


 本文转自 simeon2005 51CTO博客,原文链接:http://blog.51cto.com/simeon/113522
相关文章
|
8月前
|
SQL 安全 Java
java springboot sql防注入的6种方式
java springboot sql防注入的6种方式
477 1
|
SQL 安全 Java
MyBatis的`${}`和`#{}`的区别及SQL防注入的方法
本文介绍了MyBatis的`${}`和`#{}`的用法区别,以及针对$可能带来的风险提供一种简易的SQL防注入的方法。
467 0
|
8小时前
|
SQL XML Linux
SQL Server的版本
【5月更文挑战第14天】SQL Server的版本
14 3
|
8小时前
|
SQL 存储 数据库连接
LabVIEW与SQL Server 2919 Express通讯
LabVIEW与SQL Server 2919 Express通讯
|
8小时前
|
SQL Windows
安装SQL Server 2005时出现对性能监视器计数器注册表值执行系统配置检查失败的解决办法...
安装SQL Server 2005时出现对性能监视器计数器注册表值执行系统配置检查失败的解决办法...
14 4
|
8小时前
|
SQL 数据可视化 Oracle
这篇文章教会你:从 SQL Server 移植到 DM(上)
这篇文章教会你:从 SQL Server 移植到 DM(上)