diff options
Diffstat (limited to 'www')
-rwxr-xr-x | www/html/bilan.py (renamed from www/html/analyse.py) | 36 | ||||
-rwxr-xr-x | www/html/fonctions.py | 2 | ||||
-rwxr-xr-x | www/html/index.py | 20 | ||||
-rwxr-xr-x | www/html/style.css | 16 |
4 files changed, 56 insertions, 18 deletions
diff --git a/www/html/analyse.py b/www/html/bilan.py index c6a6c87..376f0c6 100755 --- a/www/html/analyse.py +++ b/www/html/bilan.py @@ -11,41 +11,63 @@ def index(req): #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+=("""<tr> +<td>""" + str(i[0]) + """</td> +<td>""" + str(i[1]) + """</td> + </tr>""") +#loop + #write the html page req.write(baseHTML("ATS-Project",""" -<h1>Analyse</h1> +<h1>Bilan</h1> <ul> <li>Nombre total de paquets : <b>"""+total+"""</b></li> +<li>Nombre total de paquets depuis 1h : <b>"""+total_uneheure+"""</b></li> <li>Nombre total d'adresses IP source differentes : <b>"""+total_ip_src+"""</b></li> <li>Nombre total d'adresses IP destination differentes : <b>"""+total_ip_dst+"""</b></li> <li>Nombre total de ports source differents : <b>"""+total_port_src+"""</b></li> <li>Nombre total de ports destination differents : <b>"""+total_port_dst+"""</b></li> </ul> +<br/> +<table> +<tr><th>IP destination</th><th>Recurrence</th></tr> +"""+str(content)+""" +</table> <canvas id="protocole" width="20vh" height="40vw"></canvas> <script src="/Chart.js"></script> <script src="/pie.js"></script> 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): <a href="/">Index</a> <a href="/filtrage.py">Filtrage</a> <a href="/syntaxe.py">Syntaxe</a> - <a href="/analyse.py">Analyse</a> + <a href="/bilan.py">Bilan</a> </nav> """+ body +"""</body> </html> 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+=("""<tr>""" + -"""<td>""" + str(i[1]) + """</td>""" + -"""<td>""" + str(i[2]) + """</td>""" + -"""<td>""" + str(i[3]) + """</td>""" + -"""<td>""" + lien('destination.py?ip=' + str(i[4]), str(i[4])) + """</td>""" + -"""<td>""" + str(i[5]) + """</td>""" + -"""<td>""" + str(i[6]) + """</td>""" + -"""</tr>""") + content+=("""<tr> +<td>""" + str(i[1]) + """</td> +<td>""" + str(i[2]) + """</td> +<td>""" + str(i[3]) + """</td> +<td>""" + lien('destination.py?ip=' + str(i[4]), str(i[4])) + """</td> +<td>""" + str(i[5]) + """</td> +<td>""" + str(i[6]) + """</td> + </tr>""") #write the html page req.write(baseHTML("ATS-Project",""" <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> +Pour voir le nombre de paquets en destination d'une adresse IP, cliquez sur cette dernière dans le tableau <button id="ok" onclick="toggle_div(this,'tip');">OK</button></div> <p>Nombre total de paquets : <b>"""+ count +"""</b></p> <em>Pour afficher toute la table, cliquez</em> -<button onclick="affiche_tas()">ICI</button><br/> +<button id="afficheTas" onclick="affiche_tas()">ICI</button><br/> <div id="tab"> <table class="data_tab"> <tr><th>Heure</th><th>Protocole</th><th>IP Source</th><th>IP Destination</th><th>Port Source</th><th>Port Destination</th></tr> 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; +} |