当前位置:主页 > 查看内容

防ASP注入终极防范

发布时间:2021-05-06 00:00| 位朋友查看

简介:下面给出4个函数,足够你抵挡一切SQL注入漏洞!读懂代码,你就能融会贯通。 注意要对所有的request对象进行过滤:包括 request.cookie, request.ServerVariables 等等容易被忽视的对象: 程序代码 复制代码 代码如下: function killn(byval s1) '过滤数值型……
下面给出4个函数,足够你抵挡一切SQL注入漏洞!读懂代码,你就能融会贯通。

注意要对所有的request对象进行过滤:包括 request.cookie, request.ServerVariables 等等容易被忽视的对象:

程序代码
复制代码 代码如下:

function killn(byval s1) '过滤数值型参数
if not isnumeric(s1) then 
killn=0
else
if s1〈0 or s1〉2147483647 then 
killn=0
else
killn=clng(s1)
end if
end if
end function

function killc(byval s1) 过滤货币型参数
if not isnumeric(s1) then 
killc=0
else
killc=formatnumber(s1,2,-1,0,0)
end if
end function

function killw(byval s1) '过滤字符型参数
if len(s1)=0 then
killw=""
else
killw=trim(replace(s1,"'",""))
end if
end function

function killbad(byval s1) 过滤所有危险字符,包括跨站脚本
If len(s1) = 0 then
killbad=""
else
killbad = trim(replace(replace(replace(replace(replace(replace(replace(replace(s1,Chr(10), "〈br〉"), Chr(34), """), "〉", ">"), "〈", "<"), "&", "&"),chr(39),"'"),chr(32)," "),chr(13),""))
end if
end function 

原文链接:https://m.jb51.net/article/28807.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:asp目录读写权限检测脚本 TestFolder 下一篇:没有了

推荐图文


随机推荐