From 1b9db81514c6ad7c0cfd2952edc7d42f1e28e18b Mon Sep 17 00:00:00 2001 From: Luneji <61687883+Luneji@users.noreply.github.com> Date: Wed, 22 Apr 2020 11:29:37 +0200 Subject: Mise à jour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bon alors, au départ je voulais que le script soit capable de différencier tout seul mais c'est un peu compliqué, alors juste il va faire l'un puis l'autre. Au moins, avec cette version tu n'auras plus à créer tes inserts à la main <3 --- analyse/script.sh | 56 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 12 deletions(-) (limited to 'analyse') diff --git a/analyse/script.sh b/analyse/script.sh index 5c2aff0..9ec7123 100755 --- a/analyse/script.sh +++ b/analyse/script.sh @@ -1,4 +1,5 @@ #!/bin/bash +# coding: utf-8 #TO-DO: #prend en compte l'interface internet par defaut sur la machine @@ -10,20 +11,51 @@ #ajoute la date #insert dans la bdd les differentes infos +#sudo tcpdump -i wlp2s0 -c1 -v -w temp.pcap +#b=$(sudo tcpdump -r temp.pcap > tempcat) +#cat tempcat +#a=$(cat tempcat | cut -d" " -f13) + +#echo "$a" + +#if [ "$a" == "TCP" ] ; then +# echo 'Youpi' +#elif [ "$a" == "UDP" ] ; then +# echo 'Ah bah non ça marche pas' +#else +# echo 'KC' +#fi + while : do - sudo tcpdump -i eth1 -nn -c1 -A src $1 -w capture.pcap - sudo tcpdump -r capture.pcap > grostas - cat grostas | cut -d" " -f1 >> /tmp/heure.txt - cat grostas | cut -d" " -f2 >> /tmp/protocole.txt - cat grostas | cut -d" " -f3 >> /tmp/source.txt - cat grostas | cut -d" " -f5 >> /tmp/destination.txt - tail -n1 /tmp/heure.txt - tail -n1 /tmp/protocole.txt - tail -n1 /tmp/source.txt - tail -n1 /tmp/destination.txt -done - + sudo tcpdump -i wlp2s0 -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 + cat grostastcp | cut -d" " -f2 >> /tmp/protocoletcp.txt + cat grostastcp | cut -d" " -f3 >> /tmp/sourcetcp.txt + cat grostastcp | cut -d" " -f5 >> /tmp/destinationtcp.txt + cat grostastcp | cut -d" " -f15 >> /tmp/tailletcp.txt + tail -n1 /tmp/heuretcp.txt + tail -n1 /tmp/protocoletcp.txt + tail -n1 /tmp/sourcetcp.txt + tail -n1 /tmp/destinationtcp.txt + tail -n1 /tmp/tailletcp.txt +# Attention ici c'est UDP + sudo tcpdump -i wlp2s0 -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 + cat grostasudp | cut -d" " -f2 >> /tmp/protocoleudp.txt + cat grostasudp | cut -d" " -f3 >> /tmp/sourceudp.txt + cat grostasudp | cut -d" " -f5 >> /tmp/destinationudp.txt + cat grostasudp | cut -d" " -f8 >> /tmp/tailleudp.txt + tail -n1 /tmp/heureudp.txt + tail -n1 /tmp/protocoleudp.txt + tail -n1 /tmp/sourceudp.txt + tail -n1 /tmp/destinationudp.txt + tail -n1 /tmp/tailleudp.txt +done -- cgit v1.2.3