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.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f2e67ccc39ce4861168fc37c236b04dfcdd532582bde370095db2581b2c6805 |
|
MD5 | a50000375fc8cd932865d591c58be552 |
|
BLAKE2b-256 | 55034e57767820d4dac95ce32efee21f248edbcb3bb02630a49f9c6569aa285f |
Hashes for lief-0.11.2-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aab5b75afd07b176c5a0979e09bf2fca506524c78d11451f68737150ffa9fec3 |
|
MD5 | 4e66cddf41dc1753298bd0eabe36151a |
|
BLAKE2b-256 | c703daa043307faad0899aa94849ad503f0b90ac89af46d69f306517fbcdba7d |
Hashes for lief-0.11.2-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa797dac08233e675d46db6c680b583caf6d22e3321b2cd312dd8df5fa959cd9 |
|
MD5 | 1366b5d1aefb3aa351e053bc3bbb98c6 |
|
BLAKE2b-256 | 9909cb4d57c2e11481159c4bc508411581eadafde67783462f65672fcfa1398b |
Hashes for lief-0.11.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 347acd1b143092858d792d92dd48c56984bffa6fff246f668c0916dfc3e61cb5 |
|
MD5 | 89a34dea01de3efc1d197ebed7f18e08 |
|
BLAKE2b-256 | 1c33428ceebd6693dc788065e6b3a2eb88d3f07f5f25dfc3d73005b02386c725 |
Hashes for lief-0.11.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7b8dda460b21d85497dd30f1b1271dd44ac5965843642b810c3b6aeb8da52fa |
|
MD5 | e67a631eb742d26fd495d6755a5f2c36 |
|
BLAKE2b-256 | f2847e99ce4f98c24ae0821e60ea1c4de178c36a19d626b684e2d7a6eb4ca70f |
Hashes for lief-0.11.2-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18fc35111bffb558572d4fa0de02d37d78b0ceebca461d5ce82f59b507d509a |
|
MD5 | cfb096d9a141bdb393c28813960f9530 |
|
BLAKE2b-256 | bdae585fb1fdc6e3ddfb3a924a0c93cd14df987b3aef2ec7848def20f2b0c543 |
Hashes for lief-0.11.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e499693ef29cf2d777db5dae35ef1a46b3dc4a93145a2604e9799aa6e3f58fce |
|
MD5 | 3f4b041332872edc85d969d2042ee389 |
|
BLAKE2b-256 | 096b4ebbbe3342cfdfc872733e97971e9b2f647be2f6c9ca187a69a09118f17b |
Hashes for lief-0.11.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f87fc6bf31af8595b7b3acfd19f67b431094ccd0518ddea4ad28f6b07684020 |
|
MD5 | dcd2bf4a4533cc83fd4749fbc131c550 |
|
BLAKE2b-256 | dc38323755153a797ed16590dbccb797d7e3befa386a8d6ba01d74f820847117 |
Hashes for lief-0.11.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 863da532acb72e1c0a264e44d15ab6c809a4e7156f9dc9a843a78d501aa78486 |
|
MD5 | 18b03730fc6ccaa7ecaf00274e1d28eb |
|
BLAKE2b-256 | c3a1909c829ef07c566a1b46db9a3b274157e03108c5ceb37b27b74e2b58b634 |
Hashes for lief-0.11.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27392d5d90ad3539dc065b897eeecd49c2fffa540a117ef0af4ab3c08a15b009 |
|
MD5 | b06e551cb91f74b32a2a9ee5b8d9badb |
|
BLAKE2b-256 | d43f560cd70242ed46a5257b1f718acbf85323c7ec25b68f5e3436160333e786 |
Hashes for lief-0.11.2-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59333b0e0577ba5a231e97c37bfa3259dde935592dbead3bb9af32c878f9a678 |
|
MD5 | 984221b355b52b7b15d96a27744433d8 |
|
BLAKE2b-256 | a68452e73c4e9cea02432cc28c6aa5486dd80c707516c781cdbd3e512b816a53 |
Hashes for lief-0.11.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f12b7d5901e4822e3b7019dc54e2f33e5c100b0c28c775014978cb5c30a4467 |
|
MD5 | a4381305df1249f43d906f829886b62d |
|
BLAKE2b-256 | 8b96c65d11a5358c663acec5569fd0b5e516cb9e7427693a35eb5f0eaa226cd6 |
Hashes for lief-0.11.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 370ab0fd40a36564acec4c612ad2a4b4ac39c3f496635fee060f317eea9dbdda |
|
MD5 | a707595f888a62f833faabe0652455c8 |
|
BLAKE2b-256 | c36532d4369d1b065fbef3b5f741a98e8e073311d5fcdc50583d15f36c54218d |
Hashes for lief-0.11.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dee7317e1cfc488eda703c58a6271be177fe89d1dde4c8ffa31cfd275bbfe24 |
|
MD5 | b38a05f0044b9aedb74d935669adbe6b |
|
BLAKE2b-256 | 67e2a0477391d4426e4c9567ae0efef415d8983342ea104ec2de228f91099eb9 |
Hashes for lief-0.11.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e940f37ed72c784ef08cfb0e4c3ae83d48cfcf43d56724a0d38805cc1bd65919 |
|
MD5 | 0d294119039f62052f2bfd2e9f26a0d2 |
|
BLAKE2b-256 | d193de55d2ffa3319e9eb3e372dacbc0c70afa4365e0d5171ef99d2f82f936f3 |
Hashes for lief-0.11.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 463d229f0ca65cfc8f2bc2e412c0197b6db9c46bbe3ca61ca77ce59d1a4cbd10 |
|
MD5 | 1629a81817a9f64df12e1ec0a9497e50 |
|
BLAKE2b-256 | 767a0187abde4a1a33152d832aa9ae53e5ee4f76fa1763e81407b68da434ce21 |
Hashes for lief-0.11.2-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6be9b6bf3cbae7b6d68753ed8fcb158153500e5e28a316676bd5d4c54858be98 |
|
MD5 | 78d9e321ef92caa0458841d78af805a5 |
|
BLAKE2b-256 | 6406b9cd9bb1a16cbffaea49717d8fcc35adc350b61ea2088b3f31406137a08a |