Wireshark 包过滤规则
Wireshark CaptureFilters
英文原文地址:http://wiki.wireshark.org/CaptureFilte
翻译整理:dalerkd
其实它与任何libpcap/WinPcap库的使用格式相同
//你应当从Caption->Options 输入表达式.
0x1仅捕获指定IP地址的流量
host 172.18.5.4
0x2从一个IP地址范围捕获流量
net 192.168.0.0/24
或者
net 192.168.0.0 mask 255.255.255.0
0x3捕获来自某地址范围的流量
src net 192.168.0.0/24
或者
src net 192.168.0.0 mask 255.255.255.0
0x4捕获前往某地址范围的流量
dst net 192.168.0.0/24
或者
src net 192.168.0.0 mask 255.255.255.0
0x5仅捕获某端口的流量
port 53 //DNS协议
port 80 //TCP UDP协议
0x6捕获目标host流量包中除去某些端口的内容
host www.example.com and not (port 80 or port 25) //不要HTTP和SMTP包
host www.example.com and not port 80 and not port 25
0x7捕获除了ARP和DNS外的流量
port not 53 and not arp
0x8捕获端口范围的流量
(tcp[0:2] > 1500 and tcp[0:2] < 1550) or (tcp[2:2] > 1500 and tcp[2:2] < 1550)
或者用新版libpcap(0.9.1)规则
tcp portrange 1501-1549
0x9仅捕获EAPOL类型的以太网协议
ether ptoto 0x888e
0xA拒绝向链路层发现协议组播组的以太网帧(Reject ethernet frames towards the Link Layer Discovery Protocol Multicast group: )
not ether dst 01:80:c2:00:00:0e
0xB仅捕获IP流量,两个字母,但非常有效地摆脱了底层协议,诸如ARP和STP等
IP
0xC仅捕获单播流量-在屏蔽网络噪声上非常有用,如果你只希望看到从你机器上发出的流量,而不是广播和多播公告.
not broadcast and not multicast
0xD捕获IPV6的所有结点(路由器和邻接计算机)的通知.便于查找”bogue RAs”.Capture IPv6 “all nodes” (router and neighbor advertisement) traffic. Can be used to find rogue RAs: )
dst host ff02::1
0xE捕获HTTP GET请求.对应于字节’G”E”T’和”(Hex值 47,45,54,20)只有在TCP报头之后.”TCP[12:1]0XF0)>>2”计算出TCP header长度.
port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]=0x47455420
有用的示例:
冲击波和冲击波杀手 RPC蠕虫.
0x1冲击波(Blaster worm)
dst port 135 and tcp port 135 and ip[2:2]==48
赛门铁克认为如下的过滤器也可以用于Blaster的检测,哪个检测更好?
(tcp dst port 135 or tcp dst port 4444 or udp dst port 69) and ip[2:2]==48
0x2冲击波杀手(Welchia worm)
icmp[icmptype]==icmp-echo and ip[2:2]==92 and icmp[8:4]==0xAAAAAAAA
该过滤器寻找一个ICMP echo请求是92字节长,有一个ICMP有效载荷开头4字节的(十六进制)。 这是冲击波杀手蠕虫之前它试图破坏系统的签名。
0x3许多蠕虫尝试通过端口135,445,1433,或接触其他主机传播该过滤器是独立于特定的蠕虫病毒,而不是它看起来SYN数据包从这些特定端口的本地网络发起。 请更改网络过滤器来适配你自己的网络。
dst port 135 or dst port 445 or dst port 1433 and tcp[tcpflags] & (tcp-syn) != 0 and tcp[tcpflags] & (tcp-ack) = 0 and src net 192.168.0.0/24
英文原文地址:http://wiki.wireshark.org/CaptureFilte