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.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9837166402248a4ef29018d498c4eccc11cbc92ee4083da046fa747d3863b43d |
|
MD5 | 210a4b48ea3c36b4fb0ff6ebf523c187 |
|
BLAKE2b-256 | ac272f04805ff42c7a74726d36c0ad6cc1bc61d858da7a41e378d0f505348cf8 |
Hashes for lief-0.11.0-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f31fde4e7174b4bc9b67ff22fd93fa15fc3faa1592ac669f3addc95d9e66168e |
|
MD5 | a5e5afd040fdc7a5e94638bb2e7c182e |
|
BLAKE2b-256 | 2dee46f9a44f5b6509970971e5f055900cdc1886707f9f6d2eb531e4b75fafc6 |
Hashes for lief-0.11.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6ff05e6ebcb9bea8833fcb558d4db3bc2a78031c4792fcac9f9612fa78258b3 |
|
MD5 | f4ff33b38a750dd334fea93ffe4b8473 |
|
BLAKE2b-256 | 423eef98b516df2812dcbe8a8e59e83d8630f22aaeb0f9a6765309985865f094 |
Hashes for lief-0.11.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afe4d15b519dd7d97732e85b7a2b11154c97a40ce517e1044b5cd5f80074ce36 |
|
MD5 | 812cf4644d685f7ee207f28b9a042814 |
|
BLAKE2b-256 | 05f7680ce66f275a16f0d82ea72cdc5be7649fae2f92dbdcc6ea50e90223b179 |
Hashes for lief-0.11.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a110bd5db41b4fde1a61094658b0366352ed4c0a00b55bde821046a59c2f913 |
|
MD5 | 43814a15ae37e3f30caf217ffaafee43 |
|
BLAKE2b-256 | 205592b028a2442e337fa2ad411db43e78727a67159f08a597720699e94e3332 |
Hashes for lief-0.11.0-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fb570712fa17ee153aca263ab1f1ec763772ccb46992e415b3dc1c0248466bc |
|
MD5 | 1d736f5be6415b98b2e73b3bea731dac |
|
BLAKE2b-256 | d4ec0ffd1f7a034b36060d4ffbdb223c734c2d26c76327d84baa27a48d35cdd3 |
Hashes for lief-0.11.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ee8f9787ea92109f19e5e4d22773042184ac524a3f11399ea5e13d974ac1f05 |
|
MD5 | 5a71c0044f6683ec1bd5f010f9e50236 |
|
BLAKE2b-256 | 259879077c890281e3553d1fb45a874761fe1e34712f47b2c2106c75e14b701a |
Hashes for lief-0.11.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8c66834a0ee9ed1899db165c09ca04aba8dee574de1ccc866d82fbf0c059bb8 |
|
MD5 | 86689f3418662843a42aa7ea171a1253 |
|
BLAKE2b-256 | 674a13a8cc1b786a448302cd902ca177610aa70f6d96f9bcdcef7ab05e55e6b9 |
Hashes for lief-0.11.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96d2a8d2310c7accaeb5c6679833c0cd8f0fb6d8c682a5df59d4d868c8881661 |
|
MD5 | 6829bd6e78a146b7fec4105e27c35848 |
|
BLAKE2b-256 | 33f8dc3501680304e798d9ea3b16fc7ea212c9e1e39182011320d0307d1218c7 |
Hashes for lief-0.11.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0a55424b3ffa08d16bf8ee6e5e9474b0a4b392ca4d94545c16e47e6366e41d4 |
|
MD5 | daff43560727567116557c0a6867f7fc |
|
BLAKE2b-256 | a05add25256aaa58c8f0d7fbc5c7f9f36dab6bcc9e25bc5171f76bc7651a2361 |
Hashes for lief-0.11.0-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cd2665ff28937755c8acedc2e3fb9de5ba752353e19b51b89297b8be3f63ccb |
|
MD5 | 647026e78d6afd3c3a103ab07a9fe93a |
|
BLAKE2b-256 | 93b0d70ee1a8f4f3a950e4832fd4ff1e117988b74eea6276cb4d87d547d88049 |
Hashes for lief-0.11.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d95cf1224c7b311b8d25dbd4de627d28717266e62b9721f1dc4c8427f929a60f |
|
MD5 | 1cce8761043467fc8adc67198a9abef2 |
|
BLAKE2b-256 | 7fd5e0c461d7a55a970c404eae50c8f568720f8a997ad7206fd5216789d076a4 |
Hashes for lief-0.11.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93d79a47db9977e6471b21d5efd4e7af4c29c76261d6583141fcf10f6ccd0eba |
|
MD5 | b1283d3f4854988a68a958721343734e |
|
BLAKE2b-256 | f9a4b9ee222cff6b9b960b3318a40bc9752e523ea6bd25baf49a505459bb8fa2 |
Hashes for lief-0.11.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77ba7dd0d48933c0b26c980bda1ab4a7ad3c7031880181fab0b94caad3bc1a4d |
|
MD5 | 0c1508ffbc8e4427db86c6359cf60250 |
|
BLAKE2b-256 | 7b4a94ae689cd085eb0ec283c9ed9fad046af26228d691ecc5757639da687c5d |
Hashes for lief-0.11.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 348ee294567826cad638b7e6cf2ede4ffe03524cd5b6038896f78e5b006d6295 |
|
MD5 | 8df57c6b315c522ddc59be2a32220e93 |
|
BLAKE2b-256 | 51b7e71d60b75532865108d88af0fce1f4fbcf4197a5edad89dd79c6b3e9786c |
Hashes for lief-0.11.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad19b9ef5c2a2552a82683bbf92ef3e986b422d552968b378195e356191aa545 |
|
MD5 | fc80ee3559a6e307c99d5bda2a66c2b0 |
|
BLAKE2b-256 | 601b884dbf3253693b85d0e03f8b4d2f7bc4ad4334465688d5112683487d9cbd |
Hashes for lief-0.11.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8774076dfbcf9b6906be4d9243de4a78fc09d317292251072d460ed1e0eeb96e |
|
MD5 | fe45ac67b1fd2f4b7c2ca7eea6bd07c4 |
|
BLAKE2b-256 | 2504d8efa671194e8c9c6491091e0a6bba8f53968db44a98c2bc3bd1cb9ff793 |