https://github.com/sauci/pyelf
https://github.com/sauci/pyelf
elf python27 python3
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sauci/pyelf
- Owner: Sauci
- License: mit
- Created: 2018-06-27T13:03:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-04T04:08:51.000Z (over 1 year ago)
- Last Synced: 2025-04-13T23:15:59.457Z (10 months ago)
- Topics: elf, python27, python3
- Language: Python
- Size: 233 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://codecov.io/gh/Sauci/pyelf)
## package description
the purpose of this package is to provide high level API to work
with [elf](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) files.
## installation
### using `pip`
install the package by running the following command:
`pip install sauci-pyelf`
### from source
this package uses [pyelftools](https://pypi.org/project/pyelftools) package. if it is not already installed, install it
first. once the above prerequisite is installed:
- download the [pyelf](https://github.com/Sauci/pyelf/archive/master.zip) package
- unzip it
- move to the directory containing the setup.py file
- run the command `python setup.py install`
**note:** the above command might require privileged access to succeed.
## example of usage
the bellow code snippet shows how to load an elf file and get some of its properties.
```python
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
```