blob: 2cb7f7dbc2419018d82bc7260db3a465aa5a9de9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/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()
sql="select * from paquet;"
cur.execute(sql)
conn.commit()
data=cur.fetchall()
conn.close()
#sql part
#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>""")
#write the html page
req.write(baseHTML("ATS-Project","""
<center><h1>ATS-Project</h1></center>
<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>
<b>Filtre</b>
<input type="text" id="condition" onkeyup="cherche()">
<div id="tab">
<center><table>
<tr><th>Heure</th><th>Protocole</th><th>IP Source</th><th>IP Destination</th><th>Port Source</th><th>Port Destination</th></tr>
"""
+ content +
"""
</table></center>
</div>
<script src="filtre.js"></script>
<script>
function toggle_div(bouton, id) {
var div = document.getElementById(id);
div.style.display = "none";
}
</script>
"""))
|