Skip to main content

Library to instrument executable formats

Project description

About

The purpose of this project is to provide a cross platform library that 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.s3-website.fr-par.scw.cloud/latest 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

Authors

Romain Thomas @rh0main - Quarkslab


LIEF is provided under the Apache 2.0 license

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lief-0.13.2-cp311-cp311-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.11Windows x86-64

lief-0.13.2-cp311-cp311-win32.whl (2.5 MB view details)

Uploaded CPython 3.11Windows x86

lief-0.13.2-cp311-cp311-manylinux_2_24_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64

lief-0.13.2-cp311-cp311-manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.11

lief-0.13.2-cp311-cp311-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lief-0.13.2-cp311-cp311-macosx_10_14_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.11macOS 10.14+ x86-64

lief-0.13.2-cp310-cp310-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.10Windows x86-64

lief-0.13.2-cp310-cp310-win32.whl (2.5 MB view details)

Uploaded CPython 3.10Windows x86

lief-0.13.2-cp310-cp310-manylinux_2_24_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64

lief-0.13.2-cp310-cp310-manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.10

lief-0.13.2-cp310-cp310-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lief-0.13.2-cp310-cp310-macosx_10_14_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.10macOS 10.14+ x86-64

lief-0.13.2-cp39-cp39-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.9Windows x86-64

lief-0.13.2-cp39-cp39-win32.whl (2.5 MB view details)

Uploaded CPython 3.9Windows x86

lief-0.13.2-cp39-cp39-manylinux_2_24_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64

lief-0.13.2-cp39-cp39-manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.9

lief-0.13.2-cp39-cp39-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lief-0.13.2-cp39-cp39-macosx_10_14_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

lief-0.13.2-cp38-cp38-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.8Windows x86-64

lief-0.13.2-cp38-cp38-win32.whl (2.5 MB view details)

Uploaded CPython 3.8Windows x86

lief-0.13.2-cp38-cp38-manylinux_2_24_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.24+ x86-64

lief-0.13.2-cp38-cp38-manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.8

lief-0.13.2-cp38-cp38-macosx_10_14_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

File details

Details for the file lief-0.13.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lief-0.13.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eccb248ffb598e410fd2ef7c1f171a3cde57a40c9bb8c4fa15d8e7b90eb4eb2d
MD5 e16892f5e33fad86200278ba8e835e1f
BLAKE2b-256 82951de9a497946fed9d15f847d8a4a0630dfda6d186c044f8731f53d0d3d758

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp311-cp311-win32.whl.

File metadata

  • Download URL: lief-0.13.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 1ce289b6ab3cf4be654270007e8a2c0d2e42116180418c29d3ce83762955de63
MD5 b1769533a9b8327359e84f435c83d3a8
BLAKE2b-256 d906ddacd724f65fa8e7eca438c335aa77878a260fbc714cdba252387c33a4cc

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp311-cp311-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp311-cp311-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 042ad2105a136b11a7494b9af8178468e8cb32b8fa2a0a55cb659a5605aeb069
MD5 aa93f98672cedfa4393331f224c7e81b
BLAKE2b-256 6bbdea25e9c8ff0a55b5534e5881fa6e5eeca0ed3eeb7c772a276984b8c182d9

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 11ab900e0644b6735ecdef2bbd04439b4866a527650fc054470c195d6cfe2917
MD5 ea441a156a750380b89c2b05702fe46e
BLAKE2b-256 d68db50cc4ad91278015e5ac18fc76f32098ed6887c371bef6f4997af4cb97c9

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ce2e3f7c791efba327c2bb3499dbef81e682027109045a9bae696c62e2aeeb0
MD5 78cca126a96d93732883c5288a30b27b
BLAKE2b-256 002b7ac8e15ca198a5c50397aec32102e81ef97fd573a4285ee889ec9084d110

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp311-cp311-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 6570dacebe107ad60c2ba0968d1a865d316009d43cc85af3719d3eeb0911abf3
MD5 4890bdc8824be61f8e3ceb68450cc0ac
BLAKE2b-256 2e959d7377095fb7cf195aca8f64d9696705c71884dcba16663472ce17139b9c

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: lief-0.13.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 01d4075bbc3541e9dd3ef008045fa1eb128294a0c5b0c1f69ce60d8948d248c7
MD5 8309a99f81a85a431bb91001d5f634cc
BLAKE2b-256 ed1434a12787dc4328227e0e84a97db8142aa1e2b33e0aabc538e93abf7d6e5a

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp310-cp310-win32.whl.

File metadata

  • Download URL: lief-0.13.2-cp310-cp310-win32.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 bc041b28b94139843a33c014e355822a9276b35f3c5ae10d82da56bf572f8222
