zoukankan
html css js c++ java
ASP上两个防止SQL注入式攻击Function
'
'==========================
'
'过滤提交表单中的SQL
'
'==========================
function
ForSqlForm()
dim
fqys,errc,i,items
dim
nothis(
18
)
nothis(
0
)
=
"
net user
"
nothis(
1
)
=
"
xp_cmdshell
"
nothis(
2
)
=
"
/add
"
nothis(
3
)
=
"
exec%20master.dbo.xp_cmdshell
"
nothis(
4
)
=
"
net localgroup administrators
"
nothis(
5
)
=
"
select
"
nothis(
6
)
=
"
count
"
nothis(
7
)
=
"
asc
"
nothis(
8
)
=
"
char
"
nothis(
9
)
=
"
mid
"
nothis(
10
)
=
"
''
"
nothis(
11
)
=
"
:
"
nothis(
12
)
=
"
""
"
nothis(
13
)
=
"
insert
"
nothis(
14
)
=
"
delete
"
nothis(
15
)
=
"
drop
"
nothis(
16
)
=
"
truncate
"
nothis(
17
)
=
"
from
"
nothis(
18
)
=
"
%
"
'
'nothis(19)="@"
errc
=
false
for
i
=
0
to
ubound
(nothis)
for
each
items in request.Form
if
instr
(request.Form(items),nothis(i))
<>
0
then
response.write(
"
<div>
"
)
response.write(
"
你所填写的信息:
"
&
server.HTMLEncode(request.Form(items))
&
"
<br>含非法字符:
"
&
nothis(i))
response.write(
"
</div>
"
)
response.write(
"
对不起,你所填写的信息含非法字符!<a href=""#"" onclick=""history.back()"">返回</a>
"
)
response.End()
end
if
next
next
end function
'
'==========================
'
'过滤查询中的SQL
'
'==========================
function
ForSqlInjection()
dim
fqys,errc,i
dim
nothis(
19
)
fqys
=
request.ServerVariables(
"
QUERY_STRING
"
)
nothis(
0
)
=
"
net user
"
nothis(
1
)
=
"
xp_cmdshell
"
nothis(
2
)
=
"
/add
"
nothis(
3
)
=
"
exec%20master.dbo.xp_cmdshell
"
nothis(
4
)
=
"
net localgroup administrators
"
nothis(
5
)
=
"
select
"
nothis(
6
)
=
"
count
"
nothis(
7
)
=
"
asc
"
nothis(
8
)
=
"
char
"
nothis(
9
)
=
"
mid
"
nothis(
10
)
=
"
''
"
nothis(
11
)
=
"
:
"
nothis(
12
)
=
"
""
"
nothis(
13
)
=
"
insert
"
nothis(
14
)
=
"
delete
"
nothis(
15
)
=
"
drop
"
nothis(
16
)
=
"
truncate
"
nothis(
17
)
=
"
from
"
nothis(
18
)
=
"
%
"
nothis(
19
)
=
"
@
"
errc
=
false
for
i
=
0
to
ubound
(nothis)
if
instr
(FQYs,nothis(i))
<>
0
then
errc
=
true
end
if
next
if
errc
then
response.write
"
查询信息含非法字符!<a href=""#"" onclick=""history.back()"">返回</a>
"
response.end
end
if
end function
查看全文
相关阅读:
equals与”==”的区别
数学--数论--积性函数(初步)
数学--数论-多重集排列组合与母函数
数学--数论--POJ 1061青蛙的约会 (扩展欧几里得算法)
数学--数论--POJ281(线性同余方程)
数学--数论--HDU1222 狼和兔子(最大公约数)
数学--数论--HDU1576 A / B(逆元)
VScode像Codeblocks一样,不启动调试和Debug直接运行
数学--数论--鸽巢原理
图论--拓扑排序--模板
原文地址:https://www.cnblogs.com/aowind/p/270995.html
最新文章
设计模式之☞适配器模式,通俗易懂,一学就会!!!
input 去除默认样式
android android7以上无法连接蓝牙
css 如何绘制正方形
css 居中的汇总
js 如何实现管道或者说组合
前端页面生命周期
数据结构基础概念录
js this是什么?[多次书写]
electron 安装过程出现未成功地运行
热门文章
new function 到底做了什么?如何自己实现new function
Java程序员应该知道的10个面向对象理论
重新使用Java的七个理由
Java对象内存结构
2013年ImportNew最受欢迎的10篇文章
推荐给初级Java程序员的3本进阶书
Java多线程面试问题集锦
性能调优、虚拟机、垃圾回收、软硬件协调相关文章和视频 — Part1
成为JavaGC专家Part I — 深入浅出Java垃圾回收机制
JDBC批处理Select语句
Copyright © 2011-2022 走看看