diff options
-rwxr-xr-x | www/howto_psql | 3 | ||||
-rwxr-xr-x | www/html/index.py | 17 | ||||
-rwxr-xr-x | www/html/init-bd.sql | 8 |
3 files changed, 18 insertions, 10 deletions
diff --git a/www/howto_psql b/www/howto_psql index 7d5adfc..67f1940 100755 --- a/www/howto_psql +++ b/www/howto_psql @@ -33,3 +33,6 @@ psql -d atsdb -U atsuser #initialize the tables \i /WHATEVER_PATH_YOUR_INIT_IS_IN/ATS-Project/website/init-bd.sql + +#quick insert +insert into paquet(heure,protocole,ip_source,ip_destination,port_source,port_destination) values ('10:30:30.60','ICMP','192.168.0.1','1.1.1.1',10000,1); diff --git a/www/html/index.py b/www/html/index.py index 010ed2d..bf4face 100755 --- a/www/html/index.py +++ b/www/html/index.py @@ -12,28 +12,31 @@ def index(req): #sql part conn=connexionBD() cur=conn.cursor() - sql="select * from trame;" + 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>""" + + content+=("""<tr>""" + """<td>""" + str(i[1]) + """</td>""" + """<td>""" + str(i[2]) + """</td>""" + """<td>""" + str(i[3]) + """</td>""" + """<td>""" + 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> -<table> -<tr><th>Heure</th><th>Protocole</th><th>Source</th><th>Destination</th></tr> +<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> -""")) #tableheads to change so it takes the output of the select - +</table></center> +""")) diff --git a/www/html/init-bd.sql b/www/html/init-bd.sql index f824545..4621dfc 100755 --- a/www/html/init-bd.sql +++ b/www/html/init-bd.sql @@ -4,9 +4,11 @@ drop table if exists paquet cascade; create table paquet( id_paquet SERIAL PRIMARY KEY, heure TIME(0) NOT NULL, - protocole VARCHAR(100) NOT NULL, - source VARCHAR(100) NOT NULL, - destination VARCHAR(100) NOT NULL + protocole VARCHAR NOT NULL, + ip_source VARCHAR NOT NULL, + ip_destination VARCHAR NOT NULL, + port_source INT NOT NULL, + port_destination INT NOT NULL ); |