about summary refs log tree commit diff
path: root/frida_mode/test/png/persistent/hook/load.js
diff options
context:
space:
mode:
authorWorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com>2021-06-25 22:14:27 +0100
committerGitHub <noreply@github.com>2021-06-25 23:14:27 +0200
commit6a3877dcd35d31eb79bebbc30ffe70ac0342743e (patch)
treef3ddccc0e1315a728fe5b12fdf10990f48f05298 /frida_mode/test/png/persistent/hook/load.js
parentc88b98d1c91b37c1941483980161bd46cb03c4d5 (diff)
downloadafl++-6a3877dcd35d31eb79bebbc30ffe70ac0342743e.tar.gz
Improved FRIDA mode scripting support (#994)
Co-authored-by: Your Name <you@example.com>
Diffstat (limited to 'frida_mode/test/png/persistent/hook/load.js')
-rw-r--r--frida_mode/test/png/persistent/hook/load.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/frida_mode/test/png/persistent/hook/load.js b/frida_mode/test/png/persistent/hook/load.js
new file mode 100644
index 00000000..ce4374ae
--- /dev/null
+++ b/frida_mode/test/png/persistent/hook/load.js
@@ -0,0 +1,27 @@
+Afl.print('******************');
+Afl.print('* AFL FRIDA MODE *');
+Afl.print('******************');
+Afl.print('');
+
+Afl.print(`PID: ${Process.id}`);
+
+const name = Process.enumerateModules()[0].name;
+Afl.print(`Name: ${name}`);
+
+new ModuleMap().values().forEach(m => {
+    Afl.print(`${m.base}-${m.base.add(m.size)} ${m.name}`);
+});
+
+const persistent_addr = DebugSymbol.fromName('LLVMFuzzerTestOneInput').address;
+Afl.print(`persistent_addr: ${persistent_addr}`);
+Afl.setEntryPoint(persistent_addr);
+Afl.setPersistentAddress(persistent_addr);
+
+const path = Afl.module.path;
+const dir = path.substring(0, path.lastIndexOf("/"));
+const mod = Module.load(`${dir}/frida_mode/build/hook.so`);
+const hook = mod.getExportByName('afl_persistent_hook');
+Afl.setPersistentHook(hook);
+
+Afl.print("done");
+Afl.done();