规则目的
|
使用 BPF 进行过滤
|
使用正则表达式进行过滤
|
解释
|
示例
|
按 IP 地址搜索流量
|
host <地址>
|
|
<地址> 是 IPv4 地址
|
host 10.10.0.1
|
搜索两台主机之间的流量
|
host <地址 1> and host <地址 2>
|
|
<地址 1> 和<地址 2> 是 IPv4 地址
|
host 10.10.0.1 and host 10.10.0.2
|
搜索单个 TCP 会话的流量
|
tcp <端口 1> and host <地址 1> and tcp <端口 2> and host <地址 2>
|
|
<地址 1> 和<地址 2> 是通信 IPv4 地址<端口 1> 和<端口 2> 是通信端口
|
tcp port 80 and tcp port 53567
and host 10.10.0.1 and host 10.10.0.2
|
按多个 IP 地址搜索流量
|
host <地址 1> or host <地址 2> or ... host <地址 N>
|
|
<地址 1-N> 是 IPv4 地址
|
host 10.10.0.1 and host 10.10.0.2 and host 10.10.0.3
|
查找来自一组主机的所有 DNS 查询
|
udp and dst port 53 and ( src host <地址 1> or src host <地址 2> or ... src host <地址 N> )
|
|
<地址 1-N> 是 IPv4 地址
|
udp and dst port 53 and ( src host 10.10.0.1 or src host 10.10.0.2 )
|
搜索 HTTP 流量
|
|
" HTTP/"
|
过滤器必须不带引号使用
|
|
搜索 DNS 流量
|
udp dst port 53 or tcp dst port 53
|
|
仅限标准 DNS
|
|
使用针对特定域的 GET 请求搜索 HTTP 流量
|
tcp port 80 or tcp port 8000 or tcp port 8080 or tcp port 8888
|
GET.{1,1000}<域>
|
<域> 要找到的域
|
|
搜索特定主机的 ICMP 流量
|
icmp and host <地址>
|
|
<地址> 是 IPv4 地址
|
icmp and host 10.10.10.1
|
搜索以纯文本传输的身份验证数据
|
tcp port 80 or tcp port 8000 or tcp port 8080 or tcp port 8888 or port ftp or port smtp or port imap or port pop3 or port
telnet
|
"pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|username:|password:|Username:|Password:|login:|pass |user|VXNlcm5hbWU6|UGFzc3dvcmQ6|LOGIN |USER|PASS "
|
过滤器必须不带引号使用
|
|
搜索主机作为客户端的 TCP 会话
|
tcp[tcpflags] = tcp-syn and host <address>
|
|
<地址> 是 IPv4 地址
|
tcp[tcpflags] = tcp-syn and host 10.10.10.1
|
在给定子网中搜索 HTTP 流量
|
net xx.xx.xx.xx/yy and ( port 8080 or port 80 )
|
|
xx.xx.xx.xx/yy 是带掩码的 IPv4 子网
|
net 10.10.10.0 /24 and ( port 8080 or port 80 )
|
搜索本地交互流量
|
ip and src net (10 or 172.16/12 or 192.168/16) and dst net (10 or 172.16/12 or 192.168/16)
|
|
|
|
搜索与互联网上对象交互的流量
|
ip and not (src net (10 or 172.16/12 or 192.168/16) and dst net (10 or 172.16/12 or 192.168/16)) and not multicast and not broadcast and not net 169.254/16
|
|
|
|
根据 HTTP 流量中的 UserAgent 字段搜索流量
|
用户代理:
|
|
|
|