{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"button": false,
"new_sheet": false,
"run_control": {
"read_only": false
},
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Downloads and Installation\n",
"\n",
"This notebook has instructions on how to use the `fuzzingbook` code in your own programs."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"In short, there are three ways:\n",
"\n",
"1. Simply run the notebooks in your browser, using the \"mybinder\" environment. Choose \"Binder\" from the menus at the top; this will lead you to a preconfigured Jupyter Notebook environment where you can toy around at your leisure.\n",
"2. Import the code for your own Python programs. Using `pip install fuzzingbook`, you can install all code and start using it from your own code. See \"Installing Fuzzingbook Code for your own Python projects\", below.\n",
"3. Download or check out the code and/or the notebooks from the project site. This allows you to edit and run all things locally. However, be sure to also install the required packages; see below for details."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-26T18:06:20.831453Z",
"iopub.status.busy": "2025-10-26T18:06:20.831296Z",
"iopub.status.idle": "2025-10-26T18:06:21.540405Z",
"shell.execute_reply": "2025-10-26T18:06:21.540056Z"
},
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [],
"source": [
"import bookutils.setup"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-26T18:06:21.542106Z",
"iopub.status.busy": "2025-10-26T18:06:21.541991Z",
"iopub.status.idle": "2025-10-26T18:06:21.544960Z",
"shell.execute_reply": "2025-10-26T18:06:21.544723Z"
},
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from bookutils import YouTubeVideo\n",
"YouTubeVideo(\"fGu3uwHcTRc\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Installing Fuzzingbook Code for your own Python projects\n",
"\n",
"We provide a `fuzzingbook` Python package that you can install using the `pip` package manager:\n",
"\n",
"```shell\n",
"$ pip install fuzzingbook\n",
"```\n",
"\n",
"This is set up such that almost all additional required packages are also installed."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"Once `pip` is complete, you can import individual `fuzzingbook` classes, constants, or functions into your Python code (also in notebooks) using\n",
"\n",
"```python\n",
">>> from fuzzingbook. import \n",
"```\n",
"\n",
"where `` is the name of the class, constant, or function to use, and `` 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)."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"Here is an example importing `RandomFuzzer` from [the chapter on fuzzers](Fuzzer.ipynb), whose notebook name is `Fuzzer`:\n",
"\n",
"```python\n",
">>> from fuzzingbook.Fuzzer import RandomFuzzer\n",
">>> f = RandomFuzzer()\n",
">>> f.fuzz()\n",
"'!7#%\"*#0=)$;%6*;>638:*>80\"=>(/*:-(2<4 !:5*6856&?\"\"11<7+%<%7,4.8,*+&,,$,.\"5%<%76< -5'\n",
"```\n",
"\n",
"The \"Synopsis\" section at the beginning of a chapter gives a short survey on useful code features you can use."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Downloading the Notebooks\n",
"\n",
"Another way to use the code is to _import the notebooks directly_. Download the notebooks using this link:\n",
"\n",
"[https://www.fuzzingbook.org/dist/fuzzingbook-notebooks.zip](https://www.fuzzingbook.org/dist/fuzzingbook-notebooks.zip)\n",
"\n",
"Then, add your own notebooks _into the same folder_. After importing `bookutils.setup`, you can then simply import the code from other notebooks, just as our own notebooks do.\n",
"\n",
"Here is again the above example, importing `RandomFuzzer` from [the chapter on fuzzers](Fuzzer.ipynb) – but now from a notebook:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-26T18:06:21.565703Z",
"iopub.status.busy": "2025-10-26T18:06:21.565565Z",
"iopub.status.idle": "2025-10-26T18:06:21.567407Z",
"shell.execute_reply": "2025-10-26T18:06:21.567150Z"
},
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [],
"source": [
"import bookutils.setup"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-26T18:06:21.568790Z",
"iopub.status.busy": "2025-10-26T18:06:21.568684Z",
"iopub.status.idle": "2025-10-26T18:06:21.630115Z",
"shell.execute_reply": "2025-10-26T18:06:21.629751Z"
},
"slideshow": {
"slide_type": "skip"
}
},
"outputs": [],
"source": [
"from Fuzzer import RandomFuzzer"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-26T18:06:21.631874Z",
"iopub.status.busy": "2025-10-26T18:06:21.631767Z",
"iopub.status.idle": "2025-10-26T18:06:21.633849Z",
"shell.execute_reply": "2025-10-26T18:06:21.633556Z"
},
"slideshow": {
"slide_type": "subslide"
}
},
"outputs": [
{
"data": {
"text/plain": [
"'!7#%\"*#0=)$;%6*;>638:*>80\"=>(/*:-(2<4 !:5*6856&?\"\"11<7+%<%7,4.8,*+&,,$,.\"5%<%76< -5'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"f = RandomFuzzer()\n",
"f.fuzz()"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"source": [
"If you'd like to share your notebook, let us know; we can integrate it in the repository or even in the book."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Downloading the Code\n",
"\n",
"If you want to work with code samples, you can download all the Python code here:\n",
"\n",
"[https://www.fuzzingbook.org/dist/fuzzingbook-code.zip](https://www.fuzzingbook.org/dist/fuzzingbook-code.zip)\n",
"\n",
"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.\n",
"\n",
"If you only want to **use** the Python code, install the code package (see above)."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Getting the Code from GitHub\n",
"\n",
"You can also check out the latest and greatest from GitHub. After cloning the repository from [the project page](https://github.com/uds-se/fuzzingbook/) and installing the additional packages (see below), you can `cd` into `notebooks` and start `jupyter` right away!\n",
"\n",
"There also is a `Makefile` provided with literally hundreds of targets; most important are the ones we also use in continuous integration:\n",
"\n",
"* `make check-imports` checks whether your code is free of syntax errors\n",
"* `make check-style` checks whether your code is free of type errors\n",
"* `make check-code` runs all derived code, testing it\n",
"* `make check-notebooks` runs all notebooks, testing them\n",
"\n",
"If you want to contribute to the project, ensure that the above tests run through.\n",
"\n",
"The `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."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Installing Supplemental Packages\n",
"\n",
"After downloaded `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."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Step 1: Install Required Python Packages\n",
"\n",
"The [`pyproject.toml` file within the project root folder](https://github.com/uds-se/fuzzingbook/tree/master/) lists all _Python packages required_.\n",
"\n",
"You can do\n",
"\n",
"```sh\n",
"$ pip install .\n",
"```\n",
"\n",
"to install all required packages (but using `pipenv` is preferred; see below)."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Step 2: Install Additional Non-Python Packages\n",
"\n",
"The [`apt.txt` file in the `binder/` folder](https://github.com/uds-se/fuzzingbook/tree/master/binder) lists all _Linux_ packages required.\n",
"\n",
"In most cases, however, it suffices to install the `dot` graph drawing program (part of the `graphviz` package). Here are some instructions:"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"#### Installing Graphviz on Linux\n",
"\n",
"Use\n",
"\n",
"```sh\n",
"$ sudo apt-get install graphviz libgraphviz-dev\n",
"```\n",
"\n",
"to install `dot`."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"#### Installing Graphviz on macOS\n",
"\n",
"On macOS, if you use `conda`, run\n",
"\n",
"```sh\n",
"$ conda install graphviz\n",
"```\n",
"\n",
"If you use HomeBrew, run\n",
"\n",
"```sh\n",
"$ brew install graphviz\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Installing Fuzzingbook Code in an Isolated Environment\n",
"\n",
"If you wish to install the `fuzzingbook` code in an environment that is isolated from your system interpreter,\n",
"we recommend using [Pipenv](https://pipenv.pypa.io/), which can automatically create a so called *virtual environment* hosting all required packages.\n",
"\n",
"To accomplish this, please follow these steps:"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Step 1: Install PyEnv\n",
"\n",
"Optionally install `pyenv` following the [official instructions](https://github.com/pyenv/pyenv#installation) if you are on a Unix operating system.\n",
"If you are on Windows, consider using [pyenv-win](https://github.com/pyenv-win/pyenv-win) instead.\n",
"This will allow you to seamlessly install any version of Python."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Step 2: Install PipEnv\n",
"\n",
"Install Pipenv following the official [installation instructions](https://pypi.org/project/pipenv/).\n",
"If you have `pyenv` installed, Pipenv can automatically download and install the appropriate version of the Python distribution.\n",
"Otherwise, Pipenv will use your system interpreter, which may or may not be the right version."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Step 3: Install Python Packages\n",
"\n",
"In the `fuzzingbook` root directory, run\n",
"\n",
"```sh\n",
"$ pipenv install .\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Step 4: Install Additional Non-Python Packages\n",
"\n",
"See above for instructions on how to install additional non-python packages."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Step 5: Enter the Environment\n",
"\n",
"Enter the environment with \n",
"\n",
"```sh\n",
"$ pipenv shell\n",
"```\n",
"\n",
"where you can now execute\n",
"\n",
"```sh\n",
"$ make -k check-code\n",
"```\n",
"\n",
"to run the tests."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Using Docker\n",
"\n",
"As another alternative, you can also **use our Docker images** (experimental). [Install Docker](https://docs.docker.com/get-docker/) and then run\n",
"```\n",
" $ docker pull zeller24/fuzzingbook\n",
" $ docker run -it --rm -p 8888:8888 zeller24/fuzzingbook\n",
"```\n",
"and then in your Web browser, open the URL (`http://127.0.0.1/...` or `http://localhost/...`) given in the console output.\n",
"This should kick off the same Jupyter environment as in mybinder.org.\n",
"\n",
"If you want to create your own Docker images, use our [Dockerfile](https://github.com/uds-se/fuzzingbook/blob/master/binder/Dockerfile) as a starting point."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": []
}
],
"metadata": {
"ipub": {
"bibliography": "fuzzingbook.bib",
"toc": true
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.4"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": true,
"title_cell": "",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
},
"toc-autonumbering": false
},
"nbformat": 4,
"nbformat_minor": 4
}