From 2b9d103c5c3066c03d6d3ee52d85aa9d96bb7791 Mon Sep 17 00:00:00 2001 From: clyhtsuriva Date: Sat, 16 May 2020 11:20:30 +0200 Subject: Update www --- www/html/analyse.py | 53 ------------------------------------ www/html/bilan.py | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ www/html/fonctions.py | 2 +- www/html/index.py | 20 +++++++------- www/html/style.css | 16 +++++++++++ 5 files changed, 102 insertions(+), 64 deletions(-) delete mode 100755 www/html/analyse.py create mode 100755 www/html/bilan.py diff --git a/www/html/analyse.py b/www/html/analyse.py deleted file mode 100755 index c6a6c87..0000000 --- a/www/html/analyse.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/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]) - - conn.close() -#sql part - -#write the html page - - req.write(baseHTML("ATS-Project",""" -

Analyse

- - - - -""" -)) diff --git a/www/html/bilan.py b/www/html/bilan.py new file mode 100755 index 0000000..376f0c6 --- /dev/null +++ b/www/html/bilan.py @@ -0,0 +1,75 @@ +#!/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
+ + + +""" +)) diff --git a/www/html/fonctions.py b/www/html/fonctions.py index c9c3df2..8fce43b 100755 --- a/www/html/fonctions.py +++ b/www/html/fonctions.py @@ -15,7 +15,7 @@ def baseHTML(title,body): Index Filtrage Syntaxe - Analyse + Bilan """+ body +""" diff --git a/www/html/index.py b/www/html/index.py index 7f419b0..446a90e 100755 --- a/www/html/index.py +++ b/www/html/index.py @@ -29,23 +29,23 @@ def index(req): #takes every lines from the select for i in data : - content+=("""""" + -"""""" + str(i[1]) + """""" + -"""""" + str(i[2]) + """""" + -"""""" + str(i[3]) + """""" + -"""""" + lien('destination.py?ip=' + str(i[4]), str(i[4])) + """""" + -"""""" + str(i[5]) + """""" + -"""""" + str(i[6]) + """""" + -"""""") + content+=(""" +""" + str(i[1]) + """ +""" + str(i[2]) + """ +""" + str(i[3]) + """ +""" + lien('destination.py?ip=' + str(i[4]), str(i[4])) + """ +""" + str(i[5]) + """ +""" + str(i[6]) + """ + """) #write the html page req.write(baseHTML("ATS-Project","""

ATS-Project

-Pour voir le nombre de paquets en destination d'une adresse IP, cliquez sur cette dernière dans le tableau.
OK
+Pour voir le nombre de paquets en destination d'une adresse IP, cliquez sur cette dernière dans le tableau

Nombre total de paquets : """+ count +"""

Pour afficher toute la table, cliquez -
+
diff --git a/www/html/style.css b/www/html/style.css index c08fa96..abecc86 100755 --- a/www/html/style.css +++ b/www/html/style.css @@ -51,3 +51,19 @@ em{ li{ color:#FFFFFF; } + + +#afficheTas{ + background-color: #262626; + border: solid thin #FF00FF; + color: #FF00FF; + cursor: pointer; +} + + +#ok{ + background-color: #262626; + border: solid #6666FF; + color: #D42471; + cursor: pointer; +} -- cgit v1.2.3
HeureProtocoleIP SourceIP DestinationPort SourcePort Destination