diff options
author | Dominik Maier <domenukk@gmail.com> | 2021-02-15 13:52:23 +0100 |
---|---|---|
committer | Dominik Maier <domenukk@gmail.com> | 2021-02-15 13:52:23 +0100 |
commit | cebde1f9e69170a27aacfed8befe8b62ac8c6858 (patch) | |
tree | 0771da70340bb0458186261af65f8fc10dcd6c35 /utils/custom_mutators/simple-chunk-replace.py | |
parent | 0298ae82b06c9776294c1da15ec278ef35dfa770 (diff) | |
download | afl++-cebde1f9e69170a27aacfed8befe8b62ac8c6858.tar.gz |
ran black on python scripts
Diffstat (limited to 'utils/custom_mutators/simple-chunk-replace.py')
-rw-r--r-- | utils/custom_mutators/simple-chunk-replace.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/custom_mutators/simple-chunk-replace.py b/utils/custom_mutators/simple-chunk-replace.py index df2f4ca7..c57218dd 100644 --- a/utils/custom_mutators/simple-chunk-replace.py +++ b/utils/custom_mutators/simple-chunk-replace.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # encoding: utf-8 -''' +""" Simple Chunk Cross-Over Replacement Module for AFLFuzz @author: Christian Holler (:decoder) @@ -12,24 +12,24 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. @contact: choller@mozilla.com -''' +""" import random def init(seed): - ''' + """ Called once when AFLFuzz starts up. Used to seed our RNG. @type seed: int @param seed: A 32-bit random value - ''' + """ # Seed our RNG random.seed(seed) def fuzz(buf, add_buf, max_size): - ''' + """ Called per fuzzing iteration. @type buf: bytearray @@ -44,7 +44,7 @@ def fuzz(buf, add_buf, max_size): @rtype: bytearray @return: A new bytearray containing the mutated data - ''' + """ # Make a copy of our input buffer for returning ret = bytearray(buf) @@ -58,7 +58,9 @@ def fuzz(buf, add_buf, max_size): rand_dst_idx = random.randint(0, len(buf)) # Make the chunk replacement - ret[rand_dst_idx:rand_dst_idx + fragment_len] = add_buf[rand_src_idx:rand_src_idx + fragment_len] + ret[rand_dst_idx : rand_dst_idx + fragment_len] = add_buf[ + rand_src_idx : rand_src_idx + fragment_len + ] # Return data return ret |