diff options
author | Andrea Fioraldi <andreafioraldi@gmail.com> | 2020-02-03 13:11:10 +0100 |
---|---|---|
committer | Andrea Fioraldi <andreafioraldi@gmail.com> | 2020-02-03 13:11:10 +0100 |
commit | 2fe7889912c9bb340f302a037585b7b1836ac94f (patch) | |
tree | 5c3e4e5829f45dce46794ebc2681732738d689fe /custom_mutators | |
parent | e2eedefc65bec1a04605f117a11ca8bdf9d80323 (diff) | |
download | afl++-2fe7889912c9bb340f302a037585b7b1836ac94f.tar.gz |
move custom and pythoon mutators examples into examples/
Diffstat (limited to 'custom_mutators')
-rw-r--r-- | custom_mutators/README | 2 | ||||
-rw-r--r-- | custom_mutators/simple_mutator.c | 49 |
2 files changed, 0 insertions, 51 deletions
diff --git a/custom_mutators/README b/custom_mutators/README deleted file mode 100644 index e83baa67..00000000 --- a/custom_mutators/README +++ /dev/null @@ -1,2 +0,0 @@ -This is a simple example for the AFL_CUSTOM_MUTATOR_LIBRARY feature. -For more information see docs/custom_mutator.txt diff --git a/custom_mutators/simple_mutator.c b/custom_mutators/simple_mutator.c deleted file mode 100644 index bf655679..00000000 --- a/custom_mutators/simple_mutator.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - Simple Custom Mutator for AFL - - Written by Khaled Yakdan <yakdan@code-intelligence.de> - - This a simple mutator that assumes that the generates messages starting with - one of the three strings GET, PUT, or DEL followed by a payload. The mutator - randomly selects a commend and mutates the payload of the seed provided as - input. -*/ - -#include <stdint.h> -#include <stdlib.h> -#include <string.h> - -static const char *commands[] = { - - "GET", - "PUT", - "DEL", - -}; - -static size_t data_size = 100; - -size_t afl_custom_mutator(uint8_t *data, size_t size, uint8_t *mutated_out, - size_t max_size, unsigned int seed) { - - // Seed the PRNG - srand(seed); - - // Make sure that the packet size does not exceed the maximum size expected by - // the fuzzer - size_t mutated_size = data_size <= max_size ? data_size : max_size; - - // Randomly select a command string to add as a header to the packet - memcpy(mutated_out, commands[rand() % 3], 3); - - // Mutate the payload of the packet - for (int i = 3; i < mutated_size; i++) { - - mutated_out[i] = (data[i] + rand() % 10) & 0xff; - - } - - return mutated_size; - -} - |