diff options
author | clyhtsuriva <clyhtsuriva@gmail.com> | 2020-05-16 11:26:53 +0200 |
---|---|---|
committer | clyhtsuriva <clyhtsuriva@gmail.com> | 2020-05-16 11:26:53 +0200 |
commit | 59245d6293063f45a2f58e77b0aadd99932cc2cd (patch) | |
tree | 586f233ff0b27e81b42ef62c7575c8bf2eab2a6e /analyse | |
parent | 2b9d103c5c3066c03d6d3ee52d85aa9d96bb7791 (diff) | |
parent | c57d71165c816cf03ab2b08059f8cdb84207ed5c (diff) |
Merge branch 'master' of https://www.github.com/clyhtsuriva/ATS-Project
Diffstat (limited to 'analyse')
-rwxr-xr-x | analyse/insertpaq.py | 28 | ||||
-rwxr-xr-x | analyse/script.sh | 9 |
2 files changed, 21 insertions, 16 deletions
diff --git a/analyse/insertpaq.py b/analyse/insertpaq.py index dee7571..31a3cb2 100755 --- a/analyse/insertpaq.py +++ b/analyse/insertpaq.py @@ -61,43 +61,43 @@ LirePortDSTUDP.close() #print "Heure TCP:" -a = str(DerniereLigneHeureTCP[-1]) +HeureTCP = str(DerniereLigneHeureTCP[-1]) #print "Protocole TCP:" -b = str(DerniereLigneProtocoleTCP[-1]) +ProtocoleTCP = str(DerniereLigneProtocoleTCP[-1]) #print "IP Source TCP:" -c = str(DerniereLigneIPSRCTCP[-1]) +IPsrcTCP = str(DerniereLigneIPSRCTCP[-1]) #print "Port Source TCP:" -d = str(DerniereLignePortSRCTCP[-1]) +PortsrcTCP = str(DerniereLignePortSRCTCP[-1]) #print "IP Destination TCP:" -e = str(DerniereLigneIPDSTTCP[-1]) +IPdstTCP = str(DerniereLigneIPDSTTCP[-1]) #print "Port Destination TCP:" -f = str(DerniereLignePortDSTTCP[-1]) +PortdstTCP = str(DerniereLignePortDSTTCP[-1]) #Re coucou #print "Heure UDP:" -z = str(DerniereLigneHeureUDP[-1]) +HeureUDP = str(DerniereLigneHeureUDP[-1]) #print "Protocole UDP:" -y = str(DerniereLigneProtocoleUDP[-1]) +ProtocoleUDP = str(DerniereLigneProtocoleUDP[-1]) #print "IP Source UDP:" -x = str(DerniereLigneIPSRCUDP[-1]) +IPsrcUDP = str(DerniereLigneIPSRCUDP[-1]) #print "Port Source UDP:" -w = str(DerniereLignePortSRCUDP[-1]) +PortsrcUDP = str(DerniereLignePortSRCUDP[-1]) #print "IP Destination UDP:" -v = str(DerniereLigneIPDSTUDP[-1]) +IPdstUDP = str(DerniereLigneIPDSTUDP[-1]) #print "Port Destination UDP:" -u = str(DerniereLignePortDSTUDP[-1]) +PortdstUDP = str(DerniereLignePortDSTUDP[-1]) def connexionBD(): @@ -113,9 +113,9 @@ cur=conn.cursor() #""".format(a,b,c,e,d,f,z,y,x,v,w,u) cur.execute("INSERT INTO paquet (heure,protocole,ip_source,ip_destination,port_source,port_destination) VALUES (%s, %s, %s, %s, %s, %s)", - (a, b, c, e, d, f)) + (HeureTCP, 'TCP', IPsrcTCP, IPdstTCP, PortsrcTCP, PortdstTCP)) cur.execute("INSERT INTO paquet (heure,protocole,ip_source,ip_destination,port_source,port_destination) VALUES (%s, %s, %s, %s, %s, %s)", - (z, y, x, v, w, u)) + (HeureUDP, 'UDP', IPsrcUDP, IPdstUDP, PortsrcUDP, PortdstUDP)) #cur.execute(sql) diff --git a/analyse/script.sh b/analyse/script.sh index 731fc2d..82b1943 100755 --- a/analyse/script.sh +++ b/analyse/script.sh @@ -1,6 +1,7 @@ #!/bin/bash # coding: utf-8 +#TO-DO: #sudo tcpdump -i wlp2s0 -c1 -v -w temp.pcap #b=$(sudo tcpdump -r temp.pcap > tempcat) @@ -17,10 +18,14 @@ # echo 'KC' #fi +sudo ifconfig +echo "Indiquez votre interface : " +read Interface + while : do - sudo tcpdump -i wlp2s0 -c1 -nn tcp -w capturetcp.pcap + sudo tcpdump -i $Interface -c1 -nn tcp -w capturetcp.pcap sudo tcpdump -nn -r capturetcp.pcap > grostastcp echo -e "Voici un paquet TCP\n" cat grostastcp | cut -d" " -f1 >> /tmp/heuretcp.txt @@ -44,7 +49,7 @@ do # Attention ici c'est UDP - sudo tcpdump -i wlp2s0 -c1 -nn udp -w captureudp.pcap + sudo tcpdump -i $Interface -c1 -nn udp -w captureudp.pcap sudo tcpdump -nn -r captureudp.pcap > grostasudp echo -e "Voici un paquet UDP\n" cat grostasudp | cut -d" " -f1 >> /tmp/heureudp.txt |