diff --git a/surveillance/statistiques.py b/surveillance/statistiques.py index 733d9bf3..d03a59af 100755 --- a/surveillance/statistiques.py +++ b/surveillance/statistiques.py @@ -4,8 +4,8 @@ """ Script d'envoi des statistiques des déconnections et du traffic de la journée à disconnect@ -Copyright (C) Xavier Pessoles -Licence : ???? +Copyright (C) Xavier Pessoles - Étienne Chové +Licence : GPLv2 """ ########################### @@ -23,20 +23,6 @@ import socket from analyse import stats from affich_tools import tableau_ng -###################### -# Fonctions à la con # -###################### - -def humanise (nombre): - """ Transforme un nombre en k,M,G """ - if nombre > 0.8 * 1024**3 : - return str(round(nombre/1024**3,1))+'G' - if nombre > 0.8 * 1024**2 : - return str(round(nombre/1024**2,1))+'M' - if nombre > 0.8 * 1024 : - return str(round(nombre/1024,1))+'k' - return str(round(nombre,1)) - ############################### # Ouverture des connections : # ############################### @@ -49,6 +35,8 @@ mail = smtplib.SMTP('localhost') ########################### # Statistiques d'upload : # ########################### +# Y a-t-il eu des récidivistes + # Adhérents avertis : ##################### @@ -142,6 +130,7 @@ liste_virus2 = tableau_ng( data = liste_virus2, largeur = [30, 12], alignement = ['c','d'] ).encode('iso-8859-15') + # Machines ayant fait de attaques flood dans la journée : ######################################################### requete = "SELECT * FROM (SELECT ip_src,count(ip_src) as compteur FROM flood WHERE date > timestamp 'now' - interval '1 day' group by ip_src order by compteur desc) AS tous WHERE tous.compteur>'%s' limit 30" % config.virus.flood @@ -154,8 +143,6 @@ liste_virus3 = tableau_ng( data = liste_virus3, titre = ['machine','nombre'], largeur = [30, 12], alignement = ['c','d'] ).encode('iso-8859-15') - - # Machines utilisant des protocoles P2P :