# protobuf-inspector 未知定义 Protobuf 解析工具

> 无需对应的 .proto 定义即可解析 Protocol Buffers 数据块（proto2 或 proto3），按线路编码顺序以彩色输出字段；对每个长度限定的数据块，依次尝试解析为嵌套消息、打包数组、字符串，最后退回十六进制转储。分析者把推断出的内容写入 protobuf_config.py，包括字段类型与名称、消息和枚举类型以及自定义原生类型，直到解析器不再需要猜测。字段名、zig-zag 编码、有无符号以及整数还是浮点数，都无法从线路数据中读出；README 也说明猜测可能出错，小数据块尤甚。

- 类型：工具
- 目标：协议
- 类别：协议分析工具
- 关联：基础工具
- 来源复核于：2026-10-19
- 收录于：2026-10-29
- 原始资源：<https://github.com/mildsunrise/protobuf-inspector>
- 一手来源：<https://github.com/mildsunrise/protobuf-inspector/blob/3211be9c2fb1d24e788ff492571cd0ba895c519a/README.md>
- 目录页面：<https://awesomerea.org/zh/resources/protobuf-inspector/>
- 记录 JSON：<https://awesomerea.org/resources/protobuf-inspector/record.json>
- 英文版：[English](https://awesomerea.org/resources/protobuf-inspector/index.md)

## 使用条件与局限

- 项目已不再活跃：唯一的发布版本（PyPI 上的 0.2，标签 v0.2.0）与所审阅的 master 提交均为 2020-11-24，此后再无提交。
- 用 pip 安装（setup.py 声明 Python >=3.3），通过标准输入向 protobuf_inspector 传入单个原始 protobuf 数据块，并可指定根消息类型。README 未说明对抓包、gRPC 或 HTTP 的处理，因此需要先从分析者有权检查的流量或文件中提取数据块。
- 命令行工具会在工作目录及其各级父目录（直到文件系统挂载点）中查找 protobuf_config.py，并用 runpy 运行，因此配置文件会作为 Python 代码执行。dump 类型会把匹配的数据块写入工作目录下的 dump.N 文件；解析错误只中止出错字段的解析，并使命令以非零状态退出。
- 采用 ISC 许可。README 说明其 Python API 并非为库用途设计，将来可能变化。仓库没有测试或 CI 配置。

## 一手来源

1. <https://github.com/mildsunrise/protobuf-inspector/blob/3211be9c2fb1d24e788ff492571cd0ba895c519a/README.md>
2. <https://github.com/mildsunrise/protobuf-inspector/blob/3211be9c2fb1d24e788ff492571cd0ba895c519a/CONFIG.md>
3. <https://github.com/mildsunrise/protobuf-inspector/blob/3211be9c2fb1d24e788ff492571cd0ba895c519a/protobuf_inspector/__main__.py>
4. <https://github.com/mildsunrise/protobuf-inspector/blob/3211be9c2fb1d24e788ff492571cd0ba895c519a/protobuf_inspector/types.py>
5. <https://github.com/mildsunrise/protobuf-inspector/blob/3211be9c2fb1d24e788ff492571cd0ba895c519a/setup.py>
6. <https://github.com/mildsunrise/protobuf-inspector/blob/3211be9c2fb1d24e788ff492571cd0ba895c519a/LICENSE>
7. <https://pypi.org/project/protobuf-inspector/0.2/>

## 同分区更多条目：协议

- [libimobiledevice iOS 设备协议库](https://awesomerea.org/zh/resources/libimobiledevice/index.md) · 工具
- [Sniffle 蓝牙低功耗嗅探器](https://awesomerea.org/zh/resources/sniffle/index.md) · 工具
- [Packetry USB 2.0 协议分析工具](https://awesomerea.org/zh/resources/packetry/index.md) · 工具
- [Caring Caribou 汽车 CAN 总线安全探索工具](https://awesomerea.org/zh/resources/caringcaribou/index.md) · 工具
- [protodump Protobuf 定义恢复工具](https://awesomerea.org/zh/resources/protodump/index.md) · 工具
- [CAN Commander CAN 总线逆向工具](https://awesomerea.org/zh/resources/can-commander/index.md) · 工具

## 关于此条目

说明已依据一手来源复核。
原创说明采用 MIT 许可；外部项目、论文与素材保留各自的权利和许可。
