1、tcpdump——网络数据包捕获和分析的工具

时间:2025-02-22 13:31:11

(1)抓取指定IP地址数据包: tcpdump -i eth0 (src/dst) host 192.168.1.100

(2)抓取主机与特定IP(192.168.1.200 或192.168.1.201)通信包

       tcpdump -i eth0 host 192.168.1.100 and \(192.168.1.200 or 192.168.1.201\)

 (3)抓取主机与特定IP(192.168.1.200 或192.168.1.201)通信包

        tcpdump ip host 192.168.1.100 and !192.168.1.200

 (4)抓取特定端口数据包:tcpdump -i eth0 (src/dst) port 22

 (5)抓取特定网段数的数据包:tcpdump -i eth0 (src/dst) net 192.168

 (6)抓取特定协议数据包: tcpdump -i eth0 arp/ip/tcp/udp/icmp

 (7)指定网卡:tcpdump -i eth0

 (7)条件组合过滤抓包

tcpdump  '((tcp) and (port 80) and ((dst host 192.168.1.254) or (dst host 192.168.1.1)))'

tcpdump -i eth0 '((tcp) and (port 80) and ((dst host 192.168.1.254) or (dst host 192.168.1.1)))'

tcpdump  '((icmp) and ((ether dst host 00:0A:0B:03:0C:05)))'

tcpdump  '((tcp) and ((dst net 192.168) and (not dst host 192.168.1.254))'