我在我的 LAN 上的特定主机(即实际接收/发送数据的主机)捕获传入和传出 WAN 到 LAN 数据。有时我会收到异常捕获的帧,这些帧缺少字段udp中的字符串。frame.protocols
也就是说,而不是包含正确的字符串:
frame.protocols=eth:ethertype:ip:udp:data
这些框架具有:
frame.protocols=eth:ethertype:ip:data
检查这些帧的ip.versionandip.proto字段以确保它们实际上是 UDP 数据报,我看到,正如预期的那样:
ip.version=4 # IPv4
ip.proto=17 # UDP
这些捕获的帧的坏处是我没有得到任何 UDP 特定信息,例如 src/dest 端口信息,因为没有尝试对它们进行 UDP 解析。我几乎仅限于作为 IP v4 标头一部分的两个 IP 地址和数据长度,特别理想的udp.srcport字段udp.dstport不存在。
我不清楚像这样处理的帧有什么特别之处,尽管我注意到它们的帧长度都在集合 {68,69,71} 字节中,数据长度以字节 {34,35,37 }, 分别。
如果有人可以解释为什么 tshark 无法正确解析这些帧,我将不胜感激。
更新:
有人在评论中告诉我,我没有提供足够的信息来帮助确定原因。下面是这些麻烦帧之一的 JSON 格式的完整帧分解。请注意,我已经用“x”字符掩盖了一些个人信息。除此之外,这是来自 tshark 的完整解析帧数据转储。
Dumpcap(来自 Wireshark)直接用于在 Windows 10 主机(非常强大的 18 个物理内核 i9-7980XE w/128 GB RAM)上捕获数据。
dumpcap 的版本是:
Dumpcap (Wireshark) 3.0.2 (v3.0.2-0-g621ed351d5c9)
用于捕获的命令是:
"C:\Program Files\Wireshark\dumpcap.exe" -n -q -s 94 -b filesize:256000 -p \
-w i:\v3_packet_capture -i \Device\NPF_{AA8Fxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} \
-f "ip and (((icmp or udp) and ((src 192.168.8.71 and not (dst net 192.168.8.0/24\
or dst xxx.xxx.xxx.xxx)) or (dst 192.168.8.71 and not (src net 192.168.8.0/24\
or src xxx.xxx.xxx)))) \
or (tcp and (port 52799 or port xxxx or \
(src 192.168.8.71 \
and not (dst net 192.168.8/24 or dst port 80 \
or dst port 443 or dst xxx.xxx.xxx.xxx)) \
or (dst 192.168.8.71 and not (src net 192.168.8.0/24 \
or src port 80 or src port 443 \
or src xxx.xxx.xxx.xxx))))) \
and not broadcast and not multicast"
我知道捕获过滤器非常复杂,因此我将用英语对其进行分解:
1. Restrict captured frames to LAN to WAN unicast traffic, only.
More specifically, only IPv4 packets that consist of
TCP/UDP/ICMP segments/datagrams/messages should be captured.
2. Exclude most HTTP(S) traffic by via port exclusions (80/443).
..., and finally (although not relevant to the case at hand):
3. Include other TCP traffic that is for sure sourced/destined
from/to the app being monitored (ports 52799 and xxxx).
注意,为了减少被捕获和写入文件的数据量,我通过最大帧数据捕获开关将捕获的帧数据限制为每帧的前 94 个字节,这可能也很重要,也可能不重要。到. 我不相信这会影响任何事情,因为 71 异常帧的最大帧长度远低于此阈值。-s 94 dumpcap
这是用于解析 pcapng 数据文件的 tshark 命令(在 Linux 主机上):
tshark -V -O tcp,icmp,udp -r packet_capture_00006_20190614224011 -T json
-Nt -E "occurrence=a"
如果有帮助,这里是 tshark 版本信息:
TShark (Wireshark) 2.6.8 (Git v2.6.8 packaged as 2.6.8-1~ubuntu18.10.0)
这是一个异常帧的摘录:
{
"_index": "packets-2019-06-15",
"_type": "pcap_file",
"_score": null,
"_source": {
"layers": {
"frame": {
"frame.interface_id": "0",
"frame.interface_id_tree": {
"frame.interface_name": "\\Device\\NPF_{AA8Fxxxx-
xxxx-xxxx-xxxx-xxxxxxxxxxxx}",
"frame.interface_description": "Ethernet 2"
},
"frame.encap_type": "1",
"frame.time": "Jun 14, 2019 22:40:13.262031000 CDT",
"frame.offset_shift": "0.000000000",
"frame.time_epoch": "1560570013.262031000",
"frame.time_delta": "0.000001000",
"frame.time_delta_displayed": "0.000001000",
"frame.time_relative": "1.630154000",
"frame.number": "1918",
"frame.len": "71",
"frame.cap_len": "71",
"frame.marked": "0",
"frame.ignored": "0",
"frame.protocols": "eth:ethertype:ip:data"
},
"eth": {
"eth.dst": "14:35:8b:xx:xx:xx",
"eth.dst_tree": {
"eth.dst_resolved": "14:35:8b:xx:xx:xx",
"eth.addr": "14:35:8b:xx:xx:xx",
"eth.addr_resolved": "14:35:8b:xx:xx:xx",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.src": "70:85:c2:xx:xx:xx",
"eth.src_tree": {
"eth.src_resolved": "70:85:c2:xx:xx:xx",
"eth.addr": "70:85:c2:xx:xx:xx",
"eth.addr_resolved": "70:85:c2:xx:xx:xx",
"eth.lg": "0",
"eth.ig": "0"
},
"eth.type": "0x00000800"
},
"ip": {
"ip.version": "4",
"ip.hdr_len": "20",
"ip.dsfield": "0x00000000",
"ip.dsfield_tree": {
"ip.dsfield.dscp": "0",
"ip.dsfield.ecn": "0"
},
"ip.len": "57",
"ip.id": "0x0000076d",
"ip.flags": "0x000000af",
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "175"
},
"ip.ttl": "128",
"ip.proto": "17",
"ip.checksum": "0x0000ccxx",
"ip.checksum.status": "2",
"ip.src": "192.168.8.71",
"ip.addr": "192.168.8.71",
"ip.src_host": "192.168.8.71",
"ip.host": "192.168.8.71",
"ip.dst": "38.132.xxx.xxx",
"ip.addr": "38.132.xxx.xxx",
"ip.dst_host": "38.132.xxx.xxx",
"ip.host": "38.132.xxx.xxx"
},
"data": {
"data.data": "dc:dd:2e:14:xx:...:xx:e2:16:5b:9c",
"data.len": "37"
}
}
}
}
以下是上述帧中缺少的 UDP 部分的示例,基于紧随其后的正确解析的 UDP 数据报(除了数据长度和帧特定的报头信息/校验和之外,具有相同的 (IP/UDP) 特征) :
...
"frame.number": "1919",
...
"udp": {
"udp.srcport": "52799",
"udp.dstport": "51413",
"udp.port": "52799",
"udp.port": "51413",
"udp.length": "1437",
"udp.checksum": "0x000097c5",
"udp.checksum.status": "2",
"udp.stream": "0"
},
我相信我已经提供了上面所有的相关信息。如果没有,请让我知道要添加到此问题中以帮助解决原因。