python - 如何在Wireshark中解析protobuf数据包

标签 python lua wireshark lua-table tshark

我的目标是拥有一个可以解析基于 protobuf (UDP) 的协议(protocol)的插件/解析器。
我在网上找到了一个用于 Protocol Buffer 消息的自动生成 Wireshark/Ethereal 解析器插件:https://code.google.com/archive/p/protobuf-wireshark/
当我按照ReadMe文件我跳过了“步骤 1:从源代码安装 Wireshark”,因为我已经安装了它(版本 1.12.3)。

第 2 步:准备 Protocol Buffer -

this step i dont understend, how do i install libprotobuf and where?

第3步:更新wireshark配置文件 -

I'm not sure what is "wireshark_src_dir"

我创建了一个wireshark.conf文件:
wireshark_src_dir:C:\Program Files (x86)\Wireshark
wireshark_install_dir:C:\Program Files (x86)\Wireshark
wireshark_version:1.12.3

第 4 步:运行 make_wireshark_plugin.py - 对于该步骤,我下载并安装了 python-3.6.0-amd64.exe。

When i run this i get an error that: Traceback (most recent call last): File "C:\ProtoBuff\protobuff\make_wireshark_plugin.py", line 91, in f=open("configure.in","r") FileNotFoundError: [Errno 2] No such file or directory: 'configure.in'.

This file realy doesn't exists in the package i downloaded from github. Where do i get this file? do i need to create such? What is this make_wireshark_plugin.py generates?

第 5 步:创建 proto 配置文件 - 所有 proto 配置文件都需要位于/usr/share/wireshark/protobuf 中或 $HOME/.wireshark/protobuf。

i dont have a share folder and protobuf folder in wireshark installation path. Can i simply put the proto configuration files in the plugins folder?

最佳答案

自 3.2.0 版本起,Wireshark 中已添加有关 Protobuf 和 gRPC 解析器的新功能:

  • 现在可以配置 Protobuf 文件 (*.proto),以更精确地解析序列化 Protobuf 数据(例如 gRPC)。
  • 现在可以解析流 gRPC 方法的消息,并支持 HTTP2 流模式重组功能。
  • 用户可以在 Protobuf 协议(protocol)首选项中指定 protobuf 搜索路径(其中包含 *.proto 文件)以及 protobuf 消息类型映射的 UDP 端口。
  • 如果你自己的解析器需要调用protobuf解析器,你可以通过数据参数(C语言)或pinfo->private_table["pb_msg_type"](lua中的pinfo.private["pb_msg_type"])将消息类型传递给Protobuf解析器.

另外两个新功能将在 3.3.0 或 3.4.0 中发布:

  • Protobuf 字段可以解析为wireshark( header )字段,允许用户在过滤器工具栏中输入 Protobuf 字段或消息的全名进行搜索。
  • 基于 Protobuf 的解析器可以将自身注册到一个新的“protobuf_field”解析器表,该表以字段全名作为键,以进一步解析 BYETS 或 STRING 类型的字段。

引用文献:

关于python - 如何在Wireshark中解析protobuf数据包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42394911/

相关文章:

tcp - 识别组数据包?

wireshark - 在 Wireshark 中过滤 TLS 1.3 流量

python - 隔离重复列值

python - 在 PySparkense_rank() 中将 null 值保留为 null

Python EXIF 无法找到拍摄日期信息,但在通过 Windows 属性查看器时存在

c++ - 如何在 C++ 和 Lua 之间来回传递大型结构

python - Boto3 S3 实例的 AWS 凭证放置在哪里

python - 桌面开发语言是编译二进制还是脚本语言(windows)?

Lua问题: attempt to call global 'unpack' (a nil value)

shell - 与命名管道分离而不终止源程序