I would like to decode protobuf.
Example of the protobuf data:0a06282c0241057a10011805220d080510bea3f493062a03010c1628f1a6f493063002382b4001481482010f383634333233303532343736343839
I can Decoding online (e.g. viahttps://protobuf-decoder.netlify.app/) works fine.
The website decode Protobuf without having the original .proto files. And all decoding is done locally via JavaScript (Contribute onGitHub).
How can I do this in python?
I trythis solution but not exist .proto file.
- May help you:protobuf.dev/programming-guides/encodingkiner_shah– kiner_shah2023-12-12 06:47:45 +00:00CommentedDec 12, 2023 at 6:47
1 Answer1
Take the raw decoding from that site and you write a.proto file yourself.
For example, taking the first rows of the output:
Byte Range Field Number Type Content0-8 1 string (,Az8-10 2 varint As Int: 1 As Signed Int: -110-12 3 varint As Int: 5 As Signed Int: -3
you would write:
message MyMessage { string field1 = 1; int32 field2 = 2; int32 field3 = 3;}Once you figure out what the fields actually mean, you can assign more sensible names instead offieldX. If you aren't interested in some of the fields, you can leave them out of the .proto file and the protobuf decoder will ignore them.
2 Comments
Explore related questions
See similar questions with these tags.