From a54c261496a1796340547f78546c66f2191e5f78 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 11 Dec 2012 14:44:43 +0100 Subject: [PATCH] Minor update for Issues #292 & #293 (only single alert per target) --- lib/controller/checks.py | 17 ++++++++++------- lib/core/option.py | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index eea596db6..abc6c0ebe 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -521,15 +521,18 @@ def checkSqlInjection(place, parameter, value): injection.conf.regexp = conf.regexp injection.conf.optimize = conf.optimize - if conf.beep: - beep() + if not kb.alerted: + if conf.beep: + beep() - if conf.alert: - infoMsg = "executing alerting shell command(s) ('%s')" % conf.alert - logger.info(infoMsg) + if conf.alert: + infoMsg = "executing alerting shell command(s) ('%s')" % conf.alert + logger.info(infoMsg) - process = execute(conf.alert, shell=True) - process.wait() + process = execute(conf.alert, shell=True) + process.wait() + + kb.alerted = True # There is no need to perform this test for other # tags diff --git a/lib/core/option.py b/lib/core/option.py index 89654fd29..8aa6fb71f 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1480,6 +1480,7 @@ def _setKnowledgeBaseAttributes(flushAll=True): kb.absFilePaths = set() kb.adjustTimeDelay = None + kb.alerted = False kb.alwaysRefresh = None kb.arch = None kb.authHeader = None