mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 18:48:08 +00:00
persistent hook example
This commit is contained in:
6
examples/qemu_persistent_hook/Makefile
Normal file
6
examples/qemu_persistent_hook/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
all:
|
||||
$(CC) -no-pie test.c -o test
|
||||
$(CC) -fPIC -shared read_into_rdi.c -o read_into_rdi.so
|
||||
|
||||
clean:
|
||||
rm -rf in out test read_into_rdi.so
|
@ -3,8 +3,7 @@
|
||||
Compile the test binary and the library:
|
||||
|
||||
```
|
||||
gcc -no-pie test.c -o test
|
||||
gcc -fPIC -shared read_into_rdi.c -o read_into_rdi.so
|
||||
make
|
||||
```
|
||||
|
||||
Fuzz with:
|
||||
|
@ -15,11 +15,11 @@ void afl_persistent_hook(struct x86_64_regs *regs,
|
||||
// of the target buffer, and the length of the input is in RSI.
|
||||
// This can be seen with a debugger, e.g. gdb (and "disass main")
|
||||
|
||||
printf("Placing input into %p\n", regs->rdi);
|
||||
printf("Placing input into 0x%lx\n", regs->rdi);
|
||||
|
||||
if (input_len > 1024) input_len = 1024;
|
||||
memcpy(g2h(regs->rdi), input_buf, input_len);
|
||||
regs->rsi = input_len;
|
||||
if (input_buf_len > 1024) input_buf_len = 1024;
|
||||
memcpy(g2h(regs->rdi), input_buf, input_buf_len);
|
||||
regs->rsi = input_buf_len;
|
||||
|
||||
#undef g2h
|
||||
#undef h2g
|
||||
|
Reference in New Issue
Block a user