aboutsummaryrefslogtreecommitdiff
path: root/examples/custom_mutators/example.py
diff options
context:
space:
mode:
authorh1994st <h1994st@gmail.com>2020-03-07 16:28:48 -0500
committerh1994st <h1994st@gmail.com>2020-03-07 16:28:48 -0500
commit8f93cf5c55c8a845f90ec283effe0114488a7e31 (patch)
treea36c2e816ad99fde6b216513b989a6a006b91f00 /examples/custom_mutators/example.py
parentdc0b2dda5e4ec41ea491e63f0ec31c5da6fe7f1d (diff)
downloadafl++-8f93cf5c55c8a845f90ec283effe0114488a7e31.tar.gz
Add two new hooks for the custom mutator
- `afl_custom_queue_get` and `afl_custom_queue_new_entry` - Update the corresponding document and examples
Diffstat (limited to 'examples/custom_mutators/example.py')
-rw-r--r--examples/custom_mutators/example.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/custom_mutators/example.py b/examples/custom_mutators/example.py
index a68f2ee5..6bacfa05 100644
--- a/examples/custom_mutators/example.py
+++ b/examples/custom_mutators/example.py
@@ -120,3 +120,55 @@ def fuzz(buf, add_buf, max_size):
# '''
# return buf
#
+# def havoc_mutation(buf, max_size):
+# '''
+# Perform a single custom mutation on a given input.
+#
+# @type buf: bytearray
+# @param buf: The buffer that should be mutated.
+#
+# @type max_size: int
+# @param max_size: Maximum size of the mutated output. The mutation must not
+# produce data larger than max_size.
+#
+# @rtype: bytearray
+# @return: A new bytearray containing the mutated data
+# '''
+# return mutated_buf
+#
+# def havoc_mutation_probability():
+# '''
+# Called for each `havoc_mutation`. Return the probability (in percentage)
+# that `havoc_mutation` is called in havoc. Be default it is 6%.
+#
+# @rtype: int
+# @return: The probability (0-100)
+# '''
+# return prob
+#
+# def queue_get(filename):
+# '''
+# Called at the beginning of each fuzz iteration to determine whether the
+# test case should be fuzzed
+#
+# @type filename: str
+# @param filename: File name of the test case in the current queue entry
+#
+# @rtype: bool
+# @return: Return True if the custom mutator decides to fuzz the test case,
+# and False otherwise
+# '''
+# return True
+#
+# def queue_new_entry(filename_new_queue, filename_orig_queue):
+# '''
+# Called after adding a new test case to the queue
+#
+# @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
+