Search code examples
pythonflatbuffers

How to sniff Flatbuffers in Python?


Once reading in memory a binary, is there an efficient way to tell whether the binary is a Flatbuf? Preferably a Python solution.


Solution

  • There is provision of 4 byte "root identifier" at beginning of buffer(search for it in flat buffer schema language). If your schema has implemented that, you can just validate first 4 bytes.

    Or if you have the generated interfaces with you, you may run the complete "flatbuffer verifier" on binary to see if it's a valid flat buffer.