Giter Site home page Giter Site logo

zlikun-jee-sql-injection's Introduction

SQL注入过滤器

过滤器将拦截所有请求,解析请求包含的查询参数和JSON请求Body,使用正则表达式检查请求参数中是否包含SQL关键字和SQL注入语句,如检查到,直接返回400错误

# 第一组正则,当参数满足分别匹配1、2中的关键字时(1、2各至少命中一个),则认为有SQL注入
1. "insert|delete|update|select|create|drop|truncate|grant|alter|deny|revoke|call|execute|exec|declare|show|rename|set"
2. "into|from|set|where|table|database|view|index|on|cursor|procedure|trigger|for|password|union|and|or"

# 第二组正则,针对字符串拼接时,使用'符号截断SQL,后接注释、OR或UNION关键字进行SQL注入
"'.*(or|union|--|#|/*|;)"
  • pom.xml
<!-- 添加依赖(先上传到私服) -->
<dependency>
    <groupId>com.zlikun.jee</groupId>
    <artifactId>zlikun-jee-sql-injection</artifactId>
    <version>1.0.0</version>
</dependency>
  • spring-boot
# 启动类或配置类上添加如下注解即可
@EnableSqlInjectionFilter
  • spring-framework
# 添加如下配置即可(也可以在xml中配置)
@ComponentScan(basePackages = "com.zlikun.jee.web")

zlikun-jee-sql-injection's People

Contributors

zlikun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.