自己写的一个asp防注入系统

说明:

                           L_DI系统

 

全称:冷却防御注入系统(Leng_que_Defense_Inject)

使用方法:在需要过滤的asp文件的文件头加入<!--#include file="L_DI.asp"-->

使用环境:ASP

特色:
简单易用——代码短小精湛。
更安全——不仅检查了通过post和get方式提交的参数,还包括了cookies。
免费使用——不用花一分钱就可以使用这个小系统。

 

将一下代码保存为L_DI.asp

 

 <%@language=VBScript%>
<%

'检测到非法注入时的提示信息(可自行修改)
warn = "检测到非法注入!/n/n        —— L提示"

dim all_Illegal_Sql
dim one_Illegal_Sql
dim sql_get
dim sql_post
dim sql_cookie
dim n

'需过滤掉的非法字符(可自行修改)
all_Illegal_Sql = "'|*|%|and|select|where|from|update|delete|exec|char|nchar"

one_Illegal_Sql = split(all_Illegal_Sql, "|")

if request.querystring<>"" then
 for each sql_get in request.querystring
  for n=0 to ubound(one_Illegal_Sql)
   if instr(LCase(request.querystring(sql_get)), one_Illegal_Sql(n)) > 0 then
    response.write "<script language='javascript'>alert('"+warn+"');history.back(-1)</script>"
    response.end
   end if
  next
 next
end if

if request.form<>"" then
 for each sql_post in request.form
  for n=0 to ubound(one_Illegal_Sql)
   if instr(LCase(request.form(sql_post)), one_Illegal_Sql(n)) > 0 then
    response.write "<script language='javascript'>alert('"+warn+"');history.back(-1)</script>"
    response.end
   end if
  next
 next
end if

if request.cookies<>"" then
 for each sql_cookie in request.cookies
  for n=0 to ubound(one_Illegal_Sql)
   if instr(LCase(request.cookies(sql_cookie)), one_Illegal_Sql(n)) > 0 then
    response.write "<script language='javascript'>alert('"+warn+"');history.back(-1)</script>"
    response.end
   end if
  next
 next
end if

%>

 

前段时间本人在学习asp,同时也在做着一个信息发布系统,其实很早就学会了sql注入攻击了,但是一直不是很清楚其中的原理和漏洞成因,通过前段时间的学习,终于理解了这个漏洞的来龙去脉,于是手痒痒就写了那么个小东东,自己还美其名曰:防御注入系统。呵呵,可能会让高手笑话了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值