From ecc25c09b1f00389e77c8b7143a5a26e2403ecaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Sat, 11 Oct 2014 00:45:19 +0200 Subject: [PATCH] [mac_prises] Enough tested. --- surveillance/mac_prises/mac_prise_analyzer.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/surveillance/mac_prises/mac_prise_analyzer.py b/surveillance/mac_prises/mac_prise_analyzer.py index 4528de39..c9122c6a 100755 --- a/surveillance/mac_prises/mac_prise_analyzer.py +++ b/surveillance/mac_prises/mac_prise_analyzer.py @@ -3,7 +3,7 @@ # # Sclaimer # PEB : 01/02/2013 -> now() -# +# # Blablabla. (cf mac_prise.py) import psycopg2 @@ -60,7 +60,7 @@ def genere_comptage(duree): """ Grosse fonction de hack pour ne pas écrire six fois le même formatage de sortie bidon. Prend en argument : - + * duree, qui peut valoir 'instant', 'heuristique', ou 'journalier', permet d'importer les variables de config qui vont bien """ @@ -93,7 +93,7 @@ def genere_comptage(duree): Logs.append(u"Entrée rejetée du tableau %s, car rapport inférieur au seuil : (%s).\n\n" % (duree, rapport)) else: pass - + if len(pb_comptage_suspect) > 0: for clef, valeur in pb_comptage_suspect.items(): requete = "INSERT INTO spotted (mac, type, chambre, date, rapport, seuil) VALUES(%s, %s, %s, %s, %s, %s);" @@ -191,13 +191,13 @@ def reperage_mac_inconnue(): longueur_max = max([len(", ".join(a[0])) for a in probleme.values()] + [len("macs")]) + 2 largeurs = (len('chambre') + 2, longueur_max, len('compteur') + 2, len('seuil') + 2) - + data = [] clefs = probleme.keys() clefs.sort() for clef in clefs: data.append([clef, ", ".join(probleme[clef][0]), probleme[clef][1], mac_prise.max_inconnues_par_jour]) - + output += tableau(data, ('chambre', 'macs', 'compteur', 'seuil'), largeurs, ('c', 'c', 'c', 'c')) output += u"\n\n\n" @@ -242,7 +242,7 @@ Content-Disposition: attachment; filename="logs_analyse" --_424234545aaff-ffca234efff-556adceff5646_-- """ - + corps = message % { 'from': 'Spoofing watcher ', 'to': 'test@lists.crans.org', 'subject': 'Résumé journalier ', @@ -260,7 +260,7 @@ Content-Disposition: attachment; filename="logs_analyse" genere_comptage('moyen') genere_comptage('journalier') - if time.localtime().tm_min % 30 == 0 and mac_prise.hargneux: + if mac_prise.hargneux: hargneux = True else: hargneux = False @@ -273,7 +273,7 @@ Content-Type: text/plain; charset="UTF-8" %(logs)s """ - + corps = message % { 'from': 'Spoofing watcher ', 'to': 'test@lists.crans.org', 'subject': 'Logs de %s' % sys.argv[0],