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

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

lief-0.13.1-cp311-cp311-manylinux_2_24_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64

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

Uploaded CPython 3.11

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.14+ x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

lief-0.13.1-cp310-cp310-manylinux_2_24_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64

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

Uploaded CPython 3.10

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 10.14+ x86-64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9Windows x86

lief-0.13.1-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.1-cp39-cp39-manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Uploaded CPython 3.9macOS 10.14+ x86-64

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

Uploaded CPython 3.8Windows x86-64

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

Uploaded CPython 3.8Windows x86

lief-0.13.1-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.1-cp38-cp38-manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.8

lief-0.13.1-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.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lief-0.13.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bfbf8885a3643ea9aaf663d039f50ca58b228886c3fe412725b22851aeda3b77
MD5 481df43ce38ff885f6fc8e4fb4efb47d
BLAKE2b-256 98213f171094d795467f15263b13d8185765ee6ab742ecf26948f2584781aa65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lief-0.13.1-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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 018b542f09fe2305e1585a3e63a7e5132927b835062b456e5c8c571db7784d1e
MD5 5a4cce38082f32c0d543206025b646c9
BLAKE2b-256 aa3d714787e6e8c257b8587808dc16c6882a8fc6e953e200ead8d4b7ca19748b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp311-cp311-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 aa7f45c5125be80a513624d3a5f6bd50751c2edc6de5357fde218580111c8535
MD5 c21e31c59f71523cce44dac491f288e2
BLAKE2b-256 469c2d4b4d9ae712c2ac6a04255d036457bd86caa7695a3708303f9f75c4e696

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 23617d96d162081f8bf315d9b0494845891f8d0f04ad60991b83367ee9e261aa
MD5 a04a3eea141404a80836b462031a4386
BLAKE2b-256 7c35c2d96772c7bf03ef0d8b53574b0af953334570e7421a8375a1fdc497c4c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 661abaa48bc032b9a7529e0b73d2ced3e4a1f13381592f6b9e940750b07a5ac2
MD5 fbd53d202d5761d976fc336249fc7920
BLAKE2b-256 14e86e7ddf39e8458b38964aea47e6e29b0ee6f580c9cf473109cf5254c8ce20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3cfbc6c50f9e3a8015cd5ee88dfe83f423562c025439143bbd5c086a3f9fe599
MD5 d48b10ec86539ed6720ab73938b0da55
BLAKE2b-256 c051401f9e8786b0d4780a0f35017b2e9002d6c60b82b6fb7bd89d245daeda96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lief-0.13.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8439805a389cc67b6d4ea7d757a3211f22298edce53c5b064fdf8bf05fabba54
MD5 ac2c76c24917aa0015e091c7ef24f16a
BLAKE2b-256 f98f04bd0374f379212cccb2a2c9b33b48e25c4f0eb3611d2a163fce1980819f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lief-0.13.1-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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 b1f295dbb57094443926ac6051bee9a1945d92344f470da1cb506060eb2f91ac
MD5 48020c791113ba7f1fa14dc0bc1b2c85
BLAKE2b-256 9ca31b1b4c49672fd8f81ee5d4eaa3e288a6bc2683a3d6c5dd8534c451c33511

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 c6839df875e912edd3fc553ab5d1b916527adee9c57ba85c69314a93f7ba2e15
MD5 4392ce778661537262a9924838e0ab33
BLAKE2b-256 96416eeb729a80c91edbd037dc3d7fa0eeb8eef7422b8dd5d842d9b457937ab9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be871116faa698b6d9da76b0caec2ec5b7e7b8781cfb3a4ac0c4e348fb37ab49
MD5 575b7749c0bfd575a45a67623d541664
BLAKE2b-256 0ec3f4c9887e716bb8511bac686d9ceff71bb06518d1b0fb629cf53eac95c478

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb8b285a6c670df590c36fc0c19b9d2e32b99f17e57afa29bb3052f1d55aa50f
MD5 ed3bb935a2656823f0366f05e7b43668
BLAKE2b-256 17a0a0d7763794f4cd239913ad793355e580026cade81f11718f7166f372797b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 b53317d78f8b7528e3f2f358b3f9334a1a84fae88c5aec1a3b7717ed31bfb066
MD5 3bcfc5943cf64b73a7d883b55d6c52f6
BLAKE2b-256 57de52dc2dde93e3365574c887da9f000c43cf766f7dc13bc16b5b450d2d71cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lief-0.13.1-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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a3c900f49c3d3135c728faeb386d13310bb3511eb2d4e1c9b109b48ae2658361
MD5 f39b1cd7b1b5e33ce68e60131d1139ab
BLAKE2b-256 1ba4e3f76e09f9060f091f852abd0a94c7754a2281afcd3c04d46fa6339b116c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lief-0.13.1-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.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 57bdb0471760c4ff520f5e5d005e503cc7ea3ebe22df307bb579a1a561b8c4e9
MD5 cda8833ee8b994e7ba53102452c65164
BLAKE2b-256 5df9b59bb3a42a54272061ae1aacf4387882759c1bbf3378389048aa2a09d146

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 965fadb1301d1a81f16067e4fa743d2be3f6aa71391a83b752ff811ec74b0766
MD5 66bb616826e4f603cfd6a4d397814881
BLAKE2b-256 7a6420c0d8380081fe15d30d0c512e1c9167d02627ba9839bce1bd0ebf2493a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 16753bd72b1e3932d94d088a93b64e08c1f6c8bce1b064b47fe66ed73d9562b2
MD5 7ffd5e4b86567188e3214d742d138c74
BLAKE2b-256 4e8cdef1e9cb5577e2f40c22d22c583e6c153cdd6f430bd45af53d1a0ef4be35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95a4b6d1f8dba9360aecf7542e54ce5eb02c0e88f2d827b5445594d5d51109f5
MD5 925750fdbb40b10410417668752dcc26
BLAKE2b-256 1ed2b6742029cf4e792f2728b954f04c1654accdd9a25291ddbe4bddb1777084

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 0283a4c749afe58be8e21cdd9be79c657c51ca9b8346f75f4b97349b1f022851
MD5 378925fd4ee365fea5c552c08bd0d4dd
BLAKE2b-256 5218f9dbc9e53b18e3b1c63b9d5c84dea939bd1cefed7d0391115bb85712315d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lief-0.13.1-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.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 04c87039d1e68ebc467f83136179626403547dd1ce851541345f8ca0b1fe6c5b
MD5 f5aef8b4f7b13235f82530d5a00ee14d
BLAKE2b-256 c4a4ef2ba9bc339008fcd8998cdc66a736147fd2bcf4d00a913e666b50550844

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lief-0.13.1-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.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 a18fee5cf69adf9d5ee977778ccd46c39c450960f806231b26b69011f81bc712
MD5 ed5e143ed9cea6680c65bc3f46b92872
BLAKE2b-256 6ee1282d43f4927e315e95d8f05fe2ccd9af3c2b7c8cf9dabaf16014c542db36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e414d6c23f26053f4824d080885ab1b75482122796cba7d09cbf157900646289
MD5 10f38aae21a2557cd465a40cae7ff79d
BLAKE2b-256 1251253e6ffd54f4e34702f77363a32efb4daed0a4d0da020637c6fd97dcf4cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ccfba33c02f21d4ede26ab85eb6539a00e74e236569c13dcbab2e157b73673c4
MD5 b2f40a8868fa82da36f3953b2595d498
BLAKE2b-256 f55c1ac618af76e7fcda0488dbdc2c76b779a8876abce547494627c822e470cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lief-0.13.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a0472636ab15b9afecf8b5d55966912af8cb4de2f05b98fc05c87d51880d0208
MD5 4fc78a65f4e52cea3de26c6ba103c140
BLAKE2b-256 b0d17e5aad0daabe675dd865508860e265bd63d93670163218b1df77138c844d

See more details on using hashes here.

Supported by

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