https://github.com/entysec/libpawn
C library that is intended for providing methods for executing and injecting code.
https://github.com/entysec/libpawn
c-programming dll-injection elf-format elf-loader elf-parser injector loader macho-loader macho-parser pe-loader reflective-injection reflective-pe-loaders rop
Last synced: 3 months ago
JSON representation
C library that is intended for providing methods for executing and injecting code.
- Host: GitHub
- URL: https://github.com/entysec/libpawn
- Owner: EntySec
- License: mit
- Created: 2023-06-25T11:30:19.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T11:33:06.000Z (11 months ago)
- Last Synced: 2025-03-28T02:22:16.844Z (3 months ago)
- Topics: c-programming, dll-injection, elf-format, elf-loader, elf-parser, injector, loader, macho-loader, macho-parser, pe-loader, reflective-injection, reflective-pe-loaders, rop
- Language: C
- Homepage:
- Size: 146 KB
- Stars: 11
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# libpawn
[](https://entysec.com)
[](https://github.com/EntySec/libpawn)
[](https://github.com/EntySec/libpawn/forks)
[](https://github.com/EntySec/libpawn/stargazers)
[](https://www.codefactor.io/repository/github/EntySec/libpawn)C library that is intended for providing methods for executing and injecting code.
## Features
* Supports different ways of loading executable files in-memory.
* Supports most common executable file formats: `ELF`, `PE` and `Mach-O`.
* Lightweight and small library that can be ported to almost every single program.## Building libpawn
```shell
cmake -B build
cd build
make
sudo make install
```| Arch | Support |
|------|---------|
| **x64** | yes |
| **aarch64** | yes |
| **armv5l** | yes |
| **i486** | yes |
| **mips** | yes |
| **powerpc** | yes |
| **s390x** | yes |
| **armv5b** | yes |
| **mips64** | yes |
| **mipsel** | yes |
| **powerpc64le** | yes |## API usage
```c
#include
```### Mach-O
Execute main function from Mach-O bundle from buffer and pass `argv` and `env` as arguments.
```c
int pawn_exec_bundle(usigned char *bundle, size_t size, char *argv[], char *env[]);
```### ELF
Execute ELF from buffer and pass `argv` and `env` to it.
```c
int pawn_exec(unsigned char *elf, char *argv[], char *env[])
```**NOTE:** This method does not work for statically linked targets since it uses dynamic interpreter as a part of ELF loading chain.
Write ELF to the file descriptor from buffer and execute it.
```c
int pawn_exec_fd(unsigned char *elf, char *argv[], char *env[])
```### Examples
* For examples - [examples](https://github.com/EntySec/libpawn/tree/main/examples)