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.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b175e688f51500332fb726c72b237d081ba905f0ee7290d80cc7d1cbf86c93ff |
|
MD5 | b450cb4df29f68a0a280eb3262901205 |
|
BLAKE2b-256 | 72d3a130eb7b6f93668233a734eb007cf5ee83a8149bfa4519e1c25614543381 |
Hashes for lief-0.11.4-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f864c1dd918c49611779eb1f487d74bc97613a0690ce7c17a18949fc7dc5e79e |
|
MD5 | 8726aa80e0ed61b244cb582a934ccb78 |
|
BLAKE2b-256 | b788620f54d5cca238dedae989b351044cff80c28ae869c02f4556ed9d866b48 |
Hashes for lief-0.11.4-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5266c387eec479663bab503d095c0c5ce1b13e69a81167cd6898215d07e001dc |
|
MD5 | 0bc45b8ec7555354fd03850e80568f31 |
|
BLAKE2b-256 | 2cbd2a224ecdf3483b82d2fb7293f6f1e6392201c16912caaf1080b2c6da2484 |
Hashes for lief-0.11.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d38beaeef0832826d0b92afea467820005824bf0ec4c9c431557a9ed003c356e |
|
MD5 | 5065551249ffd9f7d3ad3a77d243b25d |
|
BLAKE2b-256 | 1dfa6dfddd0bfb6166ec027aab7f27302385e020ed4a0250d68fd16f20729b90 |
Hashes for lief-0.11.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 254e391d1f640cb89c8a4ce3ebdbfe239bc615e50931e226cbca64b22a63d3e9 |
|
MD5 | ec30f98b40c6ddcf7158660ac95cef5f |
|
BLAKE2b-256 | 397ad213c0147c4bcf7dc99b113dbafa586ceef4d84e86a58448ec338e368eeb |
Hashes for lief-0.11.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42072d75b61e5314a1223d9afe666b6a62cf030fd494fe90a55d8baf8343204 |
|
MD5 | a7978321d146d3fb36af0437cda62b31 |
|
BLAKE2b-256 | 507113ca1f8e48d343263cc887e0921360b9b967b07d15eafc982a028542d1c0 |
Hashes for lief-0.11.4-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 599e8519398af84e1204791044f442b2d469ccc02196905cab8e378ee4d6da4d |
|
MD5 | 00a95fc9eee23161976fa9c84224cf73 |
|
BLAKE2b-256 | 7dc5c91c860be8ef9bdcfd6cdc01190743c370e6edd24fdee28468b01b7f7720 |
Hashes for lief-0.11.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9abefaa0c2916bb7b15712dd2a85cc2d91beb5c380b819fe2b22156eb5b98546 |
|
MD5 | d7cdb2b7e34813ed65e21dca8736a195 |
|
BLAKE2b-256 | cc0f1cc77d4c3bc3fae038aa66e2ec78bdca1343e531b432f1299b551c9be05d |
Hashes for lief-0.11.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1998784f8475259b71c1f3c78086829724f88da518897a19bcec3c9765581a3 |
|
MD5 | e7a9481615b34180d6b7e3c709584780 |
|
BLAKE2b-256 | 66d1a5f06bd6b919d045af4061134011a107f822621fe26b4a26459cacf82e2d |
Hashes for lief-0.11.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ca9e60eb55f4fa7fcd4e526273f56ef94d10995b50a681a1bba714098e9bccc |
|
MD5 | cc2f6568196c6dd02df0896c0b82f5c6 |
|
BLAKE2b-256 | f02ddc3a534478a38d9393cc4bef5cba2ecabe85674fa5421bd711cc4d8b36be |
Hashes for lief-0.11.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 626bf3a31644e5790736cebfc366f3227ed76979e3e6e47c68365bd47e73d76a |
|
MD5 | c36e3983c9db5f94d7c0d464195a3304 |
|
BLAKE2b-256 | 0858a85c65cc5ac9c1be5196702b4f440a84e816b1d5b0cfaf47aa1faa117733 |
Hashes for lief-0.11.4-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 846da4389a258f5525a147c7d29867ce0af59e1d81923f8dbed1ed83599f589f |
|
MD5 | 281ca1011dece795c6e62b7701642e8d |
|
BLAKE2b-256 | f11085d5a5ca004dab07ac7da3b81117d78a9c5baa4889f0b98e4b6170a0eb5d |
Hashes for lief-0.11.4-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e469daed11efbd989f56afd0167ae391bdd0de9984ad274679f1da3a5ec60494 |
|
MD5 | 29db75df2fd9857aa2a095d3751bb296 |
|
BLAKE2b-256 | d5c03dec39ab9ebef5f90350a077372890439d2c677cf79d3a2dd33f45be22dd |
Hashes for lief-0.11.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74a4822f1883d6d7f230856422e700176c4ba67792dce9b013a956e70947c83f |
|
MD5 | 3617de4edf6d304e4eb42378bc0ffa6f |
|
BLAKE2b-256 | a7cb1b69d04b05d54821dfbad66ceccdb980ec853c29cb5ccd3425d4e0ffe583 |
Hashes for lief-0.11.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9c8f704198610bb06e3a56bc8fa4ba91cfba6606964027277c81baee245601b |
|
MD5 | 1dbe13990c504a3bf53ecefe7ab13181 |
|
BLAKE2b-256 | 0f33f735f523dada975833fb783fa32fe6fe5aa5824751c347f6d4f71e830f20 |
Hashes for lief-0.11.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59df04a2bf46c021772148086ff5eedf736c885e3b522f05024a2539feec6174 |
|
MD5 | d8734f025d0d1263d5afdd86393a2318 |
|
BLAKE2b-256 | f1ea57dd13d52453aa64ebb49241397e57f4da08d5fe2ebeb63a59a56cbbc8c4 |
Hashes for lief-0.11.4-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2092703329ed5a2dc5111300469346528e7db2a31c72767dc48c50474087dc83 |
|
MD5 | db341afcd32d2ab22e284c56b99ad0f7 |
|
BLAKE2b-256 | 1c9291fa55135a53038c4b560ccdfe2d354c4492f0d7588dad7af27a50fdeeca |
Hashes for lief-0.11.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6d2f59723819aac71cfdf3be898d83d9d9c33c02489125eee5ff40aa4177be6 |
|
MD5 | fc7faa60efd36112171b0d0a760189a1 |
|
BLAKE2b-256 | 939b5450a9b496685a9a5476fb5541e38468b9c9c2f66b4ea4dffe0419354413 |
Hashes for lief-0.11.4-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 560cca9dc490d0bee84aca30533f7c7ac9e874060bbc9bdbc6f64da63e4e351a |
|
MD5 | 04b214ed4d999c3e5240d59c33e40d40 |
|
BLAKE2b-256 | 6ba1f679f402971da3c810108b3bfd793ccc14cfe74f85306c087c70ab2fcb66 |