Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/merces/libpe
The PE library used by @merces/pev
https://github.com/merces/libpe
Last synced: 16 days ago
JSON representation
The PE library used by @merces/pev
- Host: GitHub
- URL: https://github.com/merces/libpe
- Owner: merces
- License: lgpl-3.0
- Archived: true
- Created: 2013-04-15T02:20:21.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-04-20T22:44:32.000Z (over 1 year ago)
- Last Synced: 2024-07-31T22:56:04.200Z (3 months ago)
- Language: C
- Homepage: http://pev.sf.net
- Size: 496 KB
- Stars: 115
- Watchers: 16
- Forks: 41
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libpe
:warning: libpe has moved under [@mentebinaria/readpe](https://github.com/mentebinaria/readpe). :warning:
[![LGPLv3](https://www.gnu.org/graphics/lgplv3-88x31.png)](http://www.gnu.org/licenses/lgpl.html) ![C/C++ CI](https://github.com/merces/libpe/workflows/C/C++%20CI/badge.svg)
The PE library used by [pev](https://github.com/merces/pev) - the PE file toolkit purely written in C and available to many platforms.
## Features
- Support for both 32 and 64-bits PE files.
- ssdeep support (built-in libfuzzy).
- Disassemble support (built-in libudis86).
- Imphash support.
- Crypographic digests calculation (using OpeenSSL).## How to get the source code
git clone https://github.com/merces/libpe.git
## How to build on Linux
cd libpe
make**NOTE**: You may need to install OpenSSL using your package manager. Examples:
apt install libssl-dev
yum install openssl-devel## How to build on macOS
cd libpe
CFLAGS="-I/usr/local/opt/openssl/include/" LDFLAGS="-L/usr/local/opt/openssl/lib/" make**NOTE**: You may need to install OpenSSL and PCRE via [Homebrew](http://brew.sh/):
brew update
brew install openssl## Usage example
```c
#include
#include "../include/libpe/pe.h"int main(int argc, char *argv[]) {
if (argc < 2)
return 1;pe_ctx_t ctx;
pe_err_e err = pe_load_file(&ctx, argv[1]);if (err != LIBPE_E_OK) {
pe_error_print(stderr, err);
return 1;
}err = pe_parse(&ctx);
if (err != LIBPE_E_OK) {
pe_error_print(stderr, err);
return 1;
}if (!pe_is_pe(&ctx))
return 1;printf("Entrypoint: %#llx\n", ctx.pe.entrypoint);
return 0;
}
```Compile with:
cc -o example example.c -lpe
## Troubleshooting
- **Error while loading shared libraries: libpe.so.1**
- The prefix used in libpe's makefile is `/usr/local/lib`
- If your system isn't set to look here, you can add it to `ld.so.conf`
- Alternatively, change prefix to whatever suits, ie. `/usr/lib`
- **Undefined reference to `log`**
- Linux' glibc does not define math functions, they live instead in libm
- Link against both libpe and libm to fix this (ie. `-lm`)