aboutsummaryrefslogtreecommitdiff
path: root/analyse
diff options
context:
space:
mode:
Diffstat (limited to 'analyse')
-rwxr-xr-xanalyse/insertpaq.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/analyse/insertpaq.py b/analyse/insertpaq.py
index 60d4796..dee7571 100755
--- a/analyse/insertpaq.py
+++ b/analyse/insertpaq.py
@@ -1,9 +1,9 @@
#!/usr/bin/python
# coding: utf-8
-
import psycopg2
+
# read a text file as a list of lines
# find the last line, change to a file you have
LireHeureTCP = open ( '/tmp/heuretcp.txt',"r" )
@@ -20,42 +20,43 @@ LirePortSRCUDP = open ( '/tmp/portsrcudp.txt',"r" )
LireIPDSTUDP = open ( '/tmp/ipdstudp.txt',"r" )
LirePortDSTUDP = open ( '/tmp/portdstudp.txt',"r" )
-DerniereLigneHeureTCP = LireHeureTCP.readlines()
+
+DerniereLigneHeureTCP = LireHeureTCP.read().splitlines()
LireHeureTCP.close()
-DerniereLigneProtocoleTCP = LireProtocoleTCP.readlines()
+DerniereLigneProtocoleTCP = LireProtocoleTCP.read().splitlines()
LireProtocoleTCP.close()
-DerniereLigneIPSRCTCP = LireIPSRCTCP.readlines()
+DerniereLigneIPSRCTCP = LireIPSRCTCP.read().splitlines()
LireIPSRCTCP.close()
-DerniereLignePortSRCTCP = LirePortSRCTCP.readlines()
+DerniereLignePortSRCTCP = LirePortSRCTCP.read().splitlines()
LirePortSRCTCP.close()
-DerniereLigneIPDSTTCP = LireIPDSTTCP.readlines()
+DerniereLigneIPDSTTCP = LireIPDSTTCP.read().splitlines()
LireIPDSTTCP.close()
-DerniereLignePortDSTTCP = LirePortDSTTCP.readlines()
+DerniereLignePortDSTTCP = LirePortDSTTCP.read().splitlines()
LirePortDSTTCP.close()
#Coucou
-DerniereLigneHeureUDP = LireHeureUDP.readlines()
+DerniereLigneHeureUDP = LireHeureUDP.read().splitlines()
LireHeureUDP.close()
-DerniereLigneProtocoleUDP = LireProtocoleUDP.readlines()
+DerniereLigneProtocoleUDP = LireProtocoleUDP.read().splitlines()
LireProtocoleUDP.close()
-DerniereLigneIPSRCUDP = LireIPSRCUDP.readlines()
+DerniereLigneIPSRCUDP = LireIPSRCUDP.read().splitlines()
LireIPSRCUDP.close()
-DerniereLignePortSRCUDP = LirePortSRCUDP.readlines()
+DerniereLignePortSRCUDP = LirePortSRCUDP.read().splitlines()
LirePortSRCUDP.close()
-DerniereLigneIPDSTUDP = LireIPDSTUDP.readlines()
+DerniereLigneIPDSTUDP = LireIPDSTUDP.read().splitlines()
LireIPDSTUDP.close()
-DerniereLignePortDSTUDP = LirePortDSTUDP.readlines()
+DerniereLignePortDSTUDP = LirePortDSTUDP.read().splitlines()
LirePortDSTUDP.close()
@@ -99,9 +100,6 @@ v = str(DerniereLigneIPDSTUDP[-1])
u = str(DerniereLignePortDSTUDP[-1])
-print a,b,c
-
-
def connexionBD():
connexion=psycopg2.connect ("host='localhost' dbname='atsdb' user='atsuser' password='123456'")
return connexion