从捕获的数据包中删除尾部时间戳

发布于 2025-01-11 07:08:46 字数 249 浏览 7 评论 0原文

我有一个通过特殊交换机捕获的数据包,该交换机在 FCS 之前附加时间戳。这些通常被称为“预告片时间戳”。

然而,这样做后,数据包末尾的FCS并未更新。因此,当我将数据包捕获加载到wireshark中时,所有数据包都被报告为具有不正确的帧检查序列。

是否有像 editcap 等这样的实用程序,我可以用它来从 pcap 中删除每个数据包的最后 x 字节?

I have a packet capture captured through a special switch that appends timestamps just before FCS. These are generally referred as "trailer timestamps".

However, after doing so, the FCS at the end of the packet is not updated. Hence, when i load the packet capture into wireshark, all the packets are reported as having incorrect frame check sequence.

Is there a utility like editcap etc.. that i can use to remove, say, last x bytes of each packet from a pcap?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云巢 2025-01-18 07:08:46

是的,editcap 可以删除每个数据包的最后 x 字节。从 editcap 手册页:

-C [offset:]<choplen>

    Sets the chop length to use when writing the packet data. Each packet is 
    chopped by <choplen> bytes of data. Positive values chop at the packet
    beginning while negative values chop at the packet end.

< strong>示例:删除每个数据包的最后 4 个字节

editcap.exe -C -4 foo.pcap foo_chopped.pcap

当然,这样做将导致每个数据包都显示为:

[Packet size limited during capture: Ethertype truncated]

...这当然是一个误导性消息,因为 Ethertype 没有被截断,只是作为 FCS 的以太网帧在这种情况下已被删除。尽管如此,这是一个相当无害的指示,因此该解决方案可能适合您的需求。

或者,您可以更简单地禁用以太网校验和验证。通过 Edit -> 执行此操作首选项->协议 ->以太网->如果可能,验证以太网校验和:取消选择 ->好的。

Yes, editcap can remove the last x bytes of each packet. From the editcap man page:

-C [offset:]<choplen>

    Sets the chop length to use when writing the packet data. Each packet is 
    chopped by <choplen> bytes of data. Positive values chop at the packet
    beginning while negative values chop at the packet end.

Example: Remove the last 4 bytes of each packet

editcap.exe -C -4 foo.pcap foo_chopped.pcap

Of course doing this will then result in each packet being indicated with:

[Packet size limited during capture: Ethertype truncated]

... which is of course a misleading message as the Ethertype isn't truncated, just the Ethernet frame as the FCS has been removed in this case. Nonetheless, this is a rather harmless indication and so this solution may fit your needs.

Alternatively, you could more simply just disable Ethernet checksum validation. Do this via Edit -> Preferences -> Protocols -> Ethernet -> Validate the Ethernet checksum if possible:deslect -> OK.

走走停停 2025-01-18 07:08:46

请在 Wireshark 问题列表;专门处理带有捕获开关拖车的帧可能是有意义的。

Please file an issue for this on the Wireshark issue list; it might make sense to treat frames with capture-switch trailers specially.

太傻旳人生 2025-01-18 07:08:46

我使用 https://github.com/seladb/PcapPlusPlus 编写了自己的应用程序

基本上你可以使用 pcapplusplus并迭代每个 RawPacket 并执行类似的操作

rawPacket.removeData(rawPacket.getRawDataLen() - FCS_LEN - bytesToRemove, bytesToRemove);

I wrote my own application using https://github.com/seladb/PcapPlusPlus

Basically you can use pcapplusplus and iterate over each RawPacket and do something like

rawPacket.removeData(rawPacket.getRawDataLen() - FCS_LEN - bytesToRemove, bytesToRemove);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文