aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclyhtsuriva <clyhtsuriva@gmail.com>2020-05-15 08:21:43 +0200
committerclyhtsuriva <clyhtsuriva@gmail.com>2020-05-15 08:21:43 +0200
commit5426ca51f77918fd6a86b52b6cdd09aede96aeea (patch)
treec8b674fbf59f5a814ca14d1f02adfefa6feb655e
parent4c63e992258b31c90e910614bdfd62908f0f761c (diff)
correction bug insert
-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