Defense against attacks ASP injection code

Source: Internet
Author: User
Tags servervariables

These days, the SQL injection vulnerability has hurt me, and the online code is too complicated and difficult. Finally, I found the omnipotent anti-injection code and shared it. The operation is easy to use. You only need to include or put it in conn. asp. At the end, it is estimated that there are still some dangerous characters that are not fully loaded. Please complete them for me. Thank you!

<%
''' -------- Define part ------------------
Dim fy_post, fy_get, fy_in, fy_inf, fy_xh, fy_db, fy_dbstr
'''': Specifies the string to be filtered, which is separated by "anti-DDoS ".
Fy_in = "''' defense; anti-and anti-exec anti-insert anti-select anti-delete anti-update anti-count anti-* anti-CHR anti-mid anti-master anti-truncate anti-Char anti-declare anti <anti> Anti-= anti |- defense _"
Fy_inf = Split (fy_in, "anti-DDoS ")
If request. Form <> "" then
For each fy_post in request. Form
For fy_xh = 0 to ubound (fy_inf)
If instr (lcase (request. Form (fy_post), fy_inf (fy_xh) <> 0 then
Response. write "<script language = JavaScript> alert. I am a cainiao, so be afraid of it. Just put it away! Leave a message '''); </SCRIPT>"
Response. Write "illegal operation! This site has made the following record for you <br>"
Response. Write "Operation IP:" & request. servervariables ("remote_addr") & "<br>"
Response. Write "operation time:" & now & "<br>"
Response. Write "Operation page:" & request. servervariables ("url") & "<br>"
Response. Write "submission method: Post <br>"
Response. Write "Submit parameters:" & fy_post & "<br>"
Response. Write "submit data:" & request. Form (fy_post)
Response. End
End if
Next
Next
End if
If request. querystring <> "then
For each fy_get in request. querystring
For fy_xh = 0 to ubound (fy_inf)
If instr (lcase (request. querystring (fy_get), fy_inf (fy_xh) <> 0 then
Response. write "<script language = JavaScript> alert. I am a cainiao, so be afraid of it. Just put it away! Leave a message '''); </SCRIPT>"
Response. Write "illegal operation! This site has made the following record for you <br>"
Response. Write "Operation IP:" & request. servervariables ("remote_addr") & "<br>"
Response. Write "operation time:" & now & "<br>"
Response. Write "Operation page:" & request. servervariables ("url") & "<br>"
Response. Write "submission method: Get <br>"
Response. Write "Submit parameters:" & fy_get & "<br>"
Response. Write "submit data:" & request. querystring (fy_get)
Response. End
End if
Next
Next
End if
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.