Hacker News new | ask | show | jobs
by jevinskie 5091 days ago
My go-to library for binary mucking in Python is the fantastic Construct library. [0] [1] It is a declarative way of specifying binary structures. It handles endianness, serialization, and deserialization for you. You can build structures of structures with Construct. I used it to parse the PS3's pseudo-ELF files (SELFs) and was quite successful except for a few shortcomings in the library. I don't blame Construct though because the SELF format is a wild beast. Corbin Simpson (the author) was quite helpful when I was looking into the possibility of fixing my issues. Look at the ELF parser to see how easy it is to use! [2]

[0]: http://construct.readthedocs.org/en/latest/

[1]: https://github.com/construct/construct

[2]: https://github.com/construct/construct/blob/master/construct...