In short, there are three ways:
fuzzingbook.orgpages; this will lead you to a preconfigured Jupyter Notebook environment where you can toy around at your leisure.
pip install fuzzingbook, you can install all code and start using it from your own code. See "Can I import the code for my own Python projects?", below.
from bookutils import YouTubeVideo YouTubeVideo("fGu3uwHcTRc")
Yes, you can! (If you like Python, that is.) We provide a
fuzzingbook Python package that you can install using the
pip package manager:
$ pip install fuzzingbook
fuzzingbook 1.0, this is set up such that almost all additional required packages are also installed. For a full installation, also follow the steps in "Which other Packages do I need to use the Python Modules?" below.
pip is complete, you can import individual classes, constants, or functions from each notebook using
>>> from fuzzingbook.<notebook> import <identifier>
<identifier> is the name of the class, constant, or function to use, and
<notebook> is the name of the respective notebook. (If you read this at fuzzingbook.org, then the notebook name is the identifier preceding
".html" in the URL).
Here is an example importing
RandomFuzzer from the chapter on fuzzers, whose notebook name is
>>> from fuzzingbook.Fuzzer import RandomFuzzer >>> f = RandomFuzzer() >>> f.fuzz() '!7#%"*#0=)$;%6*;>638:*>80"=</>(/*:-(2<4 !:5*6856&?""11<7+%<%7,4.8,*+&,,$,."5%<%76< -5'
The "Synopsis" section at the beginning of a chapter gives a short survey on useful code features you can use.
fuzzingbook 1.0, Python 3.9 and later is required. Specifically, we use Python 3.9.7 for development and testing. This is also the version to be used if you check out the code from git, and the version you get if you use the debugging book within the "mybinder" environment.
To use the
fuzzingbook code with earlier Python version, use
$ pip install 'fuzzingbook=0.95'
Our notebooks generally assume a Unix-like environment; the code is tested on Linux and macOS. System-independent code may also run on Windows.
Yes, you can! You would first install the
fuzzingbook package (as above); you can then access all code right from your notebook.
Another way to use the code is to import the notebooks directly. Download the notebooks from the menu. Then, add your own notebooks into the same folder. After importing
bookutils, you can then simply import the code from other notebooks, just as our own notebooks do.
Here is again the above example, importing
RandomFuzzer from the chapter on fuzzers – but now from a notebook:
from Fuzzer import RandomFuzzer
f = RandomFuzzer() f.fuzz()
'!7#%"*#0=)$;%6*;>638:*>80"=</>(/*:-(2<4 !:5*6856&?""11<7+%<%7,4.8,*+&,,$,."5%<%76< -5'
If you'd like to share your notebook, let us know; we can integrate it in the repository or even in the book.
Yes, you can! We have a few continuous integration (CI) workflows running which do exactly that. After cloning the repository from the project page and installing the additional packages (see below), you can
notebooks and start
jupyter right away!
There also is a
Makefile provided with literally hundreds of targets; most important are the ones we also use in continuous integration:
make check-importschecks whether your code is free of syntax errors
make check-stylechecks whether your code is free of type errors
make check-coderuns all derived code, testing it
make check-notebooksruns all notebooks, testing them
If you want to contribute to the project, ensure that the above tests run through.
Makefile has many more, often experimental, targets.
make markdown creates a
.md variant in
markdown/, and there's also
make word and
make epub, which are set to create Word and EPUB variants (with mixed results). Try
make help for commonly used targets.
Yes, you can! You can download the code as Python programs; simply select "Resources $\rightarrow$ Download Code" for one chapter or "Resources $\rightarrow$ All Code" for all chapters. These code files can be executed, yielding (hopefully) the same results as the notebooks.
The code files can also be edited if you wish, but (a) they are very obviously generated from notebooks, (b) therefore not much fun to work with, and (c) if you fix any errors, you'll have to back-propagate them to the notebook before you can make a pull request. Use code files only under severely constrained circumstances.
If you only want to use the Python code, install the code package (see above).
fuzzingbook code, installing the
fuzzingbook package, or checking out
fuzzingbook from the repository, here's what to do to obtain a complete set of packages.
requirements.txt file within the project root folder lists all Python packages required.
You can do
$ pip install -r requirements.txt
to install all required packages (but using
pipenv is preferred; see below).
If you wish to install the
fuzzingbook code in an environment that is isolated from your system interpreter,
we recommend using Pipenv, which can automatically create a so called virtual environment hosting all required packages.
To accomplish this, please follow these steps:
Install Pipenv following the official installation instructions.
If you have
pyenv installed, Pipenv can automatically download and install the appropriate version of the Python distribution.
Otherwise, Pipenv will use your system interpreter, which may or may not be the right version.