1
- ==================================================
2
- Adding custom mutators to AFL using Python modules
3
- ==================================================
1
+ # Adding custom mutators to AFL using Python modules
4
2
5
3
This file describes how you can utilize the external Python API to write
6
4
your own custom mutation routines.
@@ -14,11 +12,10 @@ Adding custom mutators to AFL using Python modules
14
12
python2 or python3 syntax in your scripts!
15
13
After a major version upgrade (e.g. 3.7 -> 3.8), a recompilation of afl-fuzz may be needed.
16
14
17
- For an example and a template see ../python_mutators/
15
+ For an example and a template see ../examples/ python_mutators/
18
16
19
17
20
- 1) Description and purpose
21
- --------------------------
18
+ ## 1) Description and purpose
22
19
23
20
While AFLFuzz comes with a good selection of generic deterministic and
24
21
non-deterministic mutation operations, it sometimes might make sense to extend
@@ -40,8 +37,7 @@ See the following information to get a better pictures:
40
37
https://bugs.chromium.org/p/chromium/issues/detail?id=930663
41
38
42
39
43
- 2) How the Python module looks like
44
- -----------------------------------
40
+ ## 2) How the Python module looks like
45
41
46
42
You can find a simple example in pymodules/example.py including documentation
47
43
explaining each function. In the same directory, you can find another simple
@@ -55,8 +51,7 @@ There is also optional support for a trimming API, see the section below for
55
51
further information about this feature.
56
52
57
53
58
- 3) How to compile AFLFuzz with Python support
59
- ---------------------------------------------
54
+ ## 3) How to compile AFLFuzz with Python support
60
55
61
56
You must install the python 3 or 2 development package of your Linux
62
57
distribution before this will work. On Debian/Ubuntu/Kali this can be done
@@ -75,8 +70,7 @@ In case your setup is different set the necessary variables like this:
75
70
PYTHON_INCLUDE=/path/to/python/include LDFLAGS=-L/path/to/python/lib make
76
71
77
72
78
- 4) How to run AFLFuzz with your custom module
79
- ---------------------------------------------
73
+ ## 4) How to run AFLFuzz with your custom module
80
74
81
75
You must pass the module name inside the env variable AFL_PYTHON_MODULE.
82
76
@@ -99,17 +93,15 @@ AFL_DEBUG - When combined with AFL_NO_UI, this causes the C trimming code
99
93
of your custom Python trimmer. Use this to see if it works :)
100
94
101
95
102
- 5) Order and statistics
103
- -----------------------
96
+ ## 5) Order and statistics
104
97
105
98
The Python stage is set to be the first non-deterministic stage (right before
106
99
the havoc stage). In the statistics however, it shows up as the third number
107
100
under "havoc". That's because I'm lazy and I didn't want to mess with the UI
108
101
too much ;)
109
102
110
103
111
- 6) Trimming support
112
- -------------------
104
+ ## 6) Trimming support
113
105
114
106
The generic trimming routines implemented in AFLFuzz can easily destroy the
115
107
structure of complex formats, possibly leading to a point where you have a lot
0 commit comments