[mac_prises] Enough tested.
This commit is contained in:
parent
ddc6fb8a98
commit
ecc25c09b1
1 changed files with 8 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# Sclaimer
|
# Sclaimer
|
||||||
# PEB : 01/02/2013 -> now()
|
# PEB : 01/02/2013 -> now()
|
||||||
#
|
#
|
||||||
# Blablabla. (cf mac_prise.py)
|
# Blablabla. (cf mac_prise.py)
|
||||||
|
|
||||||
import psycopg2
|
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.
|
Grosse fonction de hack pour ne pas écrire six fois le même formatage de sortie bidon.
|
||||||
Prend en argument :
|
Prend en argument :
|
||||||
|
|
||||||
* duree, qui peut valoir 'instant', 'heuristique', ou 'journalier', permet d'importer
|
* duree, qui peut valoir 'instant', 'heuristique', ou 'journalier', permet d'importer
|
||||||
les variables de config qui vont bien
|
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))
|
Logs.append(u"Entrée rejetée du tableau %s, car rapport inférieur au seuil : (%s).\n\n" % (duree, rapport))
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if len(pb_comptage_suspect) > 0:
|
if len(pb_comptage_suspect) > 0:
|
||||||
for clef, valeur in pb_comptage_suspect.items():
|
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);"
|
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
|
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)
|
largeurs = (len('chambre') + 2, longueur_max, len('compteur') + 2, len('seuil') + 2)
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
clefs = probleme.keys()
|
clefs = probleme.keys()
|
||||||
clefs.sort()
|
clefs.sort()
|
||||||
for clef in clefs:
|
for clef in clefs:
|
||||||
data.append([clef, ", ".join(probleme[clef][0]), probleme[clef][1], mac_prise.max_inconnues_par_jour])
|
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 += tableau(data, ('chambre', 'macs', 'compteur', 'seuil'), largeurs, ('c', 'c', 'c', 'c'))
|
||||||
output += u"\n\n\n"
|
output += u"\n\n\n"
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ Content-Disposition: attachment; filename="logs_analyse"
|
||||||
|
|
||||||
--_424234545aaff-ffca234efff-556adceff5646_--
|
--_424234545aaff-ffca234efff-556adceff5646_--
|
||||||
"""
|
"""
|
||||||
|
|
||||||
corps = message % { 'from': 'Spoofing watcher <spoof-watcher@crans.org>',
|
corps = message % { 'from': 'Spoofing watcher <spoof-watcher@crans.org>',
|
||||||
'to': 'test@lists.crans.org',
|
'to': 'test@lists.crans.org',
|
||||||
'subject': 'Résumé journalier ',
|
'subject': 'Résumé journalier ',
|
||||||
|
@ -260,7 +260,7 @@ Content-Disposition: attachment; filename="logs_analyse"
|
||||||
genere_comptage('moyen')
|
genere_comptage('moyen')
|
||||||
genere_comptage('journalier')
|
genere_comptage('journalier')
|
||||||
|
|
||||||
if time.localtime().tm_min % 30 == 0 and mac_prise.hargneux:
|
if mac_prise.hargneux:
|
||||||
hargneux = True
|
hargneux = True
|
||||||
else:
|
else:
|
||||||
hargneux = False
|
hargneux = False
|
||||||
|
@ -273,7 +273,7 @@ Content-Type: text/plain; charset="UTF-8"
|
||||||
|
|
||||||
%(logs)s
|
%(logs)s
|
||||||
"""
|
"""
|
||||||
|
|
||||||
corps = message % { 'from': 'Spoofing watcher <spoof-watcher@crans.org>',
|
corps = message % { 'from': 'Spoofing watcher <spoof-watcher@crans.org>',
|
||||||
'to': 'test@lists.crans.org',
|
'to': 'test@lists.crans.org',
|
||||||
'subject': 'Logs de %s' % sys.argv[0],
|
'subject': 'Logs de %s' % sys.argv[0],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue