about summary refs log tree commit diff
path: root/examples/custom_mutators/example.py
diff options
context:
space:
mode:
authorh1994st <h1994st@gmail.com>2020-03-29 01:22:44 -0400
committerDominik Maier <domenukk@gmail.com>2020-03-30 16:46:54 +0200
commit6c14415664228a3b5ab245af9b37fb6672619b49 (patch)
tree15b5cec8df2b41b81078fb45406394dafbb12eb8 /examples/custom_mutators/example.py
parent567b3985ab680ac9188c96cd3820653c344c9755 (diff)
downloadafl++-6c14415664228a3b5ab245af9b37fb6672619b49.tar.gz
test.sh: "trusty-amd64" does not work well with "realpath". Use
"readlink -f" for Ubuntu instead.
Diffstat (limited to 'examples/custom_mutators/example.py')
-rw-r--r--examples/custom_mutators/example.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/custom_mutators/example.py b/examples/custom_mutators/example.py
index 7919d3d3..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.
@@ -48,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