Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sciencemanx/ctf_import
Run basic functions from stripped binaries cross platform
https://github.com/sciencemanx/ctf_import
Last synced: 2 months ago
JSON representation
Run basic functions from stripped binaries cross platform
- Host: GitHub
- URL: https://github.com/sciencemanx/ctf_import
- Owner: sciencemanx
- Created: 2016-12-12T21:24:48.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-13T14:15:13.000Z (about 8 years ago)
- Last Synced: 2024-05-21T13:50:47.422Z (8 months ago)
- Language: C
- Homepage: van.prooyen.com/projects/#ctfimport
- Size: 10.7 KB
- Stars: 108
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-rainmana - sciencemanx/ctf_import - Run basic functions from stripped binaries cross platform (C)
README
# ctf_import
> A small library that allows you to run basic functions from stripped binaries cross platform
[Website](http://van.prooyen.com/projects/#ctfimport)
## Usage
This library is designed for you to be able to quickly call functions from a stripped binary. All you need is the file name, the function offset, and the function signature. You can get these by reverse engineering the binary in IDA or Binary Ninja.
> void *import(char *file, size_t offset)
``` c
#include "ctf_import.h"int main() {
int (* fib)(int);
// a.out is a binary with a fibonacci function at offset 0xf00
fib = (int (*)(int)) import("a.out", 0xf00);
printf("%d %d %d %d %d\n", fib(1), fib(2), fib(3), fib(4), fib(5));
}
```To compile:
``` bash
$ gcc example.c ctf_import.c -o example
$ ./example
> 1 1 2 3 5
```## Notes
Although the code will run "cross-OS", it will not run cross architecture. Additionally, this does not handle syscalls and anything that interacts with globals.