Skip to content

About

FOR EDUCATIONAL PURPOSE ONLY!

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

Zip-Bomb

What is a Zip bomb?

In computing, a zip bomb, also known as a decompression bomb or zip of death, is a malicious archive file designed to crash or render useless the program or system reading it.


⚠️ IMPORTANT

AS THE CREATOR, I AM NOT RESPONSIBLE FOR ANY DAMAGES! PLEASE USE WITH CARE!


Script Usage

Basic Syntax

python zipbomb.py --mode [flat|nested] [OPTIONS]

Available Options

Flat Mode (Recommended for custom content & speed)

--mode flat
--files NUM             Number of files to generate (default: 100)
--name NAME             Base filename (default: file)
--size SIZE             Per-file size (e.g., 10MB, 5GB, 1TB) (default: 10MB)
--content PATTERN       Custom content pattern (default: "0")
--output FILE           Output ZIP filename (default: bomb.zip)
--workers NUM           Worker processes (default: CPU cores)
--no-repeat             Use null bytes instead of repeating pattern
--include-dirs PATH     Comma-separated directories to include
--include-files PATH    Comma-separated files to include

Nested Mode (Maximum compression)

--mode nested
--size SIZE             Total decompressed size in MB (default: 1024)
--output FILE           Output ZIP filename (default: bomb.zip)
--include-dirs PATH     Comma-separated directories to include
--include-files PATH    Comma-separated files to include

Usage Examples

Flat Mode - Basic (100 files, 10MB each)

python zipbomb.py --mode flat --files 100 --size 10MB --output out.zip

Flat Mode - With Custom Content Pattern

python zipbomb.py --mode flat --files 50 --size 20MB --content "AAABBBCCC" --output out.zip

Flat Mode - With Multiple Workers (Parallel)

python zipbomb.py --mode flat --files 200 --size 50MB --workers 8 --output bomb.zip

Flat Mode - Large Files (Using Size Units)

python zipbomb.py --mode flat --files 10 --size 5GB --output mega_bomb.zip

Flat Mode - Null Bytes Only (No Pattern Repeat)

python zipbomb.py --mode flat --files 100 --size 10MB --no-repeat --output bomb.zip

Nested Mode - Classic Nested ZIP (More Compressed)

python zipbomb.py --mode nested --size 1024 --output out.zip

Nested Mode - Very Large File

python zipbomb.py --mode nested --size 10240 --output large_bomb.zip

Include Real Files/Directories

python zipbomb.py --mode flat --files 50 --size 10MB --include-files "file1.txt,file2.txt" --output out.zip
python zipbomb.py --mode nested --size 2048 --include-dirs "folder1,folder2" --output out.zip

V2 Features

✨ New in V2:

  • Parallel Processing: Multi-threaded file generation for faster creation
  • Flexible Size Units: Support for KB, MB, GB, TB (not just MB)
  • Custom Content Patterns: Create bombs with custom repeating patterns
  • Progress Bars: Visual progress tracking for file generation and zipping
  • Better Error Handling: Validation and user-friendly error messages
  • Null Byte Option: --no-repeat flag for null-byte-only files
  • Worker Control: Specify number of parallel workers for optimization
  • Named Arguments: More flexible, easier-to-remember command syntax
  • Color Output: Colored terminal messages for better readability
  • Automatic Detection: Smart warnings for unrealistic sizes (>1TB)

Mode Comparison

Feature Flat Nested
File Structure Many individual files Zip within zip within zip
Compression Ratio Lower (better for transfer) Higher (much smaller file size)
Speed Fast (parallel processing) Slower (recursive zipping)
Customization High (patterns, content) Limited
Best For Quick testing, custom patterns Maximum compression
Minimum Size Any positive number 500 MB recommended

Dependencies

pip install colorama

Requirements

  • Python 3.6+
  • colorama library (for colored output)

Installation

pip install -r lib.txt

Or manually:

pip install colorama

Preview

Preview Script

prev

Zip Size Before Extraction (Flat)

Compressed Size

Zip Size After Extraction (Flat)

Extracted Size

Nested Mode - Multi-level Structure

Nested Structure


Performance Tips

  1. For Maximum Speed: Use flat mode with multiple workers

    python zipbomb.py --mode flat --files 500 --size 50MB --workers 16
    
  2. For Maximum Compression: Use nested mode

    python zipbomb.py --mode nested --size 10240
    
  3. For Custom Content: Use flat mode with pattern

    python zipbomb.py --mode flat --content "PAYLOAD" --files 100 --size 10MB
    
  4. For Large Files: Use size units and parallel processing

    python zipbomb.py --mode flat --files 20 --size 5GB --workers 8
    

Troubleshooting

Error: "size must be a number"

  • Nested mode expects a number in MB, not units like "1GB"
  • Use: --size 1024 for 1GB equivalent

Warning: "You requested X workers, but only Y CPU cores available"

  • The script detected more workers than CPU cores
  • It will auto-adjust or ask for confirmation

Warning: "Total size exceeds 1 TB"

  • For very large sizes, the script will ask for confirmation before proceeding

Legal Notice

This tool is for educational and authorized security testing purposes only. Unauthorized creation or distribution of zip bombs is illegal. The creator is not responsible for any misuse or damage caused by this script.


Changelog

V2.0

  • Complete rewrite of flat mode with parallel processing
  • Added colorama for colored output
  • New flexible size parsing (KB, MB, GB, TB)
  • Custom content patterns support
  • Worker process configuration
  • Progress bars for generation and zipping
  • Improved error handling and validation
  • Better nested mode visualization

About

FOR EDUCATIONAL PURPOSE ONLY!

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages