How to decompile protobuff files with unknown structure

2.1k views Asked by At

I'm trying to get the raw data from a protobuff file. I've found a few online repositories (eg. Protobuff dot net) but they require you to initialise a class or structure to deserialise the file into. In my instance this is a bit of a problem as (1) I don't know the structure and (2) it's very likely to change frequently.

Is there any way around trying to deserialise a file without a known structure/class?

1

There are 1 answers

0
Kenton Varda On BEST ANSWER

You can get limited information by using the protoc tool's --decode_raw flag:

protoc --decode_raw < data.pb

However, without type information, you'll only see numeric tags and best guesses at types. But, this is the best you can do -- protobuf is efficient because it avoids putting much type information on the wire, instead relying on both ends to already know the type.