#!/usr/bin/python3 # -*- coding: utf-8 -*- import mod_python from fonctions import baseHTML, connexionBD, lien def index(req): req.content_type="text/html" content=str() #sql part conn=connexionBD() cur=conn.cursor() ### cur.execute("SELECT COUNT(*) FROM paquet") conn.commit() total=str(cur.fetchone()[0]) # cur.execute("SELECT COUNT(DISTINCT ip_source) FROM paquet") conn.commit() total_ip_src=str(cur.fetchone()[0]) # cur.execute("SELECT COUNT(DISTINCT ip_destination) FROM paquet") conn.commit() total_ip_dst=str(cur.fetchone()[0]) # cur.execute("SELECT COUNT(DISTINCT port_source) FROM paquet") conn.commit() total_port_src=str(cur.fetchone()[0]) # cur.execute("SELECT COUNT(DISTINCT port_destination) FROM paquet") conn.commit() total_port_dst=str(cur.fetchone()[0]) # cur.execute("SELECT COUNT(*) FROM paquet WHERE (heure>=( SELECT LOCALTIME - interval '1 hour' ) AND heure<= (SELECT LOCALTIME));") conn.commit() total_uneheure=str(cur.fetchone()[0]) # cur.execute("SELECT ip_destination, COUNT(ip_destination) FROM paquet GROUP BY ip_destination") conn.commit() each_ip_dest=cur.fetchall() ### conn.close() #sql part #loop for i in each_ip_dest : content+=(""" """ + str(i[0]) + """ """ + str(i[1]) + """ """) #loop #write the html page req.write(baseHTML("ATS-Project","""

Bilan


"""+str(content)+"""
IP destinationRecurrence
""" ))