/pylibelf

A pure Python library to parse ELF files.

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

pylibelf

pylibelf is a pure Python library to parse ELF files.

This tool is in early development stage, if you have any question or want help in coding feel free to contact me at crackinglandia [at] gmail.

At the moment, you can only read ELF files. The write functionallity is work-in process.

NOTE: This is not a wrapper around libelf!.

How to use it

>>> import pylibelf
>>> elf = pylibelf.ELF("/bin/bash")
>>> elf.elfHdr
<pylibelf.Elf64_Ehdr object at 0x7f68672d2d50>
>>> elf.elfHdr.e_entry
<elfdatatypes.Elf64_Addr object at 0x7f6867277d50>
>>> elf.elfHdr.e_entry.value.__hex__()
'0x41d438'
>>> elf.ShdrTable[1]
<pylibelf.Elf64_Shdr object at 0x7f686727d6d0>
>>> elf.ShdrTable[1].sectionName
'.interp'
>>> elf.ShdrTable[1].sectionRawData
'/lib64/ld-linux-x86-64.so.2\x00'

License

pylibelf is distributed under BSD 3-Clause.