tcpdump抓包命令:
tcpdump port 1883 -w /tmp/mosq.pcap
wireshark常用的过滤命令:
(1)等号使用 == 或者 eq,不等于使用 != 或者 ne
例如:端口为80的包
tcp.port eq 80
或者:tcp.port == 80
(2)过滤条件可以用and 或者or进行连接:
例如:过滤出来包内容中含有"set"或者"SET",并ip地址为192.168.1.241的包
tcp contains "set" or tcp contains "SET" and ip.addr == 192.168.1.241
(3)过滤出来内容中含有某个字符:
例如:tcp contains "set"
(4)指定ip地址
例如:ip.addr == 192.168.1.241
(5)指定端口号:
例如:过滤出来端口号为6380的包(即收到的包或者发送的包中含有6380都要显示出来)
tcp.port == 6380
指定源端口号:tcp.srcport eq 80
指定目的端口号:tcp.dstport == 80
指定端口范围号:tcp.port >= 2000 and tcp.port <= 5500
(6)指定IP地址:
例如:ip.addr == 192.168.4.223
这样源地址和目的地址为192.168.4.223的包都会被过滤出来;
仅指定目的IP地址:ip.dst == 192.168.4.223
仅指定源IP地址:ip.src == 192.168.4.201