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.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 612537ca5b93e16f03994730b9dcc24c801b8f28bf15e480995ce821e6722114 |
|
MD5 | 4f1e2a2d5e5d58413e1b0d14ca6ba03f |
|
BLAKE2b-256 | aa4150aa0d8576c2a224cb564d98aca4f52a061ba92b970bb49b705a79c2d334 |
Hashes for lief-0.11.1-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ff9452d879a4e0ee3b6da7781ddc2660bfa025246f6c0bcdd96b4d22ca48d30 |
|
MD5 | e6250b9be20fe5f45bf16250c09f64c6 |
|
BLAKE2b-256 | 5bdddd953c67c37c731907870cbe5cb7d17c185e4bad4f8838714f6fb339f0a3 |
Hashes for lief-0.11.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 382999f8e6d2e883c04cea5ab2336fdea30c0baf8a4804f4c32b643f036cfa4a |
|
MD5 | b7a5a3106bfed4ca91c6f08e27a4970a |
|
BLAKE2b-256 | 4ca1d22548485fd32267b8050840bc11e769abd41e47e837bcfd9990fbd20931 |
Hashes for lief-0.11.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9bf7ec8f354d1c4ab29967edc9025cb370af35488bebbd624fcb143c287f819 |
|
MD5 | 3444f4f5b96cc6023b6310094750ba67 |
|
BLAKE2b-256 | 94090f8eff2bbf7bb362fa73182904a3f2d51ddced7c756869e5f4a8f5da85d3 |
Hashes for lief-0.11.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91a6e91264f47ec16f14e91de77cb1d058fdc52a002000a62bcf399b0bd8429 |
|
MD5 | 6a2e1d6087d63c5f1479d06e8a6cdfe2 |
|
BLAKE2b-256 | 382d1b7c9d60c91d2e81b3d59ed644877b35f1ab2ab51b88c6fbc47c14fb2ed0 |
Hashes for lief-0.11.1-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b367df9c06f71756014e8a7a697b42baeb83e0636c6f562ad576294c555ee3a |
|
MD5 | bc6226a7ecc06a513050c768bd38f7fd |
|
BLAKE2b-256 | 26b74374c65dc1fae8939887c300f4ea89c1719c8ba0694028750fda1c0475d9 |
Hashes for lief-0.11.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b780cdeb2806bad393b2a4b4a25f02ad9213e8ff152c7b98c1a5ce4f3066280a |
|
MD5 | cc1b1cc1adf431194883ef48fc8abf22 |
|
BLAKE2b-256 | 2bb25e543ad79780956cf4996013570ff27273a647c775e9c1568a4d95b24aaa |
Hashes for lief-0.11.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4c94061bb813ba1c9f2a6209a7b06f860f803b4a420f28d84d1e7086a32d67 |
|
MD5 | 668598341b335e89a384ce2c7a5fc6ed |
|
BLAKE2b-256 | 741a3b391dced8651fc95ca5ae99fa3fbca0e5492f8e485ce370b556f1eb87b0 |
Hashes for lief-0.11.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0aee4578b04e70f81b72b0ac18449a8d22ed074dd8b44eda1d61a10a9c60278 |
|
MD5 | a2c8841280a8253e3b1dd0760efd8961 |
|
BLAKE2b-256 | 20ebce1b83d52d3bcd8c42acecf88288aadbba633b086432addc09003da53f0b |
Hashes for lief-0.11.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aa9b27bc533ac1415ab2367bc4b04fad5d23f5e23c150b557858c0ed78baa71 |
|
MD5 | 3a436d5ab050f3b5e144e90c27f68059 |
|
BLAKE2b-256 | 9e21bf9940126f41cbc097fe36298fad7b15efa8867e5e828c65e711b02c5fc5 |
Hashes for lief-0.11.1-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d75bb2da003ade64e121b8389fc67bdd5e5da5be9226a6c7905ffd857f1bb735 |
|
MD5 | 5153df0fb0f182cbb50616129eaf4ffd |
|
BLAKE2b-256 | f6473162c605076708c176653133864d1de2a8350abfb170a4b44dcbfb42ae58 |
Hashes for lief-0.11.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ece6323a72840d0821e523223bbb87f60213edb43eadd8cb75a18e7bbe68061 |
|
MD5 | c34b0b75c63ccf76acc7310d168ba486 |
|
BLAKE2b-256 | ecfe45c048e8e0e8d4f5ccc5838d4f6a1c763831f8c4e11dfb655c4ebebe0c59 |
Hashes for lief-0.11.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f944026a032b98081911b1f0ea0e922760a74882ef79c4227344b4edb2ccd47 |
|
MD5 | 09cf20f31b2c5ec8f060b4545d485d11 |
|
BLAKE2b-256 | 42fe02dec119ba4275343dfd3164faf7dfd72f1f4ab59eaf7030d813447c2bf2 |
Hashes for lief-0.11.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 419b6fd58d153164473ff23574fdb1d4e54c98ca9a7c7e21cb124807a930a314 |
|
MD5 | 65efb9821719368d7373810f12d7ce3d |
|
BLAKE2b-256 | c295671dea20c1baad0071403cf1142c1a34c6bd33bc4946296fec3988719087 |
Hashes for lief-0.11.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c772f5c660d53f1ba119dab730b7719187b6a943b39ccc8a6980a36f16794bdb |
|
MD5 | 61f1b2ba7050b92dd040f1b807a57624 |
|
BLAKE2b-256 | 7d2bdb1679b1af1d77e5dcd835c047e50be0b52cf1b9a70ae9b7aad4166ca24b |
Hashes for lief-0.11.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f26839c846e21d41b99d7e60f88115a704850745343c4f9547545143d726632 |
|
MD5 | 35933c77c93c44d220c268fbca5c518a |
|
BLAKE2b-256 | ee4b10a483beb6dbe0051a248f226739b55691f86d2031aa9ea4f67fe9673800 |
Hashes for lief-0.11.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b6e87fb0fb43b88731d07f1ce18a2ecb7db77a2eaef6a7c74257230f100194c |
|
MD5 | 9a016e53f700e92dbd804aaaf16df67f |
|
BLAKE2b-256 | 77aca0c59199b01a25891183839c8051c5322b3c7e41ae48227a76393d2846ac |