MD5 f9e90c9b54a29ca32b2cd37e420dda04
BLAKE2b-256 2c2aabac2e42c3cc56f2b5020e58b99f700c4d3236d49451607add0f628d737b

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp310-cp310-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d344d37334c2b488dc02f04cb13c22cd61aa065eeb9bca7424588e0c8c23bdfb
MD5 89eb6516a082334084be30817b389669
BLAKE2b-256 0d1bf4bf63bfce187ae210980bdd1a20ea7d8e080381eef09e7d26c585eaa614

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dbbf2fb3d7807e815f345c77e287da162e081100f059ec03005995befc295d7f
MD5 0611e80ab37043a64ae08abffecc8848
BLAKE2b-256 d7cc9895dff094cad3e88636195640b4b47caefe3d300d3f37b653bd109348df

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5581bf0072c1e7a9ea2fb2e2252b8582016e8b298804b5461e552b402c9cd4e9
MD5 608bfbfcc5572733055dfdd52b63bc75
BLAKE2b-256 5fd672235d648c6630c37ef52b9f6f4e2f3337842bc4b08c75abcae3052b2c17

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 0390cfaaf0e9aed46bebf26f00f34852768f76bc7f90abf7ceb384566200e5f5
MD5 86c4439ac75d02309d089d0a43b97e18
BLAKE2b-256 d7e2c4125c279eb2a23ecc86cdb188ed06e9d81a9c700e9412f9be866afc2c7d

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: lief-0.13.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2bbe294385e629aa7206b2f39f0ca34e3948605a8db50b22091603053889a759
MD5 2f333c60067d3b3e21d91f46e61d1710
BLAKE2b-256 9914ec12d03146b1b60068589e897839bd9481d8e74bce169ffe19def83b7d5b

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp39-cp39-win32.whl.

File metadata

  • Download URL: lief-0.13.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 3f8f251de874929d9c9e94a35891621ab8c059149f8a1c24e543fd9cf0c2a31c
MD5 da0a75057f53bfba70d6f3ad1ae7035a
BLAKE2b-256 44a3241161396501ace97bebf8a331e945064129b87f9a1a02adec8cc3c458ce

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp39-cp39-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e0f84a7443b7f1b02666fd16a9aa57f5d9027e60ba2885e0d76db8426d689707
MD5 1dcf66fd0a7f20e64da3b0ca1a425e2d
BLAKE2b-256 5f2c95db4ed3efa9f1e89e7fb845347d973ce0a6ddff5ce0dd7dbe29e89af9c5

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c60f2f79e7d0d1f18dec7dcdb4d4f35e6b126ac29e2f2f056d28ec50599d868a
MD5 d811db8641ca20aae2ea06ca8cc75b46
BLAKE2b-256 15b4ce968e3bea21d2d0e753dad340d4d784a18bbddf33f976ee116aa3515d14

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8703cb5308b4828563badc6885ff07a3926ec3403d1caa3aa75f24fe9cbcf84
MD5 1f329c92abc8e910b47c89baa3687a5f
BLAKE2b-256 be8bb99e8c5c671a969f1842c58b1659ff375c9083f479a3ca13f43afca907a0

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 eca8ecbcae1ad851ed7cf1e22ec8accd74f2267fa7375194559fb917523d8a92
MD5 dd365c9662a79a357cf3dff96accbc65
BLAKE2b-256 abc59a8c2695a854045095753d7fff749f3c4cb5a120581b50a4a1a95de680d2

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: lief-0.13.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 36c5bea3f8460dee3ebb75d35949f445638ec85d2871f31e293c47fb4a0a5af7
MD5 de86549715f82fc86820feae69f247f6
BLAKE2b-256 f9456921c604f957b0b4910f799ca9f70ae7e07117b89b115997d0ad734fdb95

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp38-cp38-win32.whl.

File metadata

  • Download URL: lief-0.13.2-cp38-cp38-win32.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for lief-0.13.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 03db0138e4dbbdfa8bba74de312b0cebb30f504e44f38a9c8918b84022da340b
MD5 c477f24290d8d1e5d9d2fb7954afbdae
BLAKE2b-256 9ad7686fa63f54b10029d3c01f066193a7d87e9568df68e58b2b7b20a8057fba

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp38-cp38-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 b99092f02c13f580c2d00b504af224b7e60e7c98a791e72ae8519f530b7687bb
MD5 5ff1bb5bec68413295879b1c29e0a171
BLAKE2b-256 b8f6e6f49bebbd33d21a5b0d514a632787083e173da9b7b9793a47720d0c111e

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8da75df0ea472557fcc37a27ba583bad5a8f3a256c186600d00a6dd0a57f718a
MD5 4fdeab0697bebaab679e68996df1ceb6
BLAKE2b-256 d6bf70a2233d28347a4eec817a1f0f57aab0cf95f05df3aad51a44b15f9e3533

See more details on using hashes here.

File details

Details for the file lief-0.13.2-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for lief-0.13.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 95731cadedd6ffc5fb48c147fcefe004624e436b75e8ee9fb2dbf2ae5f084342
MD5 63b1db3daf9a5df0967de40f1b1bd0dd
BLAKE2b-256 4cda83fdde6768284e6533372255dd1ace3490ef31abe6df3f38016c28580d45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page