TCPdump (sniffer réseau)
tcpdump (sniffer)
-w save (ex: tcpdump -w 08232010.pcap -i eth0) ; -r pour relire ce qu'on avait sauvé
Il tourne jusqu'à un CTRL+C (ou kill), ou le lancer avec -c (ex: sudo tcpdump -c 2 -i eth0). Puis il affiche des stats (dropped by kernel= par manque d'espace buffer)
Pour un protocole (fddi, tr, wlan, ip, ip6, arp, rarp, decnet, tcp ou udp): sudo tcpdump -c 2 -i eth0 arp ; pour un port (ici ssh): tcpdump -i eth0 port 22 ; pour une IP dist et son port: tcpdump -w xpackets.pcap -i eth0 dst 10.181.140.216 and port 22 ;
-F utilise un fichier pour filter l'input
-l voir data tout en capturant tcpdump -l | tee dat
ou tcpdump -l > dat & tail -f dat
Ex: tcpdump host sundown paquets in et out sundown
tcpdump host helios and \( hot or ace \) traffic entre helios et hot ou ace
tcpdump ip host ace and not helios traffic entre ace et autre hotes - sauf helios
tcpdump -i eth0 not arp and not rarp
Résultats
TCP : src > dst: flags data-seqno ack window urgent options
src dst et flags sont toujours là. Les autres données seront affichées selon l'entete du paquet si necessaire
flags: combinaisons de S (SYN), F (FIN), P (PUSH), R (RST), U (URG), W (ECN CWR), E (ECN-Echo) or `.' (ACK), or `none'
data-seqno: portion data dans le paquet
Ack: sequence number of the next data expected the other direction on this connection.
Window: number of bytes of receive buffer space available the other direction on this connection.
Urg `urgent' data in the packet.
Options : options tcp entre > (<mss 1024>).
sur le web
En anglais (ex simples) http://www.thegeekstuff.com/2010/08/tcpdump-command-examples/
Tips commande terminator: NOW=$(date +"%y%m%d%h%s" ) ; sudo tcpdump -w $NOW.pcap -i eth0
https://danielmiessler.com/study/tcpdump
http://lea-linux.org/documentations/Tcpdump
Attachment | Size |
---|---|
tcpdump.pdf | 37.3 KB |