Skip to content
ELF reader-writer library for Python3
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
makeelf Elf32_Dyn: fix endianness Nov 21, 2018
.travis.yml Travis: disable legacy tests Nov 21, 2018
Doxyfile Doxygen: ignore test classes Dec 2, 2018
LICENSE Add LICENSE Nov 28, 2017 Add manifest Mar 13, 2018 README: describe installation procedure Dec 2, 2018
README.txt Fix README Mar 13, 2018
elf.hdcb Add ELF syntax file Sep 27, 2017
elf_secthdr.hdcb HDCB scripts: fix section header dissector in little-endian ELFs Nov 11, 2018 Fix version of PyPI package Nov 21, 2018


ELF reader-writer library for Python3


MakeELF is a Python library to parse, modify and create ELF binaries. It provides following features:

  • easy to use, standard Python interface
  • reading existing ELF files to Python representation
  • modification of every aspect of ELF format structures
  • ability to skip any validation to test other parsers for potential errors
  • creating new valid ELF files with just one step
  • easy serialization of every structure present in ELF file


MakeELF could be installed either using PyPI and pip3 tool or manually with help of script.

Install from PyPI

It is as simple as typing:

pip3 install makeelf

Manual installation

Clone the Github repository and in root of the project execute:

python3 install


Creating new object

from makeelf.elf import *
elf = ELF(e_machine=EM.EM_LKV373A)

Parsing ELF file

fd ='some.elf', os.O_RDONLY)
b =, 0xffff)

elf, b = Elf32.from_bytes(b)

Saving ELF to file

fd ='other.elf', os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
os.write(fd, bytes(elf))

Adding a section

data_id = elf.append_section('.data', b'\0\0\0\0', 0xfadd)

Adding a symbol

elf.append_symbol('NULL', data_id, 0, 4)

Modifying attributes

elf.Elf.Shdr_table[data_id].sh_flags = int(SHF.SHF_ALLOC)


All the software here is licensed under GNU General Public License 3.0, available in LICENSE file.

You can’t perform that action at this time.