diff options
author | van Hauser <vh@thc.org> | 2023-11-28 05:55:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-28 05:55:23 +0100 |
commit | e4f3ebcebb3031c6a70f841996a7fb03d52fe351 (patch) | |
tree | d48a4b5c0708a1a150f880eac18871a90b82b5bd /custom_mutators/examples/custom_post_run.c | |
parent | 0547c49b2bcd13e234ba4fddc360702abe666ecf (diff) | |
parent | 81b43cefdfa99b14628c487dc0183a4c1a21c811 (diff) | |
download | afl++-e4f3ebcebb3031c6a70f841996a7fb03d52fe351.tar.gz |
Merge pull request #1915 from yangzao/dev
add custom mutator function for running script after target gets executed
Diffstat (limited to 'custom_mutators/examples/custom_post_run.c')
-rw-r--r-- | custom_mutators/examples/custom_post_run.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/custom_mutators/examples/custom_post_run.c b/custom_mutators/examples/custom_post_run.c new file mode 100644 index 00000000..828216ea --- /dev/null +++ b/custom_mutators/examples/custom_post_run.c @@ -0,0 +1,53 @@ +// +// This is an example on how to use afl_custom_post_run +// It executes custom code each time after AFL++ executes the target +// +// cc -O3 -fPIC -shared -g -o custom_post_run.so -I../../include custom_post_run.c +// cd ../.. +// afl-cc -o test-instr test-instr.c +// AFL_CUSTOM_MUTATOR_LIBRARY=custom_mutators/examples/custom_post_run.so \ +// afl-fuzz -i in -o out -- ./test-instr -f /tmp/foo +// + + +#include "afl-fuzz.h" + +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +typedef struct my_mutator { + + afl_state_t *afl; + +} my_mutator_t; + +my_mutator_t *afl_custom_init(afl_state_t *afl, unsigned int seed) { + + my_mutator_t *data = calloc(1, sizeof(my_mutator_t)); + if (!data) { + + perror("afl_custom_init alloc"); + return NULL; + + } + + data->afl = afl; + + return data; + +} + +void afl_custom_post_run(my_mutator_t *data) { + + printf("hello from afl_custom_post_run\n"); + return; +} + + +void afl_custom_deinit(my_mutator_t *data) { + + free(data); + +} \ No newline at end of file |