finds.dev

eliben/pyelftools

Parsing ELF and DWARF in Python

View on GitHub

★ 2,289PythonNOASSERTIONupdated Oct 2026

// the take

pyelftools is a pure-Python library for parsing ELF binaries and DWARF debug info, written and maintained by Eli Bendersky since 2011. It's for people building debuggers, disassemblers, binary analysis tools, or anything that needs to read symbol tables, relocations, or line number info without shelling out to binutils.

Zero external dependencies, which matters a lot for a parsing library that often ends up embedded in other tools' pipelines. It ships readelf.py and dwarfdump.py clones that are tested against real binutils/llvm output on a huge corpus of test ELF files covering ARM, MIPS, RISC-V, LoongArch, s390x, and more obscure note formats. DWARF coverage goes up through v5, including location lists and range lists, which a lot of alternatives still don't bother with.

Pure Python means it's slow on large binaries (multi-hundred-MB ELF files with full debug info will noticeably lag compared to libdwarf/libelf bindings). The construct library it vendors internally is an old, forked copy, not the upstream construct, so its parsing primitives feel dated and aren't reusable elsewhere. The API is low-level and verbose for simple tasks like lines-of-code-for-this-address-type lookups — expect to write real scaffolding around it rather than one-liners. Error messages on malformed/corrupt ELF files can be cryptic exceptions from deep inside the construct layer rather than anything actionable.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
2,289
Forks
554
Language
Python
License
NOASSERTION
Last commit
8 Oct 2026

// nearby

If pyelftools isn't quite it.

All repos →