Previously issued a similar, support ASP and PHP version (Portal: http://www.bkjia.com/Article/201102/83466.html oldjun original,) Today I combined with a customer portal site security maintenance requirements, the method to prevent JSKY from scanning WEB applications is named webips. The following code has been tested: Mainstream JSKY, small steel gun, identification, MatriXay, WEB application scanners such as WebRavor, IBM Appscan, and HP WebInspect are ineffective. We also hope programmers can join the Honker Security Team to explore unknown fields and now release ASP version code, at the beginning, I made a judgment on the web spider and added anti-injection code to the ASP program of the garbage point. I hope everyone can work together to improve it! (Usage: create a file webips. asp and call some of the public files, usually config. asp)
<%
User_agent = Request. ServerVariables ("HTTP_USER_AGENT ")
Function check (user_agent) to determine whether it is a spider
Allow_agent = split ("Baiduspider, Scooter, Baidu, Googlebot, Sosospider, Yahoo, YoudaoBot, msnbot, Sogou, Baidu, FAST-WebCrawler, MSNBOT, Aleksika Spider, larbin, Slurp, cuil ",",")
Check_agent = false
For agenti = lbound (allow_agent) to ubound (allow_agent)
If instr (user_agent, allow_agent (agenti)> 0 then
Check_agent = true
Exit
End if
Next
Check = check_agent
End function
If check (user_agent) = False then
If request. servervariables ("query_string") <> "then
Urlcan = "? "& Request. servervariables (" query_string ")
Else
Urlcan = ""
End if
Rurl = "http: //" & request. servervariables ("http_host") & request. servervariables ("url") & urlcan
If session ("refresh") <> 1 then
Session ("refresh") = session ("refresh") + 1
Response. redirect rurl
End if
Ips = Request. Cookies ("ips ")
If ips <> "" then
Ips = ips + "dd"
Response. Cookies ("ips") = ips
Response. redirect rurl
End if
End if
%>
<%
Dim SQL _injdata, SQL _inj, SQL _Get, SQL _Data, SQL _Post, SQL _cook
SQL _injdata = "| and | exec | insert | select | delete | update | count | chr | master | truncate | char | declare | -- | script | cast"
SQL _inj = split (SQL _Injdata, "| ")
If Request. QueryString <> "Then
For Each SQL _Get In Request. QueryString
For SQL _Data = 0 To Ubound (SQL _inj)
If instr (LCase (Request. QueryString (SQL _Get), SQL _Inj (SQL _DATA)> 0 Then
Response. Write"