From feafa8ffe22f5eeb8000404aac1d635696457c96 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Wed, 10 Aug 2016 09:06:37 +0200 Subject: [PATCH] Slight refacto + sql comments are now placed in injection suspision. --- bin/SQLInjectionDetection.py | 40 +++++++++++++++--------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/bin/SQLInjectionDetection.py b/bin/SQLInjectionDetection.py index de3d4c90..62c1b0b4 100755 --- a/bin/SQLInjectionDetection.py +++ b/bin/SQLInjectionDetection.py @@ -1,15 +1,11 @@ #!/usr/bin/env python2 # -*-coding:UTF-8 -* """ - Template for new modules + Sql Injection module """ import time -import sys import string -import datetime -import redis -import os import urllib2 import re from pubsublogger import publisher @@ -21,6 +17,7 @@ from pyfaup.faup import Faup regex_injection = [] word_injection = [] +word_injection_suspect = [] # Classic atome injection regex_injection1 = "([[AND |OR ]+[\'|\"]?[0-9a-zA-Z]+[\'|\"]?=[\'|\"]?[0-9a-zA-Z]+[\'|\"]?])" @@ -35,21 +32,21 @@ regex_injection.append(regex_injection2) word_injection1 = [" IF ", " ELSE ", " CASE ", " WHEN ", " END ", " UNION ", "SELECT ", " FROM ", " ORDER BY ", " WHERE ", " DELETE ", " DROP ", " UPDATE ", " EXEC "] word_injection.append(word_injection1) -# Comment -word_injection2 = ["--", "#", "/*"] +# Database special keywords +word_injection2 = ["@@version", "POW(", "BITAND(", "SQUARE("] word_injection.append(word_injection2) -# Database special keywords -word_injection3 = ["@@version", "POW(", "BITAND(", "SQUARE("] +# Html keywords +word_injection3 = ["