raw decoder for protobufs format

前端 未结 4 1957
别那么骄傲
别那么骄傲 2020-12-02 18:42

I\'d like to find a way to convert a binary protobuf message into a human readable description of the contained data, without using the .proto files.

The background

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 19:30

    For Posterity: Google's protocol buffer tools have the ability to decode raw buffers.

    Just send the unknown buffer to it and pass the--decode_raw flag

    $ cat has_no_proto.buff | protoc --decode_raw
    2 {
      2: "Error retrieving information from server. [RH-02]"
    }
    

    So here's a message with field 2 set to an embedded message which in turn has its second field set to a string telling me I pissed off Google Play.

    Type information isn't definite (it looks like it will try to display all binary data as strings -- but your requirement for varint/string/submessage distinction is met).

提交回复
热议问题