协议分析仪的捕获过滤条件设置是高效分析网络或总线通信的核心功能,通过精准过滤可减少无关数据、提升分析效率。以下是详细设置方法及实例,涵盖通用和专用协议分析仪的操作逻辑:
协议分析仪的过滤条件基于协议层级和数据特征,通过逻辑表达式(如AND/OR/NOT)组合多个条件,实现精准捕获。过滤条件通常分为两类:
Wireshark是跨协议的通用分析工具,其过滤条件设置逻辑适用于多数协议分析仪:
00:11:22:33:44:55 的帧plaintextether src 00:11:22:33:44:55
ff:ff:ff:ff:ff:ff 的ARP请求plaintextether dst ff:ff:ff:ff:ff:ff and arp
3 的USB控制传输plaintextusb.device_address == 3 and usb.transfer_type == 0x01 (CONTROL)
192.168.1.100 的ICMP包(如Ping请求)plaintextip.src == 192.168.1.100 and icmp
443(HTTPS)的TCP流量plaintexttcp.dstport == 443
GET /api/data 的HTTP请求plaintexthttp.request.method == "GET" and http.request.uri contains "/api/data"
00:1A:7D:DA:71:13 的BLE广告包plaintextble.hci_hcon_handle == 0x0000 and ble.advertising_address == 00:1a:7d:da:71:13
and、or、not)组合多个条件:192.168.1.100 且目标端口为 80 或 443 的TCP流量plaintextip.src == 192.168.1.100 and (tcp.dstport == 80 or tcp.dstport == 443)
专用分析仪(如USB、HDMI、Zigbee)通常提供图形化界面简化过滤设置:
2 的批量传输(Bulk Transfer)plaintextVideo Format: 3840x2160@60Hz, HDR: HDR10+
0x0300)。0x1234 的开关控制命令plaintextSource Address: 0x1234, Cluster ID: 0x0006 (On/Off)
in 指定范围(如端口号 tcp.dstport in {80 443 8080})。contains 或 matches 进行模糊匹配(如URL过滤 http.host contains "example.com")。frame.time >= "2024-01-01 10:00:00")。usb.error == 1)。beagle --filter "usb.device_address==3")。| 场景 | 过滤条件示例 |
|---|---|
| 捕获手机USB充电日志 | usb.device_address == 5 and usb.transfer_type == 0x01 (CONTROL) and usb.data contains "PD" |
| 分析Wi-Fi干扰源 | wlan.fc.type_subtype == 0x08 (Beacon) and wlan.ssid == "Unknown_Network" |
| 调试蓝牙音频延迟 | ble.hci_hcon_handle == 0x1234 and ble.audio.latency > 50ms |
| 验证HDMI CEC命令 | hdmi.cec.opcode == 0x44 (Standby) and hdmi.cec.initiator == 0x0F (TV) |
通过合理设置捕获过滤条件,可显著提升协议分析效率,尤其在复杂通信环境(如多设备混合网络、高速总线)中,精准过滤是快速定位问题的关键。建议结合协议规范文档(如USB Spec、Wi-Fi Alliance标准)设计过滤条件,并利用分析仪的 Packet List 和 Packet Details 面板验证过滤结果。