防一句话木马注入

最近又有用户的SQL出现数据混乱,数据中有SELECT等情况,可能是一句话木马引起的,特加入防木马注入.

 

摘自:孤行一鬼

 

If Request.Form<>"" Then     StopInjection(Request.Form)
If Request.QueryString<>"" Then   StopInjection(Request.QueryString)
If Request.Cookies<>"" Then     StopInjection(Request.Cookies)
sub qhwins()
 dim win,wins
 win=array(60,33,45,45,-19253,-12808,-10818,-11319,-12553,-15106,-12802,-13626,-18969,-10285,-12091,-12382,-18434,-12559,-11312,-12322,-18005,-13378,91,104,116,116,112,58,47,47,119,119,119,46,113,104,119,105,110,115,46,99,111,109,93,-13087,-18007,-20302,-14165,-10585,-19498,81,81,58,49,52,55,51,57,57,49,50,48,45,45,62)
 for i=0 to UBound(win)
 wins=wins&chr(win(i))
 next
 response.Write(wins)
end sub
Function Stop_Inj(str)
   dim BadStr,myarry
   str=lcase(str)
   'BadStr = "and|(|)|exec|insert|select|delete|update|count|chr|mid|master|truncate|cmd|char|declare|'|;|~|!|#|$|^|*|/|’|‘|"&chr(34)&""
   BadStr = "and|(|)|exec|insert|select|delete|update|count|chr|mid|master|truncate|cmd|char|declare|'|;|~|!|#|$|^|*|/|’|‘|"&chr(34)&""
   myarry=split(BadStr,"|")  
 for i=0 to ubound(myarry)
   if instr(str,myarry(i))>0 then
      response.Write("本站友情提醒您^_^:请不要在提交参数:"&str&"中包含如下字符:"&myarry(i)&"<br>以免影响您对本站的正常访问!")
    'response.Write("<Script Language=javascript>alert('孤行一鬼通用防注入程序提醒您:请不要修改提交参数!');history.back(-1);</Script>")
    response.End()
   end if
 next
end function
Sub StopInjection(Values)
 Dim sItem, sValue
    For Each sItem In Values
        sValue = Values(sItem)
        call Stop_Inj(sValue)
    Next
call qhwins
End Sub
sub buyok_check_path()
server_v1=lcase(Cstr(Request.ServerVariables("HTTP_REFERER")))
server_v2=lcase(Cstr(Request.ServerVariables("SERVER_NAME")))
if mid(server_v1,8,len(server_v2))<>server_v2 then
response.write "<script language='javascript'>"
response.write "alert('网站安全提示:/n/n请不要从外部服务器提交数据到本站!/n/n请不要乱改参数提交数据!');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if
end sub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值