Wireshark捕获经过指定ip的数据包

来源:互联网 发布:mysql 有符号整型 编辑:程序博客网 时间:2024/05/11 14:04

Wireshark捕获经过指定ip的数据包

捕捉过滤抓包前在capture option中设置,仅捕获符合条件的包,可以避免产生较大的捕获文件和内存占用,但不能完整的复现测试时的网络环境。

host 192.168.0.1 //抓取192.168.0.1 收到和发出的所有数据包

src host 192.168.0.1 //源地址,192.168.0.1发出的所有数据包

dst host 192.168.0.1 //目标地址,192.168.0.1收到的所有数据包

src host hostname //根据主机名过滤

ether host 80:05:09:03:E4:35 //根据MAC地址过滤

net 192.168.0 //网络过滤,过滤整个网段

src net 192.168

dst net 192

使用“非/且/或”建立组合过滤条件可以获得更精确的捕获

非: ! or “not” (去掉双引号)

且: && or “and”

或: || or “or”

wirershark过滤指定ip收发数据包示例:

抓取所有目的地址是192.168.0.2 或192.168.0.3 端口是80 的TCP 数据

(tcp port 80) and ((dst host 192.168.0.2) or (dst host 192.168.0.3)) //捕获过滤

tcp.port==80&&(ip.dst==192.168.0.2||ip.dst==192.168.0.3) //显示过滤

抓取所有目标MAC 地址是80:05:09:03:E4:35 的ICMP 数据

(icmp) and ((ether dst host 80:05:09:03:E4:35))

icmp && eth.dst==80:05:09:03:E4:35

抓取所有目的网络是192.168,但目的主机不是192.168.0.2 的TCP 数据

(tcp) and ((dst net 192.168) and (not dst host 192.168.0.2))

tcp&&ip.src==192.168.0.0/16&&!(ip.src==192.168.0.2)

捕获主机192.168.0.1 和主机192.168.0.2 或192.168.0.3的通信

host 192.168.0.1 and (192.168.0.2 or 192.168.0.3 )

ip.addr==192.168.0.1&&(ip.addr==192.168.0.2||ip.addr==192.168.0.3)

获取主机192.168.0.1除了和主机192.168.0.2之外所有主机通信的数据包

host 192.168.0.1 and ! 192.168.0.2

ip.addr==192.168.0.1&&!ip.addr==192.168.0.2

获取主机192.168.0.1接收或发出的telnet包,telnet使用tcp 23端口

tcp port 23 and host 192.168.0.1

tcp.port==23&&ip.addr==192.168.0.1

0 0
原创粉丝点击