Skip to content

Commit aeb53e6

Browse files
fix/(#3781): update pylibafl and python_qemu documentation (#3782)
* pylibafl/docs: fix readme and make test script clearer * python_qemu/docs: mention lief dependency and add compilation instructions
1 parent 4e2c64b commit aeb53e6

3 files changed

Lines changed: 28 additions & 12 deletions

File tree

bindings/pylibafl/README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ cd LibAFL/bindings/pylibafl
99
python3 -m venv .env
1010
# Activate virtual environment
1111
source .env/bin/activate
12-
# Install maturin
13-
pip install maturin
12+
# Install dependencies
13+
pip install maturin distlib patchelf
1414
# Build python module
1515
maturin develop
1616
```
@@ -19,21 +19,27 @@ This is going to install `pylibafl` python module into this venv.
1919

2020
## Use bindings
2121

22-
### Example: Running baby_fuzzer in fuzzers/baby_fuzzer/baby_fuzzer.py
22+
### Example: Running the test fuzzer
2323

2424
First, make sure the python virtual environment is activated. If not, run `source .env/bin/activate
2525
`. Running `pip freeze` at this point should display the following (versions may differ):
2626

2727
```ini
28-
maturin==0.12.6
28+
distlib==0.4.0
29+
maturin==1.12.6
30+
patchelf==0.17.2.4
2931
pylibafl==0.7.0
30-
toml==0.10.2
3132
```
3233

3334
Then simply run
3435

3536
```sh
36-
python PATH_TO_BABY_FUZZER/baby_fuzzer.py
37+
./test.sh
3738
```
3839

39-
The crashes directory will be created in the directory from which you ran the command.
40+
You should see the following show up after a short pause:
41+
42+
```
43+
Starting to fuzz from python!
44+
PylibAFL works!
45+
```

bindings/pylibafl/test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env bash
22

33
mkdir in || true
4-
echo "a" > ./in/a
4+
echo "a" >./in/a
55

66
timeout 10 python3 ./test.py
77
export exit_code=$?
88
if [ $exit_code -eq 124 ]; then
9-
# 124 = timeout happened. All good.
10-
exit 0
9+
# 124 = timeout happened. All good.
10+
echo "PylibAFL works!"
11+
exit 0
1112
else
12-
exit $exit_code
13+
exit $exit_code
1314
fi
14-

fuzzers/binary_only/python_qemu/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@
44

55
First, install python bindings (check `LibAFL/bindings/pylibafl`) and use the virtual environment.
66

7+
Then, install lief.
8+
```bash
9+
$ pip install lief
10+
```
11+
712
Then, create the `in` folder and put some input inside
813
```bash
914
$ mkdir in
1015
$ echo aaaaa > in/input
1116
```
1217

18+
Finally, compile the binary.
19+
```bash
20+
$ gcc fuzz.c -o a.out
21+
```
22+
1323
## Run
1424

1525
```bash

0 commit comments

Comments
 (0)