diff options
author | clyhtsuriva <clyhtsuriva@gmail.com> | 2020-05-15 09:28:16 +0200 |
---|---|---|
committer | clyhtsuriva <clyhtsuriva@gmail.com> | 2020-05-15 09:28:16 +0200 |
commit | f8b4b3b633d824be53593eb53ca3dd1aa3fcc660 (patch) | |
tree | 6f8892fb9b80fa8997557a24b9f2bf785786f9c9 | |
parent | 5426ca51f77918fd6a86b52b6cdd09aede96aeea (diff) |
Update index et analyse
-rwxr-xr-x[-rw-r--r--] | www/html/analyse.py | 38 | ||||
-rw-r--r-- | www/html/fonctions.pyc | bin | 1200 -> 1318 bytes | |||
-rwxr-xr-x | www/html/index.py | 2 |
3 files changed, 30 insertions, 10 deletions
diff --git a/www/html/analyse.py b/www/html/analyse.py index 57c0892..df72cae 100644..100755 --- a/www/html/analyse.py +++ b/www/html/analyse.py @@ -9,20 +9,40 @@ def index(req): content=str() #sql part -# conn=connexionBD() -# cur=conn.cursor() -# sql="select * from paquet;" -# cur.execute(sql) -# conn.commit() -# data=cur.fetchall() -# conn.close() -#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]) + + conn.close() +#sql part #write the html page req.write(baseHTML("ATS-Project",""" <h1>Analyse</h1> +<p>Nombre total de paquets : <b>"""+total+"""</b></p> +<p>Nombre total d'adresses IP source differentes : <b>"""+total_ip_src+"""</b></p> +<p>Nombre total d'adresses IP destination differentes : <b>"""+total_ip_dst+"""</b></p> +<p>Nombre total de ports source differents : <b>"""+total_port_src+"""</b></p> +<p>Nombre total de ports destination differents : <b>"""+total_port_dst+"""</b></p> """ -+ content )) diff --git a/www/html/fonctions.pyc b/www/html/fonctions.pyc Binary files differindex e644083..a5f563a 100644 --- a/www/html/fonctions.pyc +++ b/www/html/fonctions.pyc diff --git a/www/html/index.py b/www/html/index.py index 5563d13..b709c3a 100755 --- a/www/html/index.py +++ b/www/html/index.py @@ -43,7 +43,7 @@ def index(req): <h1>ATS-Project</h1> <div id="tip" style="display:block;"> Pour voir le nombre de paquets en destination d'une adresse IP, cliquez sur cette dernière dans le tableau.<div id="ok" onclick="toggle_div(this,'tip');"><b>OK</b></div></div> -<p>Nombre totale de paquets : <b>"""+ count +"""</b></p> +<p>Nombre total de paquets : <b>"""+ count +"""</b></p> <em><div id="ici" onclick="affiche_tas()">Pour afficher toute la table, cliquez sur ce texte.</div></em><br/> <div id="tab"> <table class="data_tab"> |