This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: Name change to DefuseZip due commercial product of the same name.
SecureZip
Table of contents
Description / General info
I couldn't find an opensource ZipBomb blocker, so this is my attempt at making one.
It is a work in progress, but the scan feature is usable and safe_extract works for linux.
DO NOT EXTRACT THE EXAMPLE ZIPS! It will make you sad. No one wants you to be sad.
They are malicious by intent and only for testing purposes.
Installation:
pip install SecureZip
Usage:
SecureZip.Loader parameters:
- [REQUIRED] zip_file: Path to zip
- [OPTIONAL] ratio_threshold: compression ratio threshold when to rule the zip malicious. Default = 1032
- [OPTIONAL] nested_zips_limit: Total zip count when to abort and rule the zip malicious. Default = 3
- [OPTIONAL] nested_levels_limit: Limit when to abort travelling the zips and rule the zip malicious. Default = 2
- [OPTIONAL] killswitch_seconds: Seconds to allow traversing the zip. After the limit is hit, zip is ruled malicious. Default = 1
- [OPTIONAL] symlinks_allowed: Boolean. Default = False
- [OPTIONAL] directory_travelsal_allowed: Boolean. Default = False
Loader methods:
- is_dangerous() -> bool
- has_travelsal() -> bool
- has_links() -> bool
from pathlib import Path
import SecureZip
file = Path('myzip.zip')
zip = SecureZip.Loader(zip_file=file)
if zip.scan() and zip.get_compression_ratio() > 1032:
print(zip.output())
else:
#do something with the zip
from pathlib import Path
import SecureZip
file = Path('myzip.zip')
zip = SecureZip.Loader(zip_file=file)
zip.scan() # Returns true when zip should be considered malicious
if zip.is_dangerous(): # Returns true when zip should be considered malicious
do stuff
Example output from output() after calling scan() -> bool
-
Single file in zip
Dangerous: False Message = Success Compression Ratio = 0.77 Uncompressed size: 907.00 bytes Compressed size: 1.16 kilobytes Nested zips = 0 Nest Levels = 0 Symlinks = False -
Double nested zips -- with maximum nesting set to 4 : SecureZip.Loader(..., nested_zips_limit=4)
Dangerous: True Message = Success Compression Ratio = 0.58 Uncompressed size: 922.00 bytes Compressed size: 1.55 kilobytes Nested zips = 5 Nest Levels = 2 Symlinks = False -
97tb / 14,5kb zipbomb -- with 5s killswitch enabled to prevent long scan time : SecureZip.Loader(..., killswitch_seconds=5)
Dangerous: True Message = Killswitch enabled due to too deep recursion or timeout, values collected are valid only to that point Compression Ratio = 125869951.52 Uncompressed size: 1.69 terabytes Compressed size: 14.45 kilobytes Nested zips = 1930 Nest Levels = 100 Symlinks = False -
4.5pb / 46mb BAMSOFTWARE zbxl FLAT zipbomb
Dangerous: True Message = Success Compression Ratio = 98262444.02 Uncompressed size: 4.00 petabytes Compressed size: 43.75 megabytes Nested zips = 0 Nest Levels = 0 Symlinks = False
Metadata
Release files for SecureZip 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| SecureZip-0.0.2.tar.gz | 4.8 kB | Without provenance | Details for SecureZip-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| SecureZip-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for SecureZip-0.0.2-py3-none-any.whl |
Total release size: 10.7 kB
Release files / SecureZip-0.0.2.tar.gz
| Download URL | SecureZip-0.0.2.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5eea98dc3d12b2699a568ad636a46fe6261e567f924497603daa8faa2d488c61
|
|
BLAKE2b-256 checksum How to use checksums |
e7e8df3fb470d6c27e53dadccb240ee1da8cc25e8e3fd63203fb7762c1b32eba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.5
|
Release files / SecureZip-0.0.2-py3-none-any.whl
| Download URL | SecureZip-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
971ccc93a788318efbb9008f782e0031b809368a0271cb03ce13525201b3beb9
|
|
BLAKE2b-256 checksum How to use checksums |
2d945435d3f31256df9a3eac25fff24447766fe56acdcf0aaac7fa80c5763212
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.5
|
Security for SecureZip 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.