Skip to content

Commit 3a86984

Browse files
authored
Merge pull request #7 from Rog3rSm1th/dev/rog3rsm1th
Dev/rog3rsm1th
2 parents 009a04d + bb3c722 commit 3a86984

File tree

28 files changed

+186
-529
lines changed

28 files changed

+186
-529
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img src="doc/frelatage_logo.gif" width="200" height="200" style="border-radius:4px"/>
33
<br>
44
<code>pip3 install frelatage</code></br>
5-
<i>Current release : <a href="https://github.com/Rog3rSm1th/Frelatage/releases">0.0.2</a></i></br></br>
5+
<i>Current release : <a href="https://github.com/Rog3rSm1th/Frelatage/releases">0.0.3</a></i></br></br>
66
<a target="_blank" href="https://www.python.org/downloads/" title="Python version"><img src="https://img.shields.io/badge/Made%20with-Python-1f425f.svg"></a>
77
<a target="_blank" href="https://www.python.org/downloads/" title="Python version"><img src="https://img.shields.io/badge/python-%3E=_3.6-green.svg"></a>
88
<a target="_blank" href="LICENSE" title="License: MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg"></a>
@@ -24,8 +24,9 @@
2424
<a href="#configuration">Configuration</a>
2525
</p>
2626

27-
![](doc/frelatage_demo.gif)
28-
27+
<p align="center">
28+
<img src="https://github.com/Rog3rSm1th/Frelatage/blob/main/doc/frelatage_demo.gif?raw=true" alt="Frelatage demonstration"/>
29+
</p>
2930

3031
Frelatage is a coverage-based Python fuzzing library which can be used to fuzz python code. The development of Frelatage was inspired by various other fuzzers, including [AFL](https://github.com/google/AFL)/[AFL++](https://github.com/AFLplusplus/AFLplusplus), [Atheris](https://github.com/google/atheris) and [PyFuzzer](https://github.com/eerimoq/pyfuzzer).The main purpose of the project is to take advantage of the best features of these fuzzers and gather them together into a new tool in order to efficiently fuzz python applications.
3132

@@ -100,6 +101,10 @@ graph TB
100101
#### File fuzzing
101102
Frelatage allows to fuzz a function by passing a file as input.
102103

104+
#### Fuzzer efficiency
105+
- Corpus
106+
- Dictionnary
107+
103108
## Use Frelatage
104109

105110
#### Fuzz a classical parameter
@@ -112,18 +117,17 @@ def MyFunctionFuzz(data):
112117
my_vulnerable_library.parse(data)
113118

114119
input = frelatage.Input(value="initial_value")
115-
f = frelatage.Fuzzer(MyFunctionFuzz, [input])
120+
f = frelatage.Fuzzer(MyFunctionFuzz, [[input]])
116121
f.fuzz()
117122
```
118123

119124
#### Fuzz a file parameter
120125

121-
Frelatage gives you the possibility to fuzz file type input parameters. To initialize the value of these files, you must create as many files in the input folder as there are arguments of type file. These files must be named as follows: the first file argument must be named ```0```, the second ```1```, and so on.
122-
126+
Frelatage gives you the possibility to fuzz file type input parameters. To initialize the value of these files, you must create files in the input folder (```./in``` by default).
123127

124-
In case we have only one input file, we can initialize it like this:
128+
If we want to initialize the value of a file used to fuzz, we can do it like this:
125129
```bash
126-
echo "initial value" > ./in/0
130+
echo "initial value" > ./in/input.txt
127131
```
128132

129133
And then run the fuzzer:
@@ -135,15 +139,18 @@ import my_vulnerable_library
135139
def MyFunctionFuzz(data):
136140
my_vulnerable_library.load_file(data)
137141

138-
input = frelatage.Input(file=True)
139-
f = frelatage.Fuzzer(MyFunctionFuzz, [input])
142+
input = frelatage.Input(file=True, value="input.txt")
143+
f = frelatage.Fuzzer(MyFunctionFuzz, [[input]])
140144
f.fuzz()
141145
```
142146

143147
#### Fuzz with a dictionary
144148

145149
You can copy one or more dictionaries located [here](https://github.com/Rog3rSm1th/Frelatage/tree/main/dictionaries) in the directory dedicated to dictionaries (`./dict` by default).
146150

151+
#### Examples
152+
153+
You can find more examples of fuzzers and corpus in the [examples directory](https://github.com/Rog3rSm1th/Frelatage/tree/main/examples).
147154

148155
## Reports
149156

@@ -181,6 +188,7 @@ There are two ways to set up Frelatage:
181188
| FRELATAGE_INPUT_MAX_LEN | Maximum size of an input variable in bytes | ```4``` - ```1000000``` | ```4094``` |
182189
| FRELATAGE_MAX_THREADS | Maximum number of simultaneous threads | ```8``` - ```50``` | ```8``` |
183190
| FRELATAGE_DICTIONARY_DIR | Default directory for dictionaries. It needs to be a relative path (to the path of the fuzzing file) | relative path to a folder, e.g. ```./dict``` | ```./dict``` |
191+
| FRELATAGE_MAX_CYCLES_WITHOUT_NEW_PATHS | Number of cycles without new paths found after which we go to the next stage | ```10``` - ```50000``` | ```5000``` |
184192

185193

186194
A configuration example :
@@ -192,6 +200,7 @@ export FRELATAGE_INPUT_FILE_TMP_DIR="/tmp/frelatage" &&
192200
export FRELATAGE_INPUT_MAX_LEN=4096 &&
193201
export FRELATAGE_MAX_THREADS=8 &&
194202
export FRELATAGE_DICTIONARY_DIR="./dict" &&
203+
export FRELATAGE_MAX_CYCLES_WITHOUT_NEW_PATHS=5000 &&
195204
python3 fuzzer.py
196205
```
197206

@@ -209,8 +218,8 @@ input2 = frelatage.Input(value=2)
209218
f = frelatage.Fuzzer(
210219
# The method you want to fuzz
211220
method=myfunction,
212-
# The initial arguments
213-
arguments=[input1, input2],
221+
# Corpus
222+
corpus=[[input1], [input2]],
214223
# Number of threads
215224
threads_count=8,
216225
# Exceptions that will be taken into account

doc/frelatage_demo.gif

-576 KB
Loading

examples/image_fuzzer/gif_fuzzer/gif_fuzzer.py

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import frelatage
2+
from PIL import Image
3+
4+
def fuzz_gif(input_file):
5+
Image.open(input_file)
6+
7+
# Corpus
8+
# We use 1px*1px GIF, JPEG and PNG files
9+
gif_file = frelatage.Input(file=True, value="image.gif")
10+
jpeg_file = frelatage.Input(file=True, value="image.gif")
11+
png_file = frelatage.Input(file=True, value="image.gif")
12+
13+
f = frelatage.Fuzzer(fuzz_gif, [[gif_file, jpeg_file, png_file, png_file]])
14+
f.fuzz()
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)