2014-03-01 04:25:34 +00:00
|
|
|
# tcpdump
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Dump traffic on a network.
|
2019-05-14 17:26:32 +01:00
|
|
|
> Homepage: <https://www.tcpdump.org>.
|
2014-03-01 04:25:34 +00:00
|
|
|
|
2017-12-03 16:22:45 +00:00
|
|
|
- List available network interfaces:
|
|
|
|
|
|
|
|
`tcpdump -D`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Capture the traffic of a specific interface:
|
2014-03-01 04:25:34 +00:00
|
|
|
|
|
|
|
`tcpdump -i {{eth0}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Capture all TCP traffic showing contents (ASCII) in console:
|
2014-03-01 04:25:34 +00:00
|
|
|
|
|
|
|
`tcpdump -A tcp`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Capture the traffic from or to a host:
|
2014-03-01 04:25:34 +00:00
|
|
|
|
2014-03-02 07:20:23 +00:00
|
|
|
`tcpdump host {{www.example.com}}`
|
2014-03-01 04:25:34 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Capture the traffic from a specific interface, source, destination and destination port:
|
2014-03-01 04:25:34 +00:00
|
|
|
|
2017-12-04 21:43:33 +00:00
|
|
|
`tcpdump -i {{eth0}} src {{192.168.1.1}} and dst {{192.168.1.2}} and dst port {{80}}`
|
2014-03-01 04:25:34 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Capture the traffic of a network:
|
2014-03-01 04:25:34 +00:00
|
|
|
|
|
|
|
`tcpdump net {{192.168.1.0/24}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Capture all traffic except traffic over port 22 and save to a dump file:
|
2014-03-27 18:46:32 +00:00
|
|
|
|
2017-12-04 21:43:33 +00:00
|
|
|
`tcpdump -w {{dumpfile.pcap}} not port {{22}}`
|
2017-12-03 16:22:45 +00:00
|
|
|
|
2017-12-04 21:43:33 +00:00
|
|
|
- Read from a given dump file:
|
2017-12-03 16:22:45 +00:00
|
|
|
|
2017-12-04 21:43:33 +00:00
|
|
|
`tcpdump -r {{dumpfile.pcap}}`
|