Library to instrument executable formats
Project description
About
The purpose of this project is to provide a cross platform library which can parse, modify and abstract ELF, PE and MachO formats.
Main features:
Parsing: LIEF can parse ELF, PE, MachO, OAT, DEX, VDEX, ART and provides an user-friendly API to access to format internals.
Modify: LIEF enables to modify some parts of these formats
Abstract: Three formats have common features like sections, symbols, entry point… LIEF factors them.
API: LIEF can be used in C, C++ and Python
Downloads / Install
First, make sure to have an updated version of setuptools:
$ pip install setuptools --upgrade
To install the latest version (release):
$ pip install lief
To install nightlty build:
$ pip install [--user] --index-url https://lief-project.github.io/packages lief
Getting started
Python
import lief
# ELF
binary = lief.parse("/usr/bin/ls")
print(binary)
# PE
binary = lief.parse("C:\\Windows\\explorer.exe")
print(binary)
# Mach-O
binary = lief.parse("/usr/bin/ls")
print(binary)
C++
#include <LIEF/LIEF.hpp>
int main(int argc, char** argv) {
// ELF
try {
std::unique_ptr<LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse("/bin/ls");
std::cout << *elf << std::endl;
} catch (const LIEF::exception& err) {
std::cerr << err.what() << std::endl;
}
// PE
try {
std::unique_ptr<LIEF::PE::Binary> pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe");
std::cout << *pe << std::endl;
} catch (const LIEF::exception& err) {
std::cerr << err.what() << std::endl;
}
// Mach-O
try {
std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse("/bin/ls");
std::cout << *macho << std::endl;
} catch (const LIEF::exception& err) {
std::cerr << err.what() << std::endl;
}
return 0;
}
C (Limited API)
#include <LIEF/LIEF.h>
int main(int argc, char** argv) {
Elf_Binary_t* elf = elf_parse("/usr/bin/ls");
Elf_Section_t** sections = elf->sections;
for (size_t i = 0; sections[i] != NULL; ++i) {
printf("%s\n", sections[i]->name);
}
elf_binary_destroy(elf);
return 0;
}
Documentation
Contact
Mail: lief at quarkslab com
Gitter: lief-project
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for lief-0.11.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80c73164bc9488a66b99b5c145c5e43f814a8a857407e2eef2cfbd8ad60e5eb4 |
|
MD5 | 68ecac17bfa1c11f5a64404e737686ea |
|
BLAKE2b-256 | c3db2c365e82a02054552cbec4acd6948ed32443a3516d17d256d5c76945ac6c |
Hashes for lief-0.11.3-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f635aa666c790c47837f93b3834316667b917e9efcd0c4ec872bf287c0db98a7 |
|
MD5 | efb6ae304cc381d550f9933ca2f6439b |
|
BLAKE2b-256 | 42e2e8f8156a98a398ef03891a3fc3884b970351c5c7c23c773c6f5dc478a42a |
Hashes for lief-0.11.3-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d58ffa8dfd1c5da199d4a5b86f5ab3a537c5bd3e59f2f201cc9ea31512708db |
|
MD5 | 5d6107821af758796f14d602b22aec22 |
|
BLAKE2b-256 | 71fcecfc689fd9d766f9cc5ba302f2e61b0331dd101fb72d5eadb2e9d534700c |
Hashes for lief-0.11.3-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d073b67be6c54f0e9900f6c76c6d46c36bc4d19f52a11d650c57229eb027c679 |
|
MD5 | 48d644307d478545e36c45d804380374 |
|
BLAKE2b-256 | e1e71d30da71091f1f07d3eb757550f9d9a57e3885a0f0af082ea580eb0bb3a6 |
Hashes for lief-0.11.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5f7af82c15095b2cdf6676bb167decdf4e7ac227a1024d1d1da80a6ee31ced8 |
|
MD5 | 5043dbb2e665eeef8ee27f12b5c3b2dc |
|
BLAKE2b-256 | 5978ff303665849fdf0bab24bfbf56770c41b197286f22e2158d17834715062c |
Hashes for lief-0.11.3-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 468ad85f1a84097bf20bef01f3189d43e61e38db463f623e9e6df17397802e17 |
|
MD5 | 4f218cdfcf3b857ecf0ed61db83185e0 |
|
BLAKE2b-256 | 395247716439db02198d9f5eefea20e1ff75b797a864381dc7a52c7f5204b118 |
Hashes for lief-0.11.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a9fc90821f4b7cec6e5973a0854e28f641dc0632d03f4ab7d0df264993a48a9 |
|
MD5 | f9c29533028bcb0bc7a18c23f5fa0159 |
|
BLAKE2b-256 | 6e0fc73c60196908c992bb9174795f4fb7e86ae5c356767f96a14e84479f8085 |
Hashes for lief-0.11.3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d992486c21dabbe12cc252d8de435eb9646915c9c714708af0f023569b98cf2b |
|
MD5 | 901cb6e7fa7fa48554c5d82efb13e8ad |
|
BLAKE2b-256 | 506e6557ccdd83ab57da61077c247f12936b3d309fa2e969ab53520630154504 |
Hashes for lief-0.11.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a74a82a654daa0d7e8be7d978b2d979d7ebf61ad64157df062a7323cd02c9fa5 |
|
MD5 | 031be4b0ed357f92d8845c18191deb93 |
|
BLAKE2b-256 | b12066aaa95f9413f01e372904ce14bbf656b3b3f1c98dee036414324673ae24 |
Hashes for lief-0.11.3-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1aee594d74007166b922e072703a5affa518efd733a0b019cc8f53110826a6b |
|
MD5 | b3edcfd227f0549ce1a5c62f52d9ff85 |
|
BLAKE2b-256 | 3a82219260ded48971b3dfb4e2db08719dc41e3a415bfcc82fc691b004fa543d |
Hashes for lief-0.11.3-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8bd4274c64543dc6a6fffa4b8e9acdac8d2380cfc377bfb2300b672fb4e3782 |
|
MD5 | 9346cd780ca1441cda463fbaf771b2ea |
|
BLAKE2b-256 | a07c408f204a36fc394d5727d679d2e54b6ff187782d2ea69caf3db9406e062b |
Hashes for lief-0.11.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afed97541d57e08953b2c570ac6e3545a52679f9761ee79a743ca2cf9db0625d |
|
MD5 | ab2fe52ac867572e9211152fb6099c16 |
|
BLAKE2b-256 | d8007fe79616167c45ae73c32385c1f8fcb93afca6c8f85ce008689e9399a674 |
Hashes for lief-0.11.3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f1801e99d26e4fa95713d522b7a01d105bcc099568502ba3a8cb45942625e46 |
|
MD5 | a3b847ce568d6300cc62f4f5380fcaa4 |
|
BLAKE2b-256 | aab0ff6753d47c4e0a2050943c3101edafcbdc092db3ca04384a110e39e5b455 |
Hashes for lief-0.11.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea69039ffa36585392fca5f520d7f46ca1f07c94594725eb8074b5657ced10f7 |
|
MD5 | 4f452a307a35cc982cfee588f47ce31d |
|
BLAKE2b-256 | 7a6f71729e40fc99b3988c61642f142cfb1a239baec8151ebe29c7ee0544765e |
Hashes for lief-0.11.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d9ebbc25bf769ea8c2e1c0e5ae93e736fbe6b3eeab86c4bae1fd06b39ec049d |
|
MD5 | 9bc809112d5eb4ef044b115e7590d721 |
|
BLAKE2b-256 | 27f25e460f79f16843aed1948b9032efaafc06e6723e05aaa9d364f90e28487c |
Hashes for lief-0.11.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c4fa7546cb8130243f73191b6150927074472345e448d52bf1718191e48ad1 |
|
MD5 | 6353df29be1f04b29c02d0e03586881a |
|
BLAKE2b-256 | a3d6c02882fa348f1211ea6f6b79d238c1c9f397a99eef86569d382e63ee529f |
Hashes for lief-0.11.3-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55a6c924d1716877e173d4b4dc55577af465ad2e762bc36e4b556a58c9e2f7ae |
|
MD5 | c293cd175700402847706365aca5a456 |
|
BLAKE2b-256 | 6869d2c09f1ac21009c7e62ba980a4e816f84cca2e64d7bcd95db78b8e206309 |