diff --git a/deploy/README.md b/deploy/README.md index 23c405157..74883384b 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -1,5 +1,7 @@ # Run with Docker +**Note: As of April 2023, the `fuzzingbook` images are no longer available from DockerHub. These instructions are still available for documentation purposes only.*** + The first step is to download and install [Docker](https://www.docker.com/). Follow the installation procedure recommended at docker.com, or, if you are using Linux, refer to your distribution for information on the installation process. Once installed, make sure Docker works by typing `docker info` in a shell. diff --git a/notebooks/Fuzzer.ipynb b/notebooks/Fuzzer.ipynb index 2d0f8f2e5..3bfb9a1a1 100644 --- a/notebooks/Fuzzer.ipynb +++ b/notebooks/Fuzzer.ipynb @@ -863,12 +863,43 @@ " ], \"9 ** 0.5\")" ] }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The chance is actually higher than you may think. If you remove `/` (the root of all files), for instance, your entire file system will be gone. If you remove `.` (the current folder), all the files in the current directory will be gone. \n", + "\n", + "The probability of generating a string that is exactly 1 character long is 1/101, this is because the length of the string is determined by calling random.randrange(0, max_length + 1), where the default value of max_length is 100. Per the description given of random.randrange, that should return a random number in [0, 99 + 1). So, we end up with the inclusive range [0, 100] where there are 101 values in the interval.\n", + "\n", + "For `/` or `.` to be produced, you need a string length of 1 (chance: 1 out of 101) and one of these two characters (chance: 2 out of 32)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "1/101 * 2/32" + ] + }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "The chance is actually higher than you may think. If you remove `/` (the root of all files), for instance, your entire file system will be gone. If you remove `~` (your home directory), all your files will be gone. If you remove `.` (the current folder), all the files in the current directory will be gone. For any of these to be produced, you need a string length of 1 (chance: 1 out of 100) and one of these three characters (chance: 3 out of 32), which indeed is a chance of about one in a thousand." + "The above code block precludes the possiblity of removing `~` (your home directory), this is because the probability of generating the character '~' is not 1/32; it is 0/32. The characters are created by calling chr(random.randrange(char_start, char_start + char_range)), where the default value of char_start is 32 and the default value of char_range is 32. The documentation for chr reads, \"[r]eturn the string representing a character whose Unicode code point is the integer i.\" The Unicode code point for '~' is 126 and therefore, not in the interval [32, 64). \n", + "\n", + "If the code were to be changed so that char_range = 95 then the probability of obtaining the character '~' would be 1/94 , thus resulting in the probability of the event of deleting all files being equal to 0.000332\n", + "\n", + "And all your files in the home directory will be gone" ] }, { @@ -877,14 +908,27 @@ "metadata": {}, "outputs": [], "source": [ - "1/100 * 3/32" + "3/94 * 1/94 * 99/101" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "However, we can actually deal with any string as long as the _second_ character is a space – after all, `rm -fr / WHATEVER` will first deal with `/`, and only then with whatever follows. The chances for the first character are 3 out of 32, for the space 1 out of 32, so we're more at 1 out of 300:" + "However, we can actually deal with any string as long as the _second_ character is a space – after all, `rm -fr / WHATEVER` will first deal with `/`, and only then with whatever follows. The chances for the first character are 2 out of 32 as the code block above only allows for the probability of obtaining a `/` or a `.` but not a `~`.\n", + "\n", + "For the space the probability is 1 out of 32.\n", + "\n", + "We have to include the term for the probability of obtaining at least 2 characters which is required for the scenario of obtaining a space as the second character. This probability is 99/101 because it is calculated as (1 - probabilty of obtaining a single character or no character at all), so it is equal to 1-(2/101).\n", + "\n", + "Therefore, the probability calculation for the event of deleting all files in the case of having a space for the second character is:\n", + "\n", + "[probability of obtaining '/' or '. ' followed by a space] = [the probability of obtaining either the '/' character or the '. ' character] * [the probability of obtaining space] * [Probability of getting at least 2 characters] = 0.001914\n", + "\n", + "\n", + "\n", + "Diagram of probability of obtaining at least 2 characters." ] }, { @@ -893,7 +937,7 @@ "metadata": {}, "outputs": [], "source": [ - "3/32 * 1/32" + "2/32 * 1/32 * 99/101" ] }, { diff --git a/notebooks/PICS/FuzzingWithConstraints-synopsis-1.svg b/notebooks/PICS/FuzzingWithConstraints-synopsis-1.svg index 88b4dbe4b..2d2ca181c 100644 --- a/notebooks/PICS/FuzzingWithConstraints-synopsis-1.svg +++ b/notebooks/PICS/FuzzingWithConstraints-synopsis-1.svg @@ -19,7 +19,7 @@ ISLaSolver - + __init__() diff --git a/notebooks/PICS/GUIFuzzer-synopsis-2.png b/notebooks/PICS/GUIFuzzer-synopsis-2.png index 9dd2838e6..609e798ad 100644 Binary files a/notebooks/PICS/GUIFuzzer-synopsis-2.png and b/notebooks/PICS/GUIFuzzer-synopsis-2.png differ diff --git a/notebooks/PICS/GUIFuzzer-synopsis-2.svg b/notebooks/PICS/GUIFuzzer-synopsis-2.svg index 0dada6ced..ebb3e4a67 100644 --- a/notebooks/PICS/GUIFuzzer-synopsis-2.svg +++ b/notebooks/PICS/GUIFuzzer-synopsis-2.svg @@ -52,8 +52,8 @@ fill('zip', '<number>') check('terms', <boolean>) -fill('name', '<text>') -fill('email', '<email>') +fill('email', '<email>') +fill('name', '<text>') fill('city', '<text>') submit('submit') diff --git a/notebooks/PICS/GUIFuzzer-synopsis-3.png b/notebooks/PICS/GUIFuzzer-synopsis-3.png index 169bb65b5..690810e98 100644 Binary files a/notebooks/PICS/GUIFuzzer-synopsis-3.png and b/notebooks/PICS/GUIFuzzer-synopsis-3.png differ diff --git a/notebooks/PICS/GrammarFuzzer-synopsis-2.png b/notebooks/PICS/GrammarFuzzer-synopsis-2.png index cc4d96e86..ea7edb318 100644 Binary files a/notebooks/PICS/GrammarFuzzer-synopsis-2.png and b/notebooks/PICS/GrammarFuzzer-synopsis-2.png differ diff --git a/notebooks/PICS/GrammarFuzzer-synopsis-2.svg b/notebooks/PICS/GrammarFuzzer-synopsis-2.svg index 1db1f3a0b..9eacc0bbb 100644 --- a/notebooks/PICS/GrammarFuzzer-synopsis-2.svg +++ b/notebooks/PICS/GrammarFuzzer-synopsis-2.svg @@ -137,7 +137,7 @@ 7 -4 (52) +7 (55) @@ -148,7 +148,7 @@ 9 -4 (52) +6 (54) @@ -192,7 +192,7 @@ 13 -6 (54) +4 (52) @@ -203,7 +203,7 @@ 15 -4 (52) +1 (49) @@ -214,7 +214,7 @@ 17 -4 (52) +0 (48) @@ -269,7 +269,7 @@ 21 -6 (54) +1 (49) @@ -280,7 +280,7 @@ 23 -1 (49) +8 (56) @@ -291,7 +291,7 @@ 25 -6 (54) +9 (57) @@ -302,7 +302,7 @@ 27 -3 (51) +5 (53) diff --git a/notebooks/PICS/GrammarMiner-synopsis-3.png b/notebooks/PICS/GrammarMiner-synopsis-3.png index b2a534f1a..085e51f68 100644 Binary files a/notebooks/PICS/GrammarMiner-synopsis-3.png and b/notebooks/PICS/GrammarMiner-synopsis-3.png differ diff --git a/notebooks/PICS/GrammarMiner-synopsis-3.svg b/notebooks/PICS/GrammarMiner-synopsis-3.svg index 9af18083f..d9f7d6527 100644 --- a/notebooks/PICS/GrammarMiner-synopsis-3.svg +++ b/notebooks/PICS/GrammarMiner-synopsis-3.svg @@ -28,7 +28,7 @@ - -https - -http \ No newline at end of file + +http + +https \ No newline at end of file diff --git a/notebooks/PICS/GrammarMiner-synopsis-4.png b/notebooks/PICS/GrammarMiner-synopsis-4.png index 5d6d21dd7..4d5c7eb42 100644 Binary files a/notebooks/PICS/GrammarMiner-synopsis-4.png and b/notebooks/PICS/GrammarMiner-synopsis-4.png differ diff --git a/notebooks/PICS/GrammarMiner-synopsis-4.svg b/notebooks/PICS/GrammarMiner-synopsis-4.svg index e9b7d51ad..059f1fff3 100644 --- a/notebooks/PICS/GrammarMiner-synopsis-4.svg +++ b/notebooks/PICS/GrammarMiner-synopsis-4.svg @@ -28,11 +28,11 @@ - -// -urlparse@394:netloc -urlsplit@481:url - -// -urlparse@394:netloc -/ \ No newline at end of file + +// +urlparse@394:netloc +/ + +// +urlparse@394:netloc +urlsplit@481:url \ No newline at end of file diff --git a/notebooks/PICS/GrammarMiner-synopsis-5.png b/notebooks/PICS/GrammarMiner-synopsis-5.png index 5382b4a53..87e8731cb 100644 Binary files a/notebooks/PICS/GrammarMiner-synopsis-5.png and b/notebooks/PICS/GrammarMiner-synopsis-5.png differ diff --git a/notebooks/PICS/GrammarMiner-synopsis-5.svg b/notebooks/PICS/GrammarMiner-synopsis-5.svg index b74b194a2..8a6f771a5 100644 --- a/notebooks/PICS/GrammarMiner-synopsis-5.svg +++ b/notebooks/PICS/GrammarMiner-synopsis-5.svg @@ -28,9 +28,9 @@ - -user:pass@www.google.com:80 - -www.fuzzingbook.org - -www.cispa.saarland:80 \ No newline at end of file + +www.fuzzingbook.org + +www.cispa.saarland:80 + +user:pass@www.google.com:80 \ No newline at end of file diff --git a/notebooks/PICS/GrammarMiner-synopsis-9.png b/notebooks/PICS/GrammarMiner-synopsis-9.png index a54a8865a..cf63b8171 100644 Binary files a/notebooks/PICS/GrammarMiner-synopsis-9.png and b/notebooks/PICS/GrammarMiner-synopsis-9.png differ diff --git a/notebooks/PICS/GrammarMiner-synopsis-9.svg b/notebooks/PICS/GrammarMiner-synopsis-9.svg index d93a76983..26f258c9f 100644 --- a/notebooks/PICS/GrammarMiner-synopsis-9.svg +++ b/notebooks/PICS/GrammarMiner-synopsis-9.svg @@ -28,7 +28,7 @@ - -ref - -News \ No newline at end of file + +News + +ref \ No newline at end of file diff --git a/notebooks/ReleaseNotes.ipynb b/notebooks/ReleaseNotes.ipynb index 4c4819d15..7d6782097 100644 --- a/notebooks/ReleaseNotes.ipynb +++ b/notebooks/ReleaseNotes.ipynb @@ -32,7 +32,8 @@ "\n", "* We now support **Python 3.10**. Using Python 3.9 should still work fine.\n", "* We fixed several typos throughout the book, using the awesome [LTeX](https://github.com/valentjn/vscode-ltex) grammar/spell checker\n", - "* `ProbabilisticGrammarMiner` now properly handles empty expansions ([Issue #154](https://github.com/uds-se/fuzzingbook/pull/154)) - thanks to [Martin Eberlein](https://github.com/martineberlein)!" + "* `ProbabilisticGrammarMiner` now properly handles empty expansions ([Issue #154](https://github.com/uds-se/fuzzingbook/pull/154)) - thanks to [Martin Eberlein](https://github.com/martineberlein)!\n", + "* We no longer support `fuzzingbook` DockerHub images." ] }, { @@ -250,7 +251,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.2 (main, Apr 22 2022, 17:40:25) [Clang 13.1.6 (clang-1316.0.21.2.3)]" + "version": "3.10.2" }, "toc": { "base_numbering": 1, diff --git a/notebooks/index.ipynb b/notebooks/index.ipynb index 4f82f3bbf..ad30f1677 100644 --- a/notebooks/index.ipynb +++ b/notebooks/index.ipynb @@ -109,6 +109,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -120,9 +121,7 @@ "\n", "2. **Download the Jupyter Notebooks** (using the menu at the top) and open them in Jupyter. Here's [how to install jupyter notebook on your machine](https://www.dataquest.io/blog/jupyter-notebook-tutorial/).\n", "\n", - "3. **Run the notebook locally** in a Docker container. For more information, see [How to use the book with Docker](https://github.com/uds-se/fuzzingbook/blob/master/deploy/README.md). \n", - "\n", - "4. If you want to use the book in a classroom, and depend on your users having access to the interactive notebooks, consider using or deploying a [JupyterHub](http://jupyter.org/hub) or [BinderHub](https://github.com/jupyterhub/binderhub) instance." + "3. If you want to use the book in a classroom, and depend on your users having access to the interactive notebooks, consider using or deploying a [JupyterHub](http://jupyter.org/hub) or [BinderHub](https://github.com/jupyterhub/binderhub) instance." ] }, { @@ -133,10 +132,11 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "We try to keep the code as general as possible, but occasionally, when we interact with the operating system, we assume a Unix-like environment (because that is what Binder provides). To run these examples on your own Windows machine, you can install a Linux VM or a [Docker environment](https://github.com/uds-se/fuzzingbook/blob/master/deploy/README.md)." + "We try to keep the code as general as possible, but occasionally, when we interact with the operating system, we assume a Unix-like environment (because that is what Binder provides). To run these examples on your own Windows machine, you can install a Linux Subsystem or a Linux Virtual Machine." ] }, {