diff options
| author | vanhauser-thc <vh@thc.org> | 2020-12-01 14:40:30 +0100 |
|---|---|---|
| committer | vanhauser-thc <vh@thc.org> | 2020-12-01 14:40:30 +0100 |
| commit | c05e4efbe9b4e7d1ff078b7a392621f2ca7572e6 (patch) | |
| tree | e005593b09169435cbad53c9990c6485e8fd9d06 /utils/afl_frida/afl-frida.h | |
| parent | 8584f9d2b5de9687c518c672e471f4f8cd9166fa (diff) | |
| download | afl++-c05e4efbe9b4e7d1ff078b7a392621f2ca7572e6.tar.gz | |
renamed examples/ to utils/
Diffstat (limited to 'utils/afl_frida/afl-frida.h')
| -rw-r--r-- | utils/afl_frida/afl-frida.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/utils/afl_frida/afl-frida.h b/utils/afl_frida/afl-frida.h new file mode 100644 index 00000000..efa3440f --- /dev/null +++ b/utils/afl_frida/afl-frida.h @@ -0,0 +1,53 @@ +extern int is_persistent; + +G_BEGIN_DECLS + +#define GUM_TYPE_FAKE_EVENT_SINK (gum_fake_event_sink_get_type()) + +G_DECLARE_FINAL_TYPE(GumFakeEventSink, gum_fake_event_sink, GUM, + FAKE_EVENT_SINK, GObject) + +struct _GumFakeEventSink { + + GObject parent; + GumEventType mask; + +}; + +GumEventSink *gum_fake_event_sink_new(void); +void gum_fake_event_sink_reset(GumFakeEventSink *self); + +G_END_DECLS + +typedef struct { + + GumAddress base_address; + guint64 code_start, code_end; + +} range_t; + +void instr_basic_block(GumStalkerIterator *iterator, GumStalkerOutput *output, + gpointer user_data); +#pragma once + +void afl_setup(void); +void afl_start_forkserver(void); +int __afl_persistent_loop(unsigned int max_cnt); + +inline static inline void afl_maybe_log(guint64 current_pc) { + + extern unsigned int afl_instr_rms; + extern uint8_t * afl_area_ptr; + + static __thread guint64 previous_pc; + + current_pc = (current_pc >> 4) ^ (current_pc << 8); + current_pc &= MAP_SIZE - 1; + + if (current_pc >= afl_instr_rms) return; + + afl_area_ptr[current_pc ^ previous_pc]++; + previous_pc = current_pc >> 1; + +} + |
