I want to be able to parse 32 and 64 bit ELF files - but not create or modify them (e.g. as discussed in this thread). The ELF binaries may possibly come from embedded Linux systems, that is, the library should not be irritated by MIPS, ARM and other non-x86 architectures.

What I have considered:

Do I have forgotten something? Which of the above options would you prefer?

For those who had some practical experience with pylibelf or pydeftools: These seem no longer updated (last commit: 2013 and 2012), are they mature enough?

2 Answers 2


Take a look at radare2. It can parse file formats (see here for an example of parsing the ELF header).

Radare2 supports multiple architectures and is being actively developed. On top of that it has bindings for a lot of languages, including Python of course. Read through the bindings source code to see it is pretty straightforward to script it.


  • 1
    Thank you for your pointer! Radare2 seems to be a powerful framework but may be a bit too heavy for my task. Have you tried one of the mentioned libraries whose main/only objective is to parse ELF files? In case their parsing capabilities are as good the ones of Radare2, I would prefer a more light-weight solution ... Commented May 6, 2015 at 11:56

LIEF is a good choice for parsing ELF binaries. It's written in C++, but comes with proper Python bindings and is readily available via PyPi. Besides parsing ELF files it also supports Windows PE and MacOS binaries, reading and modifying and writing all of them, that is.

It's available since 2017 and is actively maintained (example).

LIEF is pretty light-weight and doesn't require many dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.