From cb6a7852bf1015497aaaf40cc41050405f3f3f84 Mon Sep 17 00:00:00 2001 From: clyhtsuriva Date: Sat, 9 May 2020 10:35:49 +0200 Subject: beaucoup de modifs --- www/html/__pycache__/destination.cpython-37.pyc | Bin 0 -> 1537 bytes www/html/__pycache__/fonctions.cpython-37.pyc | Bin 0 -> 1127 bytes www/html/affiche-tab.py | 6 ++-- www/html/affiche-tas.py | 38 ++++++++++++++++++++++++ www/html/analyse.py | 21 ++++++------- www/html/destination.py | 16 ++++++---- www/html/filtrage.py | 9 ++---- www/html/fonctions.py | 2 +- www/html/fonctions.pyc | Bin 0 -> 1200 bytes www/html/index.py | 30 +++++++++++-------- www/html/style.css | 24 ++++++++++----- www/html/syntaxe.py | 4 +-- www/html/tas.js | 16 ++++++++++ www/html/tip.js | 4 +++ 14 files changed, 121 insertions(+), 49 deletions(-) create mode 100644 www/html/__pycache__/destination.cpython-37.pyc create mode 100644 www/html/__pycache__/fonctions.cpython-37.pyc create mode 100644 www/html/affiche-tas.py create mode 100644 www/html/fonctions.pyc create mode 100644 www/html/tas.js create mode 100644 www/html/tip.js (limited to 'www') diff --git a/www/html/__pycache__/destination.cpython-37.pyc b/www/html/__pycache__/destination.cpython-37.pyc new file mode 100644 index 0000000..00128cf Binary files /dev/null and b/www/html/__pycache__/destination.cpython-37.pyc differ diff --git a/www/html/__pycache__/fonctions.cpython-37.pyc b/www/html/__pycache__/fonctions.cpython-37.pyc new file mode 100644 index 0000000..2f6ccdf Binary files /dev/null and b/www/html/__pycache__/fonctions.cpython-37.pyc differ diff --git a/www/html/affiche-tab.py b/www/html/affiche-tab.py index 5481d84..83512dc 100644 --- a/www/html/affiche-tab.py +++ b/www/html/affiche-tab.py @@ -12,7 +12,7 @@ def index(req): conn=connexionBD() cur=conn.cursor() - sql="select * from paquet where {}".format(condition) + sql="select * from paquet where {} ORDER BY heure DESC;".format(condition) cur.execute(sql) conn.commit() data=cur.fetchall() @@ -29,9 +29,9 @@ def index(req): """""") req.write(""" -
+
""" + content + """ -
HeureProtocoleIP SourceIP DestinationPort SourcePort Destination
""") +""") diff --git a/www/html/affiche-tas.py b/www/html/affiche-tas.py new file mode 100644 index 0000000..726bed4 --- /dev/null +++ b/www/html/affiche-tas.py @@ -0,0 +1,38 @@ +#!/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() + + conn=connexionBD() + cur=conn.cursor() + + sql="SELECT * FROM paquet ORDER BY heure DESC;" + + cur.execute(sql) + conn.commit() + data=cur.fetchall() + + conn.close() + + 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]) + """""" + +"""""") + + req.write(""" + + +""" ++ content + +""" +
HeureProtocoleIP SourceIP DestinationPort SourcePort Destination
""") diff --git a/www/html/analyse.py b/www/html/analyse.py index de55e47..57c0892 100644 --- a/www/html/analyse.py +++ b/www/html/analyse.py @@ -7,21 +7,22 @@ from fonctions import baseHTML, connexionBD, lien def index(req): req.content_type="text/html" content=str() -''' + #sql part - conn=connexionBD() - cur=conn.cursor() - sql="select * from paquet;" - cur.execute(sql) - conn.commit() - data=cur.fetchall() - conn.close() +# conn=connexionBD() +# cur=conn.cursor() +# sql="select * from paquet;" +# cur.execute(sql) +# conn.commit() +# data=cur.fetchall() +# conn.close() #sql part -''' + #write the html page + req.write(baseHTML("ATS-Project",""" -

Analyse

+

Analyse

""" + content )) diff --git a/www/html/destination.py b/www/html/destination.py index 4d37c22..032d797 100755 --- a/www/html/destination.py +++ b/www/html/destination.py @@ -25,14 +25,18 @@ def index(req): #sql part conn=connexionBD() cur=conn.cursor() - sql="select * from paquet where ip_destination='{}';".format(ip) + + sql="select * from paquet where ip_destination='{}' ORDER BY heure DESC;".format(ip) sql_count="select count(*) from paquet where ip_destination='{}';".format(ip) + cur.execute(sql) conn.commit() data=cur.fetchall() + cur.execute(sql_count) conn.commit() - rec=cur.fetchone() + count=cur.fetchone() + conn.close() #sql part @@ -49,12 +53,12 @@ def index(req): #write the html page req.write(baseHTML("Destination",""" -

IP Destination : """ + ip + """

-

Nombre de paquets en destination de """+ ip + """ : """+ str(rec[0])+ """

-

+

IP Destination : """ + ip + """

+

Nombre de paquets en destination de """+ ip + """ : """+ str(count[0])+ """

+
""" + content + """ -
HeureProtocoleIP SourceIP DestinationPort SourcePort Destination
+ """)) diff --git a/www/html/filtrage.py b/www/html/filtrage.py index 8df0e27..2ec6a72 100755 --- a/www/html/filtrage.py +++ b/www/html/filtrage.py @@ -10,7 +10,7 @@ def index(req): #write the html page req.write(baseHTML("ATS-Project",""" -

Filtrage

+

Filtrage

Pour voir le nombre de paquets en destination d'une adresse IP, cliquez sur cette dernière dans le tableau.
OK
Filtre @@ -18,10 +18,5 @@ Pour voir le nombre de paquets en destination d'une adresse IP, cliquez sur cett
- + """)) diff --git a/www/html/fonctions.py b/www/html/fonctions.py index a8d4c8b..3f44a31 100755 --- a/www/html/fonctions.py +++ b/www/html/fonctions.py @@ -4,7 +4,7 @@ import psycopg2 def baseHTML(title,body): content=(""" - + """+ title +""" diff --git a/www/html/fonctions.pyc b/www/html/fonctions.pyc new file mode 100644 index 0000000..e644083 Binary files /dev/null and b/www/html/fonctions.pyc differ diff --git a/www/html/index.py b/www/html/index.py index 2cb7f7d..5563d13 100755 --- a/www/html/index.py +++ b/www/html/index.py @@ -11,10 +11,19 @@ def index(req): #sql part conn=connexionBD() cur=conn.cursor() - sql="select * from paquet;" + + sql="SELECT * FROM paquet ORDER BY heure DESC LIMIT 20;" + sql_count="SELECT COUNT(*) FROM paquet;" + cur.execute(sql) conn.commit() data=cur.fetchall() + + cur.execute(sql_count) + conn.commit() + count=cur.fetchone() + count=str(count[0]) + conn.close() #sql part @@ -31,24 +40,19 @@ def index(req): #write the html page req.write(baseHTML("ATS-Project",""" -

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
-Filtre - +

Nombre totale de paquets : """+ count +"""

+
Pour afficher toute la table, cliquez sur ce texte.

-
+
""" + content + """ -
HeureProtocoleIP SourceIP DestinationPort SourcePort Destination
+
- - + + """)) diff --git a/www/html/style.css b/www/html/style.css index a826da5..827435a 100755 --- a/www/html/style.css +++ b/www/html/style.css @@ -3,28 +3,29 @@ body { } p,i,table,form { - color:yellow; + color:#ffffff; } b { - color : #e600e6; + color : #D42471; } -h1,h2,h3,h4,h5,h6 { - color: #6666ff +h1 { + color: #6666ff; + text-align: center } a { - color: #00ff00; + color: #00ffff; text-decoration: none; } a:hover { - color: red; + color: #D42471; } table,th,td { - border: 2px solid red; + border: 2px solid #D42471; text-align: center; } @@ -37,3 +38,12 @@ table,th,td { padding:10px; background-color: black; } + +.data_tab { + margin-left:auto; + margin-right:auto; +} + +em{ + color:#FF00FF; +} diff --git a/www/html/syntaxe.py b/www/html/syntaxe.py index cdaf5f7..61ef7b3 100755 --- a/www/html/syntaxe.py +++ b/www/html/syntaxe.py @@ -10,8 +10,8 @@ def index(req): #write the html page req.write(baseHTML("ATS-Project",""" -

Syntaxe

-

La """+lien('syntaxe.py','syntaxe')+""" pour utiliser les filtres disponibles sur l'"""+lien('index.py','index')+""" et """+lien('filtrage.py','filtrage')+""" est la suivante :

+

Syntaxe

+

La """+lien('syntaxe.py','syntaxe')+""" pour utiliser les filtres disponibles sur la page """+lien('filtrage.py','filtrage')+""" est la suivante :

<colonne>='<valeur>'


diff --git a/www/html/tas.js b/www/html/tas.js new file mode 100644 index 0000000..e626768 --- /dev/null +++ b/www/html/tas.js @@ -0,0 +1,16 @@ +function affiche_tas(){ + + var url = "affiche-tas.py"; + + var req = new XMLHttpRequest(); + req.open("GET", url, true); + + req.onreadystatechange = function(){ + if(req.readyState == 4 && req.status == 200) { + var tab=document.getElementById("tab"); + tab.innerHTML = req.responseText; + } + } + + req.send(); +} diff --git a/www/html/tip.js b/www/html/tip.js new file mode 100644 index 0000000..a69683f --- /dev/null +++ b/www/html/tip.js @@ -0,0 +1,4 @@ +function toggle_div(bouton, id) { + var div = document.getElementById(id); + div.style.display = "none"; +} -- cgit v1.2.3
colonnevaleurexemple