diff options
author | Andrea Fioraldi <andreafioraldi@gmail.com> | 2020-04-03 09:39:12 +0200 |
---|---|---|
committer | Andrea Fioraldi <andreafioraldi@gmail.com> | 2020-04-03 09:39:12 +0200 |
commit | 8610b0e40677846ba65de55fcaedd2ebee66a511 (patch) | |
tree | f5b6409fe840ac69417e348795b69cbeb0a072fc /examples/custom_mutators/example.py | |
parent | ffb4767fc1adf2383173e5655d4f1fcf7e0982b6 (diff) | |
parent | 97cae2df9975589eb05a543f92c6ba232242fd7b (diff) | |
download | afl++-8610b0e40677846ba65de55fcaedd2ebee66a511.tar.gz |
Merge branch 'dev' of github.com:vanhauser-thc/AFLplusplus into dev
Diffstat (limited to 'examples/custom_mutators/example.py')
-rw-r--r-- | examples/custom_mutators/example.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/examples/custom_mutators/example.py b/examples/custom_mutators/example.py index 6bacfa05..9e95eed6 100644 --- a/examples/custom_mutators/example.py +++ b/examples/custom_mutators/example.py @@ -17,6 +17,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. import random +COMMANDS = [ + b"GET", + b"PUT", + b"DEL", +] + + def init(seed): ''' Called once when AFLFuzz starts up. Used to seed our RNG. @@ -27,6 +34,10 @@ def init(seed): random.seed(seed) +def deinit(): + pass + + def fuzz(buf, add_buf, max_size): ''' Called per fuzzing iteration. @@ -44,8 +55,9 @@ def fuzz(buf, add_buf, max_size): @rtype: bytearray @return: A new bytearray containing the mutated data ''' - ret = bytearray(buf) - # Do something interesting with ret + ret = bytearray(100) + + ret[:3] = random.choice(COMMANDS) return ret @@ -164,11 +176,10 @@ def fuzz(buf, add_buf, max_size): # ''' # Called after adding a new test case to the queue # -# @type filename_new_queue: str +# @type filename_new_queue: str # @param filename_new_queue: File name of the new queue entry # # @type filename_orig_queue: str # @param filename_orig_queue: File name of the original queue entry # ''' # pass - |