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 nightly 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: contact at lief.re
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.12.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 211684f25d7b98a0d9e8a77113ff3f358119fa305acea1f372519b11c54aa0c4 |
|
MD5 | 80a78022387c676b27423e98bfa16658 |
|
BLAKE2b-256 | 512b35a57120363dd9cba89e13c24b7201d923b8887287da0b9b9ef43e49b657 |
Hashes for lief-0.12.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5638521125da9e66b8ff8403342bc6af54965b8b59ac86d114b886c40a49ed3c |
|
MD5 | 5d1c571fbd6de2ecbcbfdbf19d6f6a6d |
|
BLAKE2b-256 | 7172ef03ed7d4a1f088af081672e386282c71e09a0895c5f3b8629498b78c222 |
Hashes for lief-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078bdda599882f3534bc4fe02005c3e0c1ca1c4532aeb48501ad94edc860a4f7 |
|
MD5 | 38b083371dc3d5176879d907b21a8f59 |
|
BLAKE2b-256 | f1e5b046715675c30e5f521a9f272f1de2d0449a8bdcfc9f0334aa004b558bff |
Hashes for lief-0.12.0-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fade4db6e7127586ba94a361e46066ce16d2406e8a4395b7986e90bb494f6c10 |
|
MD5 | 5f9ffb41660187ae0524a45e2e55220f |
|
BLAKE2b-256 | 8bdb41c8880338e83017374c958d6bf4e802d12aa423a532a54de22be05aa2b7 |
Hashes for lief-0.12.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0365acf4cd476ba9fba9165013f78165f3ced935097fa15d32bfab68ed61a2c |
|
MD5 | 72b259611c49180c8aa9f85fd120fa51 |
|
BLAKE2b-256 | 055d55ac000b69a0c30f0d7318abda3c679eaab1a49acef0c3a51c88b36c19a3 |
Hashes for lief-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10a920f7a9d6b40040d2cae331ebfdc781fba151e758b2440a6849af391e4c5d |
|
MD5 | 8cb72e506e2f6edcbf307e60e6c8b351 |
|
BLAKE2b-256 | baa8d7dc0c41a7908b8ef6f4c4c12464c1c2e0986d18ec4aa49bb918b0313c01 |
Hashes for lief-0.12.0-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e866ad8476d181fc8d719089a1ba71cfafb877b89f11079050e9bdf36b46199 |
|
MD5 | bf9bca12b9c7533fe5cb33eda47bd07e |
|
BLAKE2b-256 | c6ce2c2cbfc288b8ff1d251a740f9d360c9db5fe76db66894fe96a6cddb49970 |
Hashes for lief-0.12.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0088834190b2ab75d2f7072126739500866a2f86f89a7b4a528f882ce6317c31 |
|
MD5 | 574627ec70d599da542c422d190428d8 |
|
BLAKE2b-256 | 8f6097b6411f295220494ceaaf46a683275e7428a73c5c29bffa63263308ca15 |
Hashes for lief-0.12.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fb81a3b20fcc9204a90815a9ab40c263e10323161e8fb24053a453032dde065 |
|
MD5 | 38eedf5e9f46aec903e3e706130d2540 |
|
BLAKE2b-256 | 33f85a1164fcf1ce00ef3b18847ae3a478ac05eaf2b5930d2daf184422feac44 |
Hashes for lief-0.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53b94c5608f35b8001400b208c86fed52fcd14dab1d4e600beb2a5829830377e |
|
MD5 | dfe2e26f7d4aff950d70f2bc02e51583 |
|
BLAKE2b-256 | 9706e521d94f2a3be2ea397ef76d0ebd922772e6c5a3df3d0135c77f61eae29b |
Hashes for lief-0.12.0-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c240338700549f86768475c7c516d5c13afa8326ed1e317c880750c642d5af4c |
|
MD5 | d078d4d75a7d5f53a93b06dbdbe278b6 |
|
BLAKE2b-256 | 6f2ac356d6fc16f226c0043fc69a5da77cffdddcfe5eaeb4bd6c565a64342bbf |
Hashes for lief-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8a34b1e471ed8fcbe030f6ce7c93d618af51bd20abd170b8d0ae011f9d57f39 |
|
MD5 | ebac8970b2b081ad59a54ce607cefa69 |
|
BLAKE2b-256 | c2c458a028c0b612930890c0454ca398f1e2392a7788245fd6182da24785f780 |
Hashes for lief-0.12.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da6978d8e0014a5e4b0bfe37cc6fe72278c051a08e0b3392a65f5b6c4caf0187 |
|
MD5 | e85ae3121271c096a1ebcae1bea758ac |
|
BLAKE2b-256 | b001a313c80f96cb4ece0dfda2da898361366292ecd91222bafe607ac39f47bd |
Hashes for lief-0.12.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 510e4ee28f084d4368c9c7eecd0b3c32600adbe78f2afe99b50d1dccc587ef30 |
|
MD5 | a158cd20d82d337b897b971189e5bd5f |
|
BLAKE2b-256 | 8b957229cf1aa814e4cbed2080642253b26f425e54f335a513ccec2e84a7e3b4 |
Hashes for lief-0.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a540d58ac570b8a225ec220c896b665024e495d8a669d0f5396baa95c1d0f7ff |
|
MD5 | d413ffa8554b6b90b4505b6d553396e9 |
|
BLAKE2b-256 | af87dfce9623d3e3f368b5968f19e8b237d5b0a534969d1dc5ba80ed972d0347 |
Hashes for lief-0.12.0-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 767d1993dcc8953490357a2bfee73eb41b818c8235301ac5f5f3e6cec36dee21 |
|
MD5 | 661341ffc46083a5e1e7177fc6502e9d |
|
BLAKE2b-256 | 90ab1a025d87e98203691d0246f3f40ee951f9f25b14cee22443f296fa6394f9 |
Hashes for lief-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fee17492021f8733783b272d26a5c8aeceff4576baad991a8bb4ecb621b9229 |
|
MD5 | 3b2c595086ff20a5e6c7b55afec1f7cb |
|
BLAKE2b-256 | a9ad484a4f6651ee8254c9d2b7815e62ccbbd8738305602d507e25bb5e27d333 |
Hashes for lief-0.12.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23098eb6a6f6d3720a21e24652f66d4674fb524abc6e39cc5373413f70fea86c |
|
MD5 | b6ab95f0a7e5d4770bab6d2aa92bbad2 |
|
BLAKE2b-256 | 46caabdbbd61e91e0391b19e21a8b21ecd0b5079f43b964d457305e3f00781ec |
Hashes for lief-0.12.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 156517a762f2588605c22b79e76dc825bc8983bf3045ae52477ba11f3b0a90ff |
|
MD5 | c0c50bc43c38b137f8a9a9023b86045a |
|
BLAKE2b-256 | 77bed9a55c378655d11264ae4b452522b6ac44c1f666f8059459c9664dd49dd2 |
Hashes for lief-0.12.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4826afd38e85acf3ac1dd6924d8e8aee7998faee4a91d846e7dfb96efc4690c |
|
MD5 | 5029a0744a6b1b80d497a3081a77aead |
|
BLAKE2b-256 | 995a81082707d5098dd013bceeaee7d629baa0ee331ee8b1f78189fb749b231b |
Hashes for lief-0.12.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8523945fb5333d8cac086cebb937a8cfe83b11c32e3d161e747c98d1e1a1ac37 |
|
MD5 | c942c0b98ecf809403e7565beffff796 |
|
BLAKE2b-256 | 16325581c2a57b26c3e45e44d1a156e301800355c8208c5fda0029eb1129bf3a |