aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-07 20:44:36 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-07 20:44:36 +0100
commitaa2cb66ea23884eb03cb0220dcfafbdd7343f54d (patch)
tree94567a29d95d97000d4b420407ef58eb9a418b32 /examples
parent420b1aa85934b59ccf0b58fb9b2740418a379241 (diff)
downloadafl++-aa2cb66ea23884eb03cb0220dcfafbdd7343f54d.tar.gz
code format
Diffstat (limited to 'examples')
-rw-r--r--examples/qemu_persistent_hook/read_into_rdi.c57
-rw-r--r--examples/qemu_persistent_hook/test.c12
2 files changed, 36 insertions, 33 deletions
diff --git a/examples/qemu_persistent_hook/read_into_rdi.c b/examples/qemu_persistent_hook/read_into_rdi.c
index 4c5119e0..fd4c9000 100644
--- a/examples/qemu_persistent_hook/read_into_rdi.c
+++ b/examples/qemu_persistent_hook/read_into_rdi.c
@@ -2,35 +2,37 @@
#include <stdio.h>
#include <unistd.h>
-#define g2h(x) ((void *)((unsigned long)(x) + guest_base))
-#define h2g(x) ((uint64_t)(x) - guest_base)
+#define g2h(x) ((void*)((unsigned long)(x) + guest_base))
+#define h2g(x) ((uint64_t)(x)-guest_base)
enum {
- R_EAX = 0,
- R_ECX = 1,
- R_EDX = 2,
- R_EBX = 3,
- R_ESP = 4,
- R_EBP = 5,
- R_ESI = 6,
- R_EDI = 7,
- R_R8 = 8,
- R_R9 = 9,
- R_R10 = 10,
- R_R11 = 11,
- R_R12 = 12,
- R_R13 = 13,
- R_R14 = 14,
- R_R15 = 15,
-
- R_AL = 0,
- R_CL = 1,
- R_DL = 2,
- R_BL = 3,
- R_AH = 4,
- R_CH = 5,
- R_DH = 6,
- R_BH = 7,
+
+ R_EAX = 0,
+ R_ECX = 1,
+ R_EDX = 2,
+ R_EBX = 3,
+ R_ESP = 4,
+ R_EBP = 5,
+ R_ESI = 6,
+ R_EDI = 7,
+ R_R8 = 8,
+ R_R9 = 9,
+ R_R10 = 10,
+ R_R11 = 11,
+ R_R12 = 12,
+ R_R13 = 13,
+ R_R14 = 14,
+ R_R15 = 15,
+
+ R_AL = 0,
+ R_CL = 1,
+ R_DL = 2,
+ R_BL = 3,
+ R_AH = 4,
+ R_CH = 5,
+ R_DH = 6,
+ R_BH = 7,
+
};
void afl_persistent_hook(uint64_t* regs, uint64_t guest_base) {
@@ -40,3 +42,4 @@ void afl_persistent_hook(uint64_t* regs, uint64_t guest_base) {
printf("readed %ld bytes\n", r);
}
+
diff --git a/examples/qemu_persistent_hook/test.c b/examples/qemu_persistent_hook/test.c
index 079d2be4..83001545 100644
--- a/examples/qemu_persistent_hook/test.c
+++ b/examples/qemu_persistent_hook/test.c
@@ -6,16 +6,15 @@ int target_func(char *buf, int size) {
switch (buf[0]) {
case 1:
- if (buf[1] == '\x44') {
- puts("a");
- }
+ if (buf[1] == '\x44') { puts("a"); }
break;
case 0xff:
if (buf[2] == '\xff') {
- if (buf[1] == '\x44') {
- puts("b");
- }
+
+ if (buf[1] == '\x44') { puts("b"); }
+
}
+
break;
default: break;
@@ -32,3 +31,4 @@ int main() {
target_func(data, 1024);
}
+