diff options
| author | WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> | 2021-06-24 18:46:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-24 19:46:08 +0200 |
| commit | f348a35ec6cece54796599865c683505a475fe88 (patch) | |
| tree | 38b46a34787b467a203d7432a8a3886b4123d621 /frida_mode/src/intercept.c | |
| parent | 4057134d3c6ed202d426ebdcc9aa4edf3e122bda (diff) | |
| download | afl++-f348a35ec6cece54796599865c683505a475fe88.tar.gz | |
Added JS support (#992)
* Added JS support * Added some documentation Co-authored-by: Your Name <you@example.com>
Diffstat (limited to 'frida_mode/src/intercept.c')
| -rw-r--r-- | frida_mode/src/intercept.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/frida_mode/src/intercept.c b/frida_mode/src/intercept.c new file mode 100644 index 00000000..ed8d27bd --- /dev/null +++ b/frida_mode/src/intercept.c @@ -0,0 +1,35 @@ +#include "frida-gumjs.h" + +#include "debug.h" + +#include "intercept.h" + +void intercept_hook(void *address, gpointer replacement, gpointer user_data) { + + GumInterceptor *interceptor = gum_interceptor_obtain(); + gum_interceptor_begin_transaction(interceptor); + GumReplaceReturn ret = + gum_interceptor_replace(interceptor, address, replacement, user_data); + if (ret != GUM_REPLACE_OK) { FATAL("gum_interceptor_attach: %d", ret); } + gum_interceptor_end_transaction(interceptor); + +} + +void intercept_unhook(void *address) { + + GumInterceptor *interceptor = gum_interceptor_obtain(); + + gum_interceptor_begin_transaction(interceptor); + gum_interceptor_revert(interceptor, address); + gum_interceptor_end_transaction(interceptor); + gum_interceptor_flush(interceptor); + +} + +void intercept_unhook_self(void) { + + GumInvocationContext *ctx = gum_interceptor_get_current_invocation(); + intercept_unhook(ctx->function); + +} + |
