C library that is intended for providing methods for executing and injecting code.
- Supports different ways of loading executable files in-memory.
- Supports most common executable file formats:
ELF
,PE
andMach-O
. - Lightweight and small library that can be ported to almost every single program.
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 |
#include <pawn.h>
Execute main function from Mach-O bundle from buffer and pass argv
and env
as arguments.
int pawn_exec_bundle(usigned char *bundle, size_t size, char *argv[], char *env[]);
Execute ELF from buffer and pass argv
and env
to it.
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.
int pawn_exec_fd(unsigned char *elf, char *argv[], char *env[])
- For examples - examples