28 lines
1.1 KiB
Markdown
28 lines
1.1 KiB
Markdown
# ZipBomb
|
|
|
|
This is for the people who watch Silicon Valley. In Season 3 Episode 7, Gilfoyle sends a sort of recursive program to Gavin Belson's laptop and cellphone which forces him to shut down the power at Hooli. Watch [here](https://www.youtube.com/watch?v=UdAqU4GRR9Y). Such an attack is called a [logic bomb](https://en.wikipedia.org/wiki/Logic_bomb).
|
|
|
|
What it is basically is a huge file with dummy data compressed to many levels to generate a very small compressed file. For example in a test run, this script generates a compressed file of size approximately 30.58 KiB which when decompressed is 10^10 GiB. This is done to drain out a computer's memory until a crash happens. Read more about zip bombs on [Wikipedia](https://en.wikipedia.org/wiki/Zip_bomb#Details_and_use).
|
|
|
|
`zipbomb.py` is a script written in Python 3 which generates such a zip bomb.
|
|
|
|
## Usage
|
|
|
|
```sh
|
|
zipbomb.py <n_levels> <out_zip_file>
|
|
```
|
|
|
|
### Sample run
|
|
|
|
```sh
|
|
zipbomb.py 10 ./out.zip
|
|
```
|
|
|
|
### Sample output
|
|
|
|
```
|
|
Compressed file size: 31314 bytes
|
|
Decompressed file size: 10737418240000000000 bytes
|
|
Generation time performance: 0.02222222222222
|
|
```
|