![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
TCPDUMP
Frequently-Asked Questions
Pour plus d'information au sujet de cette faq, contactez Jean-Louis BICQUELET
Cette FAQ a été réalisée sous AIX. L'interface à utiliser sous AIX est enx (en0, en1, en2 ...). Il est facile de transposer sous linux Redhat, debian ou ubuntu en utilisant les interfaces ethx (eth0, eth1, eth2 ...).
FAQ Revised: Saturday 18 May 2013 09:27:32
# which tcpdump /usr/sbin/tcpdump # lslpp -w /usr/sbin/tcpdump File Fileset Type ---------------------------------------------------------------------------- /usr/sbin/tcpdump bos.net.tcp.server File
#apt-get install tcpdumpLes dépendances de TCPdump sont:
#apt-cache depends tcpdump tcpdump Depends: libc6 Depends: libpcap0.8 Depends: libssl0.9.8Pour voir la version installée de TCPdump:
#apt-cache policy tcpdump tcpdump: Installed: 3.9.4-2ubuntu0.1 Candidate: 3.9.4-2ubuntu0.1 Version table: *** 3.9.4-2ubuntu0.1 0 500 http://security.ubuntu.com dapper-security/main Packages 100 /var/lib/dpkg/status 3.9.4-2 0 500 http://ch.archive.ubuntu.com dapper/main Packages
Il y a eu à un moment besoin du rpm de l'AIX TOOLBOX libpcap.
tcpdump -D 1.en10 2.en11 3.en12 4.lo0
# tcpdump tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en10, link-type 1, capture size 96 bytes 10:50:15.614350 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 10:50:15.614351 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 10:50:15.930023 802.1d unknown version 10:50:16.252558 802.1d unknown version 10:50:16.549961 IP SERVEUR001.mondomain.frp > 172.228.0.20 10:50:16.550015 IP SERVEUR001.mondomain.frp > 172.228.0.20 10:50:16.553005 IP SERVEUR002.mondomain.frp > 172.228.0.20 10:50:16.553010 IP SERVEUR002.mondomain.frp > 172.228.0.20 10:50:16.614334 ARP, Request who-has SERVEUR002.mondomain.fr tell 192.168.134.14, length 46 10:50:16.614335 ARP, Request who-has SERVEUR002.mondomain.fr tell 192.168.134.14, length 46 10:50:16.614344 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 10:50:16.614345 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 10:50:17.614386 ARP, Request who-has SERVEUR002.mondomain.fr tell 192.168.134.14, length 46 10:50:17.614388 ARP, Request who-has SERVEUR002.mondomain.fr tell 192.168.134.14, length 46 10:50:17.614400 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 10:50:17.614401 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 10:50:17.930170 802.1d unknown version 17 packets received by filter 0 packets dropped by kernelTCPdump génére une ligne par paquet IP. Avec les options par défaut, une ligne ressemble à:
10:50:16.549961 IP SERVEUR001.mondomain.frp > 172.228.0.20
10:50:16.549961 IP SERVEUR001.mondomain.frp > 172.228.0.20
10:50:16.549961 IP SERVEUR001.mondomain.frp > 172.228.0.20
10:50:16.549961 IP SERVEUR001.mondomain.frp >172.228.0.20
Pour trouver le numero de port correspondant au nom du port, on va regarder le fichier /etc/services.
tcpdump -A tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en10, link-type 1, capture size 96 bytes 09:38:28.128815 802.1d unknown version BB.....<...#........+..&Q.%A........... 09:38:28.585654 ARP, Request who-has SERVEUR001-02-HSRP-VLAN1034.mondomain.fr tell 192.168.134.14, length 46 ..........%{+\................................ 09:38:28.585665 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 ..........%{+\......%{+\...................... 09:38:28.585716 ARP, Request who-has SERVEUR001-02-HSRP-VLAN1034.mondomain.fr tell 192.168.134.14, length 46 ..........%{+\................................ 09:38:28.585719 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:11:11 (oui Unknown), length 46 ..........%{+\......%{+\...................... 5 packets received by filter 0 packets dropped by kernel
C'est de cette manière que l'on peut facilement intercepté les mots de passe FTP car il sont envoyés en clair vers le serveur. On peut spécifier une interface donnée (en0 sous AIX, eth0 sous linux):
tcpdump -A -i en0
tcpdump -A -i eth0
tcpdump -A -c2 -XX -i en0 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en0, link-type 1, capture size 96 bytes 11:54:53.589057 IP frlohfedb2tpa01-mgt.ssh > wrumlms02.38394: P 171042357:171042409(52) ack 496084802 win 65535 0x0000: 0000 0c9f f002 0af4 7f54 7403 0800 4510 .........Tt...E. 0x0010: 005c 2cdb 4000 3c06 f301 80ab 1345 80ab .\,.@.<......E.. 0x0020: 0a14 0016 95fa 0a31 e635 1d91 a742 5018 .......1.5...BP. 0x0030: ffff 0000 0000 b73a c136 471b eaf6 9c37 .......:.6G....7 0x0040: 6887 dd7d 8f9b e033 1c30 c2db f658 2457 h..}...3.0...X$W 0x0050: e408 7235 54d0 b3e6 67df 4286 f965 6c1d ..r5T...g.B..el. 11:54:53.589082 IP frlohfedb2tpa01-mgt.ssh > wrumlms02.38394: P 52:216(164) ack 1 win 65535 0x0000: 0000 0c9f f002 0af4 7f54 7403 0800 4510 .........Tt...E. 0x0010: 00cc 2cdc 4000 3c06 f290 80ab 1345 80ab ..,.@.<......E.. 0x0020: 0a14 0016 95fa 0a31 e669 1d91 a742 5018 .......1.i...BP. 0x0030: ffff 0000 0000 1be8 70f8 292d c709 32b2 ........p.)-..2. 0x0040: 5a5e d119 b440 5555 cd15 acc5 6698 de21 Z^...@UU....f..! 0x0050: bdb8 bcdb 2cd5 4c65 19ca aaa8 d2df a21a ....,.Le........ 16 packets received by filter 0 packets dropped by kernel
tcpdump udp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en10, link-type 1, capture size 96 bytes 09:48:22.576884 IP SERVEUR001.mondomain.frs > 192.168.6.255.netbios-ns: UDP, length 50 09:48:22.576889 IP SERVEUR001.mondomain.frs > 192.168.6.255.netbios-ns: UDP, length 50 09:48:22.576894 IP SERVEUR001.mondomain.frs > 192.168.6.255.netbios-ns: UDP, length 50 09:48:22.576895 IP SERVEUR001.mondomain.frs > 192.168.6.255.netbios-ns: UDP, length 50 09:48:22.577068 IP SERVEUR003.mondomain.fr > 192.168.6.255.netbios-ns: UDP, length 50 09:48:22.577071 IP SERVEUR003.mondomain.fr > 192.168.6.255.netbios-ns: UDP, length 50 09:48:22.577082 IP SERVEUR003.mondomain.fr > 192.168.6.255.netbios-ns: UDP, length 50 09:48:22.577084 IP SERVEUR003.mondomain.fr > 192.168.6.255.netbios-ns: UDP, length 50 09:48:23.084253 IP SERVEUR004.mondomain.fr > 176.228.10.1 09:48:23.084254 IP SERVEUR004.mondomain.fr > 176.228.10.1 09:48:23.086668 IP GSERVEUR005.mondomain.fr > 176.228.10.1 09:48:23.086680 IP GSERVEUR005.mondomain.fr > 176.228.10.1 22 packets received by filter 0 packets dropped by kernel
port 22On lance ainsi tcpdump:
#tcpdump -F file_name
#tcpdump -c 10
tcpdump host www.google.fr
tcpdump dst www.google.fr
# tcpdump -i en1 host 192.100.28.1 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en12, link-type 1, capture size 96 bytes 08:45:00.099209 IP SERVEUR001.mondomain.fr.63037 > SERVEUR002.mondomain.fr.ssh: S 4267097698:4267097698(0) win 65535wscale 12,nop,nop,timestamp 1383246626 0,nop,nop,sackOK> 08:45:00.099261 IP SERVEUR002.mondomain.fr.ssh > SERVEUR001.mondomain.fr.63037: S 779894081:779894081(0) ack 4267097699 win 65535 wscale 12,nop,nop,timestamp 1372291888 1383246626,nop,nop,sackOK> 08:45:00.100196 IP RSERVEUR001.mondomain.fr.63037 > SERVEUR002.mondomain.fr.ssh: . ack 1 win 40959 08:45:00.100219 IP SERVEUR002.mondomain.fr.ssh > SERVEUR001.mondomain.fr.63037: . ack 1 win 40959
On remarquera dans l'exemple, le facteur d'echelle correspondant à des grandes fenetres TCPIP (rfc1323).
On peut ajouter l'option -n pour éviter la résolution de nom.
#tcpdump -nexemple avec 4 paquets sur l'inteface en1 :
tcpdump -n -c 4 -i en1 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en1, link-type 1, capture size 96 bytes 11:57:49.692472 IP 192.16819.69.22 > 192.16810.20.38394: P 171408605:171408657(52) ack 496097138 win 65535 11:57:49.692508 IP 192.16819.69.22 > 192.16810.20.38394: P 52:216(164) ack 1 win 65535 11:57:49.692696 IP 192.16819.69.22 > 192.16810.20.38394: P 216:364(148) ack 1 win 65535 11:57:49.692718 IP 192.16819.69.22 > 192.16810.20.38394: P 364:496(132) ack 1 win 65535 4 packets received by filter 0 packets dropped by kernelOn peut noter que les mis en oeuvre son 22 (ssh) et 38394.
tcpdump -n -tttt -i en10 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en10, link-type 1, capture size 96 bytes 2013-05-16 12:09:51.645814 ARP, Reply 192.168.134.14 is-at 00:11:25:77:22:55, length 46 2013-05-16 12:09:51.645815 ARP, Reply 192.168.134.14 is-at 00:11:25:77:22:55, length 46 2013-05-16 12:09:52.111149 802.1d unknown version 2013-05-16 12:09:52.395830 802.1d unknown version 2013-05-16 12:09:52.645774 ARP, Request who-has 192.168.134.1 tell 192.168.134.14, length 46 2013-05-16 12:09:52.645781 ARP, Request who-has 192.168.134.1 tell 192.168.134.14, length 46
tcpdump -i en12 hostSERVEUR001 and port ssh
tcpdump -w capture.log tcpdump: listening on en10, link-type 1, capture size 96 bytes 14 packets received by filter 0 packets dropped by kernel
Une autre façon de faire est:
tcpdump -i en0 host SERVEUR001.mondomain.fr > traces.log
tcpdump -r capture.log reading from file capture.log, link-type 1 09:42:21.587125 ARP, Request who-has SERVEUR001_VLAN1034.mondomain.fr tell 192.168.134.14, length 46 09:42:21.587126 ARP, Request who-has SERVEUR001_VLAN1034.mondomain.fr tell 192.168.134.14, length 46 09:42:21.587137 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 09:42:21.587138 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 09:42:21.766819 802.1d unknown version 09:42:21.866766 IP SERVEUR002-VLAN1022.mondomain.fr > 176.228.10.1 09:42:21.866812 IP SERVEUR002-VLAN1022.mondomain.fr > 176.228.10.1 09:42:21.869142 IP SERVEUR003-VLAN1023.mondomain.fr > 176.228.10.1 09:42:21.869170 IP SERVEUR003-VLAN1023.mondomain.fr > 176.228.10.1 09:42:22.138371 802.1d unknown version 09:42:22.587099 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 09:42:22.587101 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 09:42:23.587075 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46 09:42:23.587157 ARP, Reply 192.168.134.14 is-at 00:11:25:7b:22:22 (oui Unknown), length 46
Copyright (c) 2013 Jean-Louis BICQUELET
This list of questions and answers was generated by makefaq.