Minor improvement to --check-payload

This commit is contained in:
Bernardo Damele 2011-04-08 14:34:00 +00:00
parent d5fb1378cc
commit beb98140b3

View File

@ -16,7 +16,6 @@ from lib.core.data import conf
from lib.core.data import paths from lib.core.data import paths
from lib.core.data import logger from lib.core.data import logger
rules = None rules = None
def __adjustGrammar(string): def __adjustGrammar(string):
@ -36,6 +35,7 @@ def checkPayload(payload):
global rules global rules
detected = False
payload = urldecode(payload) payload = urldecode(payload)
if not rules: if not rules:
@ -50,5 +50,10 @@ def checkPayload(payload):
if payload: if payload:
for rule, desc in rules: for rule, desc in rules:
regObj = getCompiledRegex(rule) regObj = getCompiledRegex(rule)
if regObj.search(payload): if regObj.search(payload):
detected = True
logger.warn("highly probable IDS/IPS detection: '%s: %s'" % (desc, payload)) logger.warn("highly probable IDS/IPS detection: '%s: %s'" % (desc, payload))
if not detected:
logger.warn("payload '%s' possibly gone undetected" % payload)