foosuncms防sql注入代码(目前用最严的过滤方式)

来源:互联网 发布:淘宝手机壳转化率 编辑:程序博客网 时间:2024/06/08 00:15

从foosuncms配置文件中提取出来的,希望可以给大家帮助!  

Function NoSqlHack(FS_inputStr)
Dim f_NoSqlHack_AllStr,f_NoSqlHack_Str,f_NoSqlHack_i,Str_InputStr
Str_InputStr=FS_inputStr
'目前用最严的过滤方式
f_NoSqlHack_AllStr="dbcc|alter|drop|* |and|exec|or|insert|select|delete|update|count|master|truncate|declare|char|mid(|chr|set |where|xp_cmdshell|tab"
f_NoSqlHack_Str = Split(f_NoSqlHack_AllStr,"|")

For f_NoSqlHack_i=LBound(f_NoSqlHack_Str) To Ubound(f_NoSqlHack_Str)
   If Instr(LCase(Str_InputStr),f_NoSqlHack_Str(f_NoSqlHack_i))<>0 Then
    If f_NoSqlHack_Str(f_NoSqlHack_i)="'" Then f_NoSqlHack_Str(f_NoSqlHack_i)=" /' "
    Response.Write "<html><title>警告</title><body bgcolor=""EEEEEE"" leftmargin=""60"" topmargin=""30""><font style=""font-size:16px;font-weight:bolder;color:blue;""><li>您提交的数据有恶意字符</li></font><font style=""font-size:14px;font-weight:bolder;color:red;""><br><li>您的数据已经被记录!</li><br><li>您的IP:"&Request.ServerVariables("Remote_Addr")&"</li><br><li>操作日期:"&Now&"</li></font></body></html><!--Powered by Foosun Inc.,AddTime:"&now&"-->"
    Response.End
   End if
Next
NoSqlHack = Replace(Replace(Str_InputStr,"'","''"),"%27","''")
    End Function

作者:小牛

http://www.77xue.com/a/asp/w/asp_5/20081111/3601.html

 

原创粉丝点击