#!/usr/bin/python3 # -*- coding: utf-8 -*- import mod_python from fonctions import baseHTML, connexionBD, lien def index(req): req.content_type="text/html" #check si ip est bien la try: port=req.form["port"] except KeyError: mod_python.util.redirect(req, "index.py") #check si port a le bon format try: float(port) except ValueError: mod_python.util.redirect(req, "index.py") content=str() #sql part conn=connexionBD() cur=conn.cursor() sql="SELECT * FROM paquet WHERE port_source=%s ORDER BY heure DESC" sql_count="SELECT COUNT(*) FROM paquet WHERE port_source=%s" cur.execute(sql, (port, )) conn.commit() data=cur.fetchall() cur.execute(sql_count, (port, )) conn.commit() count=cur.fetchone() conn.close() #sql part #takes every lines from the select for i in data : content+=("""
Nombre de paquets venant de """+ port + """ : """+ str(count[0])+ """
Heure | Protocole | IP Source | IP Destination | Port Source | Port Destination |
---|