aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuneji <61687883+Luneji@users.noreply.github.com>2020-05-12 10:46:38 +0200
committerGitHub <noreply@github.com>2020-05-12 10:46:38 +0200
commitf3d008e7cf0b52d60f00a4f349d9a5fb7a32b9be (patch)
treebf72ba4d62cd3a8bf52fde218deb59ea64eea714
parent2c3bff2c161edbc40ba37d4570cd4e673e167a4f (diff)
Create tapdanlfon.py
-rw-r--r--analyse/tapdanlfon.py100
1 files changed, 100 insertions, 0 deletions
diff --git a/analyse/tapdanlfon.py b/analyse/tapdanlfon.py
new file mode 100644
index 0000000..5263af4
--- /dev/null
+++ b/analyse/tapdanlfon.py
@@ -0,0 +1,100 @@
+#!/usr/bin/python
+# coding: utf-8
+
+# 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" )
+LireProtocoleTCP = open ( '/tmp/protocoletcp.txt',"r" )
+LireIPSRCTCP = open ( '/tmp/ipsrctcp.txt',"r" )
+LirePortSRCTCP = open ( '/tmp/portsrctcp.txt',"r" )
+LireIPDSTTCP = open ( '/tmp/ipdsttcp.txt',"r" )
+LirePortDSTTCP = open ( '/tmp/portdsttcp.txt',"r" )
+
+LireHeureUDP = open ( '/tmp/heureudp.txt',"r" )
+LireProtocoleUDP = open ( '/tmp/protocoleudp.txt',"r" )
+LireIPSRCUDP = open ( '/tmp/ipsrcudp.txt',"r" )
+LirePortSRCUDP = open ( '/tmp/portsrcudp.txt',"r" )
+LireIPDSTUDP = open ( '/tmp/ipdstudp.txt',"r" )
+LirePortDSTUDP = open ( '/tmp/portdstudp.txt',"r" )
+
+DerniereLigneHeureTCP = LireHeureTCP.readlines()
+LireHeureTCP.close()
+
+DerniereLigneProtocoleTCP = LireProtocoleTCP.readlines()
+LireProtocoleTCP.close()
+
+DerniereLigneIPSRCTCP = LireIPSRCTCP.readlines()
+LireIPSRCTCP.close()
+
+DerniereLignePortSRCTCP = LirePortSRCTCP.readlines()
+LirePortSRCTCP.close()
+
+DerniereLigneIPDSTTCP = LireIPDSTTCP.readlines()
+LireIPDSTTCP.close()
+
+DerniereLignePortDSTTCP = LirePortDSTTCP.readlines()
+LirePortDSTTCP.close()
+
+#Coucou
+
+DerniereLigneHeureUDP = LireHeureUDP.readlines()
+LireHeureUDP.close()
+
+DerniereLigneProtocoleUDP = LireProtocoleUDP.readlines()
+LireProtocoleUDP.close()
+
+DerniereLigneIPSRCUDP = LireIPSRCUDP.readlines()
+LireIPSRCUDP.close()
+
+DerniereLignePortSRCUDP = LirePortSRCUDP.readlines()
+LirePortSRCUDP.close()
+
+DerniereLigneIPDSTUDP = LireIPDSTUDP.readlines()
+LireIPDSTUDP.close()
+
+DerniereLignePortDSTUDP = LirePortDSTUDP.readlines()
+LirePortDSTUDP.close()
+
+
+#print "Heure TCP:"
+a = DerniereLigneHeureTCP[-1]
+
+#print "Protocole TCP:"
+b = DerniereLigneProtocoleTCP[-1]
+
+#print "IP Source TCP:"
+c = DerniereLigneIPSRCTCP[-1]
+
+#print "Port Source TCP:"
+d = DerniereLignePortSRCTCP[-1]
+
+#print "IP Destination TCP:"
+e = DerniereLigneIPDSTTCP[-1]
+
+#print "Port Destination TCP:"
+f = DerniereLignePortDSTTCP[-1]
+
+
+insert into paquet(heure,protocole,ip_source,ip_destination,port_source,port_destination) values (a,b,c,e,d,f);
+
+#Re coucou
+
+#print "Heure UDP:"
+z = DerniereLigneHeureUDP[-1]
+
+#print "Protocole UDP:"
+y = DerniereLigneProtocoleUDP[-1]
+
+#print "IP Source UDP:"
+x = DerniereLigneIPSRCUDP[-1]
+
+#print "Port Source UDP:"
+w = DerniereLignePortSRCUDP[-1]
+
+#print "IP Destination UDP:"
+v = DerniereLigneIPDSTUDP[-1]
+
+#print "Port Destination UDP:"
+u = DerniereLignePortDSTUDP[-1]
+
+insert into paquet(heure,protocole,ip_source,ip_destination,port_source,port_destination) values (z,y,x,v,w,u);