This commit is contained in:
Bernardo Damele 2012-07-11 17:32:12 +01:00
parent 1d2c87e24e
commit 77b275f1a6
2 changed files with 18 additions and 18 deletions

View File

@ -696,43 +696,43 @@ def singleTimeLogMessage(message, level=logging.INFO, flag=None):
def setCurrentMessage(message):
if "[CRITICAL]" in message:
conf.currentMessage = "CRITICAL"
kb.currentMessage = "CRITICAL"
elif "[ERROR]" in message:
conf.currentMessage = "ERROR"
kb.currentMessage = "ERROR"
elif "[WARNING]" in message:
conf.currentMessage = "WARNING"
kb.currentMessage = "WARNING"
elif "[INFO]" in message:
conf.currentMessage = "INFO"
kb.currentMessage = "INFO"
elif "[DEBUG]" in message:
conf.currentMessage = "DEBUG"
kb.currentMessage = "DEBUG"
elif "[PAYLOAD]" in message:
conf.currentMessage = "PAYLOAD"
kb.currentMessage = "PAYLOAD"
elif "[TRAFFIC OUT]" in message:
conf.currentMessage = "TRAFFIC OUT"
kb.currentMessage = "TRAFFIC OUT"
elif "[TRAFFIC IN]" in message:
conf.currentMessage = "TRAFFIC IN"
kb.currentMessage = "TRAFFIC IN"
def setColour(message):
setCurrentMessage(message)
if not hasattr(conf, "currentMessage"):
if not hasattr(kb, "currentMessage"):
return message
if conf.currentMessage == "CRITICAL":
if kb.currentMessage == "CRITICAL":
return colored(message, 'white', on_color='on_red', attrs=['bold'])
elif conf.currentMessage == "ERROR":
elif kb.currentMessage == "ERROR":
return colored(message, 'red', attrs=['bold'])
elif conf.currentMessage == "WARNING":
elif kb.currentMessage == "WARNING":
return colored(message, 'yellow')
elif conf.currentMessage == "INFO":
elif kb.currentMessage == "INFO":
return colored(message, 'green')
elif conf.currentMessage == "DEBUG":
elif kb.currentMessage == "DEBUG":
return colored(message, 'blue')
elif conf.currentMessage == "PAYLOAD":
elif kb.currentMessage == "PAYLOAD":
return colored(message, 'magenta')
elif conf.currentMessage == "TRAFFIC OUT":
elif kb.currentMessage == "TRAFFIC OUT":
return colored(message, 'cyan')
elif conf.currentMessage == "TRAFFIC IN":
elif kb.currentMessage == "TRAFFIC IN":
return colored(message, 'grey')
else:
return message

View File

@ -1380,7 +1380,6 @@ def __setConfAttributes():
conf.authPassword = None
conf.boundaries = []
conf.cj = None
conf.currentMessage = None
conf.dbmsConnector = None
conf.dbmsHandler = None
conf.dnsServer = None
@ -1437,6 +1436,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
kb.commonOutputs = None
kb.counters = {}
kb.currentMessage = None
kb.data = AttribDict()
kb.dataOutputFlag = False