5 comments

[ 3.1 ms ] story [ 29.9 ms ] thread
Hi HN!

If you've ever had to communicate with an application that speaks Protobuf but you don't have the message specifications it can be a real pain to understand what is going over the wire.

The protoc CLI tool is able to help you out a bit by displaying the tags it can see but won't tell you much more. https://deprotobuf.com is already much more helpful but is online only.

To make my life easier and hopefully the lives of other developers out there I've built ProtobufDecoder, an application that helps you inspect and analyze binary Protobuf data.

Main features are:

- Read tags from binary payload - Decode length-delimited tags to find nested messages - Generate Protobuf message spec file

A first version is currently available from the github release page, at this point I'm curious if people find this useful and what other kind of features would be good to have.

wait... how does this work without the schema? Since protobuf payloads are not self describing
The tags and wire types are encoded in the payload.

For each tag you can determine how many bytes are used either because it’s a fixed size data type (float, double), length-delimited (strings, embedded messages) that include the byte size or it’s a varint where we can scan to the last byte of the encoded number.

It’s true that this doesn’t tell you everything, you don’t know if there are optional tags in the interface that just don’t appear in the payload. But that’s fine, the goal is to provide insight into the payload, not to generate the absolute correct interface.

Future plans are to include some analysis of the tag values especially for length-delimited tags to better detect strings for example

Got it, thank you for explaining!
You’re welcome. If you want to see how it works you can check the code on github and the relevant unit tests