Pcap recipes

From WTFwiki
Jump to navigation Jump to search

tcpdump

Ring-buffer capture

This example captures continuously from interface 'eth0', writing up to '-C 1'x1MB into '-w somehost.capN', keeping a maximum of '-W 10' files, overwriting the oldest when the limit is hit.

$ sudo tcpdump -nn -i eth0 -C 1 -W 10 -w somehost.cap host 10.5.10.20 &
...
$ ls -alF
total 2104K
drwxrwxr-x 3 jontow jontow    4096 Apr  6 11:33 ./                                                                                                              
drwxrwxr-x 5 jontow jontow    4096 Apr  6 10:16 ../                                                                                                             
-rw-r--r-- 1 root   root   1000065 Apr  6 11:20 somehost.cap0
-rw-r--r-- 1 root   root   1000079 Apr  6 11:33 somehost.cap1
-rw-r--r-- 1 root   root    131072 Apr  6 11:36 somehost.cap2
...