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.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7e09968f99ddf1e3983d3bcc16c62d1b6635a345fee8d8139f82b31bad457d6 |
|
MD5 | 99c0baab86346f92f7c01e18bcfd933c |
|
BLAKE2b-256 | cfe90e0f6f27322af709927d73ff55eed18932d21c9ec5cd775917ac4d024705 |
Hashes for lief-0.12.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c4019dddf03a5185462fb5ea04327cee08d40f46777b02f0773c7dc294552ea |
|
MD5 | b0d2e0b49784ccfea9a694216beefa49 |
|
BLAKE2b-256 | d52f8fc8c8f7165ba737e40793975c2012b0b5fbbc20d77fa389a4012c07f419 |
Hashes for lief-0.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 443e4494df448ea1a021976258c7a6aca27d81b0612783fa3a84fab196fb9fcb |
|
MD5 | efa294595e48d3a9ac4b3bb6ec03bfc9 |
|
BLAKE2b-256 | 59e721bbf9a728869d7769082b148b35b08e6135d30727f88579c5e99fc1d7d4 |
Hashes for lief-0.12.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fbbc9d520de87ac22210c62d22a9b088e5460f9a028741311e6f68ef8877ddd |
|
MD5 | 6622fdd98da65306fa004220b0e5048f |
|
BLAKE2b-256 | a102b7d14da14603e1a3a0477a1e7ec5c8de6e8c90379cfdf88c4aad92d05c78 |
Hashes for lief-0.12.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 960a2da9f28c8d5dba753bb9ab77e26b3c6ff9b9658918be95650ceb8ee91e68 |
|
MD5 | eb90c81d1d6b993fdf5e0f3e6a96169f |
|
BLAKE2b-256 | 0eb591ab00df4bffedcc93e5947a37d49c09c9fe8699138035ff6433942ccf7f |
Hashes for lief-0.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b845eca79c772041efb38b50cfaf951e24bc047ec462450b7e54e75b7e2bee0d |
|
MD5 | 839bdb195d3c2c9ff86949eaa8ed45b3 |
|
BLAKE2b-256 | 9ea8f598f8d9389b6eea9f548ef89b8a9a2ef9b2da2a2e3867ea2f8b69f80d39 |
Hashes for lief-0.12.1-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1d23997b0a71d34e766ff183be07854c6f698fd3d6aa44bf30b6b7f4f77ef55 |
|
MD5 | 18441cc19234265cba256c61e61c5384 |
|
BLAKE2b-256 | 08bde7a2de5edf5e9c0a48c5b16792ae17196e1f486eea835d15fda89d2277f2 |
Hashes for lief-0.12.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44012da4c32c670a97bb8a055a4ff16168cfaa757d03986f319aa3329a43e343 |
|
MD5 | 15f715e74cc6886123708db27bf59cd0 |
|
BLAKE2b-256 | 3d6fe463c527e57ce130655629a590bd0cac6a0306bbcc6ff203e010f98c3a48 |
Hashes for lief-0.12.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dea6b3f17d362f93165379c46dadb012c73b1f751c8ceac256e5f43842cd86d |
|
MD5 | a9f44cf6ffdf3baa3b06c309aaca0695 |
|
BLAKE2b-256 | 44f9f9a9b673360892d033a02c45eed06b2c77261290b614398ee491fc8093d8 |
Hashes for lief-0.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efa0022a3bf70ef46335639e61b946cc2d9cf012d60e263c215e3e64b1ce38b4 |
|
MD5 | c8924bb3e1485dfd11fbb3360c7f23d9 |
|
BLAKE2b-256 | b233de235829aaba31f0e7afa5a3fa6d79eed5996446510eeb7c39cc9250bf17 |
Hashes for lief-0.12.1-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e82e466d36cbabb28cc1a787b554d2feae5ab55c39cab58ef64fb6513bad92a |
|
MD5 | 378a3e0b715af1fae7aa9268f6edbb2f |
|
BLAKE2b-256 | 410eed8405f570ce8775487d92724cd67ea47097a995b61510086e6e247b4e2a |
Hashes for lief-0.12.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4360b0acd525ba77777cc38f0e5128c90c93cc4e91ab566ef3aa45b7f8a8c57e |
|
MD5 | 923526e5aa8c39e29dde9e19dfe2d92d |
|
BLAKE2b-256 | 821a58d23caf9bf136f4e9bc7b93116817d6f8985c6b03ab3c2de17c7aa95019 |
Hashes for lief-0.12.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d3ab7212da696bcbe5ca9dd78ceaa32dfb8a0e85e18001793b4441ef4624561 |
|
MD5 | c7dfd49969d80b866d2643acd8891af8 |
|
BLAKE2b-256 | 619f9f8c1133a2995f1529bd0cce46a29bc267ebda2f6328291f032596660d50 |
Hashes for lief-0.12.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d746f7eb6d3bf35a0230c7184aaaf434cb1ea89d7e7c8e8fe14a49cf2bb17a0 |
|
MD5 | b418aede60d2989c5c32250244b445da |
|
BLAKE2b-256 | 1196871081178065dc8b7a20f445854696e7a3727a47d8fbe394840607d1f00e |
Hashes for lief-0.12.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a755f6088d3b2041e4402adf917ac87e5ad9d1c5278973f48a29a5631fe393eb |
|
MD5 | 8691575caa77cf3554784bca61c5b1f3 |
|
BLAKE2b-256 | d6d2f2cb3bba8c083ddc970fbba3db88f791230cdf4910a2b09d283949811947 |
Hashes for lief-0.12.1-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ec307a762505076a6d31566225a231c44ec7063c0e7d751ac4654c674454c47 |
|
MD5 | 28c6c65457281f77aef2744254c8e2f9 |
|
BLAKE2b-256 | 6679bf5bb3152c864fce526471ad7f42aa22212d8f4c38b6e762c61758a5bd74 |
Hashes for lief-0.12.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5771f5226b62c885a7aa30c1b98040d39229a1dab889d03155e5538e57d0054b |
|
MD5 | d3d045622b3cf9c39694cfde6d51173f |
|
BLAKE2b-256 | 2b221c1cdba47c56d31d970f547951d9ceafdb4642cd638651c82b7a8dfd814f |
Hashes for lief-0.12.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dab63876113bd573d64ce043f50153f6e2810e5e78256397aa0fe1fedf82ab84 |
|
MD5 | dcf6ab0b32ee03b526ffe78b4b9162b3 |
|
BLAKE2b-256 | 0e263345a8853300682d516b0048d5674a626384eaf9f5802f93feab91c9d997 |
Hashes for lief-0.12.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1292bff96579c18e01e20b7a14043052379fe6e9a476c1d6d88aca43e5f9ac7 |
|
MD5 | bc8638e8b64120e827333bb0beff8d59 |
|
BLAKE2b-256 | 153030b0eeaff8fb95f3ee9d9ba37a8cb8e1b93d001660d3704793dcc1394318 |
Hashes for lief-0.12.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a78b05cac5fa491e01e1819573bbbbcaea0a4229f4aa3a2edb231b5695ddaf2d |
|
MD5 | 73ac1a507da02d884f3a5cba077d34e0 |
|
BLAKE2b-256 | 0c34803f9428b6892a907a80880a1a0c9556257e0be7676f5d1ab2c308d8355d |
Hashes for lief-0.12.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fa6269ec4fa3f874b807fbba3c48a46af30df2497723f6966080e3eb630cb26 |
|
MD5 | e61b0fb86d2d043d47ebdd9c2c7fc04e |
|
BLAKE2b-256 | 516c44428989446fac9844a32b01d1ffac76357b5fed8891da48660946c11900 |