2017-03-30 16:56:49 +02:00
< p align = "center" >
2018-03-02 07:10:57 +01:00
< img width = "90%" src = "https://github.com/lief-project/LIEF/blob/master/.github/images/architecture.png" / > < br / >
2017-03-30 16:56:49 +02:00
< / p >
2018-05-07 09:47:00 +02:00
2017-10-15 13:02:27 +02:00
< p align = "center" >
2017-03-30 16:56:49 +02:00
< a href = "https://gitter.im/lief-project" >
2020-12-05 12:24:34 +01:00
< img src = "https://img.shields.io/gitter/room/gitterHQ/gitter.svg?style=flat-square" >
2017-03-30 16:56:49 +02:00
< / a >
2021-01-04 11:14:13 +01:00
< a href = "https://travis-ci.com/lief-project/LIEF" >
< img alt = "Linux CI status" src = "https://img.shields.io/travis/com/lief-project/LIEF/master?label=Linux%20x86-64&logo=travis" >
< / a >
< a href = "https://github.com/lief-project/LIEF/actions?query=workflow%3A%22Linux+AArch64%22" >
< img alt = "Linux AArch64 CI status" src = "https://img.shields.io/github/workflow/status/lief-project/LIEF/Linux%20AArch64/master?label=Linux%20AArch64&logo=github" >
< / a >
< a href = "https://github.com/lief-project/LIEF/actions?query=workflow%3AAndroid" >
< img alt = "Android CI status" src = "https://img.shields.io/github/workflow/status/lief-project/LIEF/Android/master?label=Android&logo=github" >
2017-04-03 18:44:00 +02:00
< / a >
2017-04-03 19:18:22 +02:00
2021-01-04 11:14:13 +01:00
< a href = "https://github.com/lief-project/LIEF/actions?query=workflow%3AmacOS" >
< img alt = "macOS CI status" src = "https://img.shields.io/github/workflow/status/lief-project/LIEF/macOS/master?label=macOS&logo=github" >
< / a >
< a href = "https://github.com/lief-project/LIEF/actions?query=workflow%3AiOS" >
< img alt = "iOS CI status" src = "https://img.shields.io/github/workflow/status/lief-project/LIEF/iOS/master?label=iOS&logo=github" >
2017-07-06 17:41:18 +02:00
< / a >
2020-12-05 12:15:37 +01:00
2017-04-03 19:18:22 +02:00
< a href = "https://ci.appveyor.com/project/Romain/lief/branch/master" >
2021-01-04 11:14:13 +01:00
< img alt = "Windows CI status" src = "https://img.shields.io/appveyor/build/Romain/LIEF/master?label=Windows&logo=appveyor" >
2017-04-03 19:18:22 +02:00
< / a >
2021-01-04 11:14:13 +01:00
2017-04-04 09:25:18 +02:00
< a href = "https://github.com/lief-project/LIEF/releases" >
2020-12-05 12:15:37 +01:00
< img src = "https://img.shields.io/github/v/release/lief-project/LIEF?style=flat-square" >
2017-04-04 09:25:18 +02:00
< / a >
2021-01-04 11:14:13 +01:00
2020-12-05 12:24:34 +01:00
< a href = "https://twitter.com/LIEF_project" >
< img alt = "Twitter Follow" src = "https://img.shields.io/twitter/follow/lief_project?color=1da1f2&label=Follow&logo=twitter&logoColor=white&style=flat-square" >
< / a >
2021-01-03 11:56:24 +01:00
2017-03-30 16:56:49 +02:00
< / p >
2018-05-08 18:22:03 +02:00
# About
2018-05-07 09:47:00 +02:00
2017-03-30 16:56:49 +02:00
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:
2018-06-29 07:00:54 +02:00
* **Parsing**: LIEF can parse ELF, PE, MachO, OAT, DEX, VDEX, ART and provides an user-friendly API to access to format internals.
2017-03-30 16:56:49 +02:00
* **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
2018-05-07 09:47:00 +02:00
# Content
2019-08-21 07:36:05 +02:00
2018-05-07 09:47:00 +02:00
- [About ](#about )
- [Download / Install ](#downloads--install )
- [Getting started ](#getting-started )
- [Documentation ](#documentation )
- [Sphinx ](https://lief.quarkslab.com/doc/stable/index.html )
- [Doxygen ](https://lief.quarkslab.com/doc/latest/doxygen/index.html )
- Tutorials:
- [Parse and manipulate formats ](https://lief.quarkslab.com/doc/latest/tutorials/01_play_with_formats.html )
- [Create a PE from scratch ](https://lief.quarkslab.com/doc/latest/tutorials/02_pe_from_scratch.html )
- [Play with ELF symbols ](https://lief.quarkslab.com/doc/latest/tutorials/03_elf_change_symbols.html )
- [ELF Hooking ](https://lief.quarkslab.com/doc/latest/tutorials/04_elf_hooking.html )
- [Infecting the plt/got ](https://lief.quarkslab.com/doc/latest/tutorials/05_elf_infect_plt_got.html )
- [PE Hooking ](https://lief.quarkslab.com/doc/latest/tutorials/06_pe_hooking.html )
- [PE Resources ](https://lief.quarkslab.com/doc/latest/tutorials/07_pe_resource.html )
- [Transforming an ELF executable into a library ](https://lief.quarkslab.com/doc/latest/tutorials/08_elf_bin2lib.html )
- [How to use frida on a non-rooted device ](https://lief.quarkslab.com/doc/latest/tutorials/09_frida_lief.html )
2018-05-08 18:22:03 +02:00
- [Android formats ](https://lief.quarkslab.com/doc/latest/tutorials/10_android_formats.html )
2018-06-27 15:26:58 +02:00
- [Mach-O modification ](https://lief.quarkslab.com/doc/latest/tutorials/11_macho_modification.html )
2019-04-18 07:15:31 +02:00
- [ELF Coredump ](https://lief.quarkslab.com/doc/latest/tutorials/12_elf_coredump.html )
2018-05-07 09:47:00 +02:00
- [Contact ](#contact )
2018-11-26 06:39:11 +01:00
- [About ](#about )
- [Authors ](#authors )
- [License ](#license )
- [Bibtex ](#bibtex )
2017-04-07 09:33:29 +02:00
2017-04-07 09:34:05 +02:00
## Downloads / Install
2017-04-07 09:33:29 +02:00
2019-11-24 19:12:00 +01:00
First, make sure to have an updated version of setuptools:
2017-10-17 16:20:36 +02:00
2019-03-31 10:15:08 +02:00
```console
2017-10-17 16:20:36 +02:00
pip install setuptools --upgrade
```
2019-03-31 10:15:08 +02:00
To install the latest **version** (release):
2017-04-07 09:33:29 +02:00
2019-03-31 10:15:08 +02:00
```console
2017-10-15 13:02:27 +02:00
pip install lief
```
2017-07-13 09:49:31 +02:00
2019-03-31 10:15:08 +02:00
To install nightlty build:
2017-07-13 09:49:31 +02:00
2019-03-31 10:15:08 +02:00
```console
2021-01-03 11:56:24 +01:00
pip install [--user] --index-url https://lief.quarkslab.com/packages lief==0.11.0.dev0
2017-10-15 13:02:27 +02:00
```
2019-08-21 07:36:05 +02:00
2017-10-15 13:02:27 +02:00
### Packages
2017-07-13 09:49:31 +02:00
< table >
2019-03-31 10:15:08 +02:00
< tr > < td colspan = "4" > < a href = "https://lief-project.github.io/packages/sdk" > < img src = "https://img.shields.io/badge/release-master-brightgreen.svg?style=default" > < / a > < / td > < / tr >
2017-07-13 09:49:31 +02:00
< tr >
< th > Linux< / th >
< th > Windows - x86< / th >
< th > Windows - x86-64< / th >
< th > OSX< / th >
< / tr >
< tr >
2019-11-25 08:17:27 +01:00
< td > < a href = "https://lief-project.github.io/packages/sdk/LIEF-0.11.0-Linux.tar.gz" > SDK< / a > < / td >
< td > < a href = "https://lief-project.github.io/packages/sdk/LIEF-0.11.0-win32.zip" > SDK< / a > < / td >
< td > < a href = "https://lief-project.github.io/packages/sdk/LIEF-0.11.0-win64.zip" > SDK< / a > < / td >
< td > < a href = "https://lief-project.github.io/packages/sdk/LIEF-0.11.0-Darwin.tar.gz" > SDK< / a > < / td >
2017-07-13 09:49:31 +02:00
< / tr >
< tr >
2019-03-31 10:15:08 +02:00
< td colspan = "4" > < p align = "center" > < a href = "https://lief-project.github.io/packages/lief" > Python< / a > < / p > < / td >
2017-07-13 09:49:31 +02:00
< / tr >
2017-10-15 08:16:15 +02:00
< / table >
< table >
2019-11-30 07:29:58 +01:00
< tr > < td colspan = "6" > < b > < img src = "https://img.shields.io/badge/release-0.10.1-brightgreen.svg?style=default" > < / b > < / td > < / tr >
2017-10-15 08:16:15 +02:00
< tr >
< th > Linux< / th >
2017-10-15 08:23:44 +02:00
< th > Windows< / th >
2017-10-15 08:16:15 +02:00
< th > OSX< / th >
2019-11-24 19:12:00 +01:00
< th > Documentation< / th >
2017-10-15 08:16:15 +02:00
< / tr >
2017-07-13 09:49:31 +02:00
< tr >
2019-11-30 07:29:58 +01:00
< td > < a href = "https://github.com/lief-project/LIEF/releases/download/0.10.1/LIEF-0.10.1-Linux.tar.gz" > SDK< / a > < / td >
2017-10-15 08:23:44 +02:00
< td >
2019-11-30 07:29:58 +01:00
< a href = "https://github.com/lief-project/LIEF/releases/download/0.10.1/LIEF-0.10.1-win32.zip" > SDK - x86< / a >
2017-10-15 08:23:44 +02:00
< br / >
2019-11-30 07:29:58 +01:00
< a href = "https://github.com/lief-project/LIEF/releases/download/0.10.1/LIEF-0.10.1-win64.zip" > SDK - x86-64< / a >
2017-10-15 08:23:44 +02:00
< / td >
2019-11-30 07:29:58 +01:00
< td > < a href = "https://github.com/lief-project/LIEF/releases/download/0.10.1/LIEF-0.10.1-Darwin.tar.gz" > SDK< / a > < / td >
2017-10-18 21:04:04 +02:00
2019-11-30 07:29:58 +01:00
< td > < a href = "https://github.com/lief-project/LIEF/releases/download/0.10.1/documentation-0.10.1.tar.gz" > Sphinx + Doxygen< / a > < / td >
2017-07-13 09:49:31 +02:00
< / tr >
< tr >
2019-11-30 07:29:58 +01:00
< td colspan = "3" > < p align = "center" > < a href = "https://github.com/lief-project/LIEF/releases/download/0.10.1/" > Python< / a > < / p > < / td >
2017-07-13 09:49:31 +02:00
< / tr >
< / table >
2019-11-24 19:12:00 +01:00
Here are guides to install or integrate LIEF:
2017-07-12 16:50:09 +02:00
2018-07-19 10:13:41 +02:00
* [Python ](https://lief.quarkslab.com/doc/latest/installation.html#python )
* [VisualStudio ](https://lief.quarkslab.com/doc/latest/installation.html#visual-studio-integration )
* [XCode ](https://lief.quarkslab.com/doc/latest/installation.html#xcode-integration )
* [CMake ](https://lief.quarkslab.com/doc/latest/installation.html#cmake-integration )
2017-07-12 16:50:09 +02:00
2017-03-30 16:56:49 +02:00
## Getting started
### Python
2019-11-25 08:17:27 +01:00
```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)
```
2017-03-30 16:56:49 +02:00
### C++
2019-11-25 08:17:27 +01:00
```cpp
#include <LIEF/LIEF.hpp>
2017-03-30 16:56:49 +02:00
2019-11-25 08:17:27 +01:00
int main(int argc, char** argv) {
2020-04-11 14:07:59 +09:00
// 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 ;
}
2017-03-30 16:56:49 +02:00
2020-04-11 14:07:59 +09:00
// 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 ;
}
2019-11-25 08:17:27 +01:00
return 0;
}
```
### C (Limited API)
```cpp
#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;
}
```
2017-03-30 16:56:49 +02:00
## Documentation
2018-06-27 15:26:58 +02:00
* [Main documentation ](https://lief.quarkslab.com/doc/latest/index.html )
* [Tutorial ](https://lief.quarkslab.com/doc/latest/tutorials/index.html )
* [API ](https://lief.quarkslab.com/doc/latest/api/index.html )
2018-06-27 16:10:41 +02:00
* [Doxygen ](https://lief.quarkslab.com/doc/latest/doxygen/index.html )
2017-03-30 16:56:49 +02:00
2017-04-28 16:36:31 +02:00
## Contact
2017-03-30 16:56:49 +02:00
* **Mail**: lief at quarkslab com
* **Gitter**: [lief-project ](https://gitter.im/lief-project )
2018-11-26 06:39:11 +01:00
## About
### Authors
2017-03-30 16:56:49 +02:00
2017-04-04 10:05:51 +02:00
Romain Thomas ([@rh0main ](https://twitter.com/rh0main )) - [Quarkslab ](https://www.quarkslab.com )
2017-03-30 16:56:49 +02:00
2018-11-26 06:39:11 +01:00
### License
2019-11-30 07:29:58 +01:00
LIEF is provided under the [Apache 2.0 license ](https://github.com/lief-project/LIEF/blob/0.10.1/LICENSE ).
2018-11-26 06:39:11 +01:00
### Bibtex
```latex
@MISC {LIEF,
author = "Romain Thomas",
title = "LIEF - Library to Instrument Executable Formats",
howpublished = "https://lief.quarkslab.com/",
month = "April",
year = "2017",
}
```
2017-04-04 09:25:18 +02:00
---------------
2017-04-03 17:46:27 +02:00
< p align = "center" >
< img width = "40%" src = "http://lief.quarkslab.com/resources/QB-big.png" / >
< / p >
2017-03-30 16:56:49 +02:00