high level API to retrieve information from ELF files.
MIT License
the purpose of this package is to provide high level API to work with elf files.
pip
install the package by running the following command:
pip install sauci-pyelf
this package uses pyelftools package. if it is not already installed, install it first. once the above prerequisite is installed:
python setup.py install
note: the above command might require privileged access to succeed.
the bellow code snippet shows how to load an elf file and get some of its properties.
from pyelf import ElfFile
elf = ElfFile('tests/input.elf')
# get a list of all symbols in file tests/input.elf.
symbols = elf.symbols()
assert 'symbol_uint8' in symbols
# get an instance of Symbol class for symbol named symbol_uint8.
symbol = elf.get_symbol('symbol_uint8')
# get address of symbol symbol_uint8.
assert isinstance(symbol.address, int)
# get size of symbol symbol_uint8.
assert symbol.size == 1