about summary refs log tree commit diff
path: root/frida_mode/test/js/patch.js
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-07-19 10:48:41 +0200
committervanhauser-thc <vh@thc.org>2021-07-19 10:48:41 +0200
commitcc57cc5f463e9b79980c2087d19b4a1e1360ec52 (patch)
tree69a89651deefc660b481e9c964f4cb97ab9073b6 /frida_mode/test/js/patch.js
parent3d1cc8ec57f0bf07d7834b652ec2db24e7914624 (diff)
parentc55f7af65700e3d11c368072d39ba6670efa477b (diff)
downloadafl++-cc57cc5f463e9b79980c2087d19b4a1e1360ec52.tar.gz
fix merge conflicts
Diffstat (limited to 'frida_mode/test/js/patch.js')
-rw-r--r--frida_mode/test/js/patch.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/frida_mode/test/js/patch.js b/frida_mode/test/js/patch.js
new file mode 100644
index 00000000..485a434f
--- /dev/null
+++ b/frida_mode/test/js/patch.js
@@ -0,0 +1,34 @@
+Afl.print('******************');
+Afl.print('* AFL FRIDA MODE *');
+Afl.print('******************');
+Afl.print('');
+
+const main = DebugSymbol.fromName('main').address;
+Afl.print(`main: ${main}`);
+Afl.setEntryPoint(main);
+Afl.setPersistentAddress(main);
+Afl.setPersistentCount(10000000);
+
+const crc32_check = DebugSymbol.fromName('crc32_check').address;
+const crc32_replacement = new NativeCallback(
+    (buf, len) => {
+        Afl.print(`len: ${len}`);
+        if (len < 4) {
+            return 0;
+        }
+
+        return 1;
+    },
+    'int',
+    ['pointer', 'int']);
+Interceptor.replace(crc32_check, crc32_replacement);
+
+const some_boring_bug = DebugSymbol.fromName('some_boring_bug').address
+const boring_replacement = new NativeCallback(
+    (c) => { },
+    'void',
+    ['char']);
+Interceptor.replace(some_boring_bug, boring_replacement);
+
+Afl.done();
+Afl.print("done");