9
votes

Is it possible to decode protobuf serialized files without schema with tools or anything that would decode the binary data to readable format?

1

1 Answers

11
votes

You can often deduce the schema. In fact, IIRC the "protoc" tool has a set of parameters (--decode_raw, iirc) where it will do precisely that - making informed guesses. However, it is a guess - the format is ambiguous in that multiple different types of data can be stored in the same mechanisms - for example, a length-prefixed chunk could be:

  • a sub-object (of any user type)
  • a packed array (of various primitive types)
  • a utf-8 string
  • a raw byte[]
  • and probably something else I'm forgetting

Likewise, a 4-byte fixed-width chunk could be a fixed-width integer, or a float; the integer could be signed or unsigned.