Wireshark 插件:通过每个 UDP 帧多个数据包剖析有效负载
我正在编写一个 Wireshark 插件来剖析将多个应用程序级数据包放入单个 UDP 帧中的协议。没有封闭协议来指示帧中有多少个数据包。因此,本质上,来自网络的有效负载将如下所示:
uint64 sequence1
uint64 data1
uint8 flags1
uint64 sequence2
uint64 data2
uint8 flags2
: : :
uint64 sequence_n
uint64 data_n
uint8 flags_n
在实际处理此信息的服务器代码中,我只是循环遍历帧,直到到达末尾。在查看wireshark源代码中包含的插件时,我没有看到任何协议执行这样的循环。
我知道其他协议每帧打包多个有效负载。在 Wireshark 解析器中处理此类协议的规范或标准方法是什么?
I am writing a Wireshark plugin to dissect a protocol that places multiple application-level packets in a single UDP frame. There is no enclosing protocol that indicates how many packets there are in the frame. So essentially, the payload coming down the wire will look like this:
uint64 sequence1
uint64 data1
uint8 flags1
uint64 sequence2
uint64 data2
uint8 flags2
: : :
uint64 sequence_n
uint64 data_n
uint8 flags_n
In my server code that actually processes this information, I simply loop through the frame until I reach the end. In looking through the plugins included with the wireshark source code, I didn't see any protocols that did any looping like this.
I know other protocols pack multiple payloads per frame. What is the cannonical or standard way to handle protocols like this in a Wireshark dissector?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一个对我有用的答案。我只是在解析器中循环,对我处理的每个字段增加一个
offset
值,直到offset > 。 tvb_reported_length(tvb)
。在每个循环中,我向父树项目添加一个新的子树,以便框架内的每个单独的消息都位于其自己的树中。编辑:为了您的娱乐,这里是完整的CQS的解剖代码,包括处理每个 UDP 帧多个数据包的代码:
I found an answer that worked for me. I simply loop within the dissector, incrementing an
offset
value with each field I process untiloffset > tvb_reported_length(tvb)
. In each loop I add a new subtree to the parent tree item, so that each individual message within the frame is in its own tree.EDIT: For your amusement, here's the complete disscection code for CQS, including the code that handles multiple packets per UDP frame: