about summary refs log tree commit diff
path: root/src/afl-fuzz-run.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-11-28 05:55:23 +0100
committerGitHub <noreply@github.com>2023-11-28 05:55:23 +0100
commite4f3ebcebb3031c6a70f841996a7fb03d52fe351 (patch)
treed48a4b5c0708a1a150f880eac18871a90b82b5bd /src/afl-fuzz-run.c
parent0547c49b2bcd13e234ba4fddc360702abe666ecf (diff)
parent81b43cefdfa99b14628c487dc0183a4c1a21c811 (diff)
downloadafl++-e4f3ebcebb3031c6a70f841996a7fb03d52fe351.tar.gz
Merge pull request #1915 from yangzao/dev
add custom mutator function for running script after target gets executed
Diffstat (limited to 'src/afl-fuzz-run.c')
-rw-r--r--src/afl-fuzz-run.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c
index ac4fb4a9..ae7969a6 100644
--- a/src/afl-fuzz-run.c
+++ b/src/afl-fuzz-run.c
@@ -60,6 +60,19 @@ fuzz_run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
 
   fsrv_run_result_t res = afl_fsrv_run_target(fsrv, timeout, &afl->stop_soon);
 
+  /* If post_run() function is defined in custom mutator, the function will be
+     called each time after AFL++ executes the target program. */
+  
+  if (unlikely(afl->custom_mutators_count)) {
+
+    LIST_FOREACH(&afl->custom_mutator_list, struct custom_mutator, {
+
+      if (el->afl_custom_post_run) { el->afl_custom_post_run(el->data); }
+
+    });
+
+  }
+
 #ifdef PROFILING
   clock_gettime(CLOCK_REALTIME, &spec);
   time_spent_start = (spec.tv_sec * 1000000000) + spec.tv_nsec;
@@ -1110,4 +1123,3 @@ common_fuzz_stuff(afl_state_t *afl, u8 *out_buf, u32 len) {
   return 0;
 
 }
-