From be4e5d2617e6d994457fa2434df65f6c180d9a2f Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Fri, 1 May 2020 02:07:35 +0200 Subject: minor sample things --- unicorn_mode/samples/persistent/Makefile | 3 +++ unicorn_mode/samples/persistent/harness.c | 4 ++-- unicorn_mode/samples/persistent/persistent_target | Bin 0 -> 20048 bytes 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100755 unicorn_mode/samples/persistent/persistent_target diff --git a/unicorn_mode/samples/persistent/Makefile b/unicorn_mode/samples/persistent/Makefile index cb491e10..9c7ed7aa 100644 --- a/unicorn_mode/samples/persistent/Makefile +++ b/unicorn_mode/samples/persistent/Makefile @@ -45,3 +45,6 @@ harness: harness.o debug: harness-debug.o ${MYCC} -L${LIBDIR} harness.o ../../unicornafl/libunicornafl.a $(LDFLAGS) -o harness-debug + +fuzz: harness + ../../../afl-fuzz -m none -i sample_inputs -o out -- ./harness @@ diff --git a/unicorn_mode/samples/persistent/harness.c b/unicorn_mode/samples/persistent/harness.c index 02d96e90..3d379f46 100644 --- a/unicorn_mode/samples/persistent/harness.c +++ b/unicorn_mode/samples/persistent/harness.c @@ -151,7 +151,7 @@ static void mem_map_checked(uc_engine *uc, uint64_t addr, size_t size, uint32_t //printf("SIZE %llx, align: %llx\n", size, ALIGNMENT); uc_err err = uc_mem_map(uc, addr, size, mode); if (err != UC_ERR_OK) { - printf("Error mapping %ld bytes at 0x%lx: %s (mode: %d)\n", size, addr, uc_strerror(err), mode); + printf("Error mapping %zu bytes at 0x%llx: %s (mode: %d)\n", size, (unsigned long long) addr, uc_strerror(err), mode); exit(1); } } @@ -213,7 +213,7 @@ int main(int argc, char **argv, char **envp) { // Setup the Stack mem_map_checked(uc, STACK_ADDRESS - STACK_SIZE, STACK_SIZE, UC_PROT_READ | UC_PROT_WRITE); uint64_t stack_val = STACK_ADDRESS; - printf("%lu", stack_val); + printf("%llu", (unsigned long long) stack_val); uc_reg_write(uc, UC_X86_REG_RSP, &stack_val); // reserve some space for our input data diff --git a/unicorn_mode/samples/persistent/persistent_target b/unicorn_mode/samples/persistent/persistent_target new file mode 100755 index 00000000..83421a4f Binary files /dev/null and b/unicorn_mode/samples/persistent/persistent_target differ -- cgit 1.4.1