I want to collect tcpdump examples, as many as possible!
E.g.: how to filter FTP passwords on eth0; OR how to filter HTTP 404 errors, etc.
|
| ||||
|
feedback
|
|
It doesn't do any filtering, but this example creates a handy continuous packet sniffer:
Put it in /etc/rc.local to run on boot. It captures all packets on interface It writes ~128MB files and will automatically rotate up to 100 of them. When it captures 128MB of data, it will close the file, open a new one, and fork the specified command with the old filename as an argument - in this case a little Perl script that compresses the previous capture file for quicker transfer off the IDS server. I use this when I have to monitor a connection for a long time (like a day or two) and need to go back and find an event that occurred at a specific time. The small files are much easier to handle in Wireshark than one huge pcap file. | ||||
|
feedback
|
|
Capture only HTTP POST data:
A bit unwieldly but certainly useful. Then we want to compare the first 4 bytes of TCP data to 'POST'. The TCP header is minimum 20 (decimal) bytes, but since the TCP options are variable length, from 0 to 40 bytes (padded to a 32-bit boundary and starting at ), we have to test every 4 bytes from 20 to 60 (decimal). Finally,
| ||||
|
feedback
|
|
Capture everything to a file (so you can analyze it later with Wireshark or something):
| ||||
|
feedback
|
|
If you want to monitor clients DNS requests on an OpenWRT router:
| ||||
|
feedback
|
|
Filter-making cheat sheet: http://staff.washington.edu/dittrich/talks/core02/tools/tcpdump-filters.txt | ||||
|
feedback
|
