A pure-Python extractor for the .dzip archive format -- a custom ZIP variant used by 解压专家 (com.unzip.unzipmasterjar / com.fileunzip.zxwknight). It reverses the format's signature swap and its non-standard WinZip-AES password handling.
undzip.py handles both unencrypted and AES-encrypted .dzip files.
- Python 3.7+
pycryptodome-- only required for encrypted archives.
pip install pycryptodomeusage: undzip.py [-h] [-o OUTPUT] [-l] [-p PASSWORD] archives [archives ...]
Extract or list .dzip archives (UA-magic ZIP variant).
positional arguments:
archives .dzip file(s) to read
options:
-h, --help show this help message and exit
-o, --output OUTPUT directory to extract into (default: current dir)
-l, --list list archive contents instead of extracting
-p, --password PASSWORD
password for AES-encrypted entries# List contents (no password needed)
python3 undzip.py -l archive.dzip
# Extract an unencrypted archive into ./out
python3 undzip.py -o out archive.dzip
# Extract an AES-encrypted archive (supply the user password; the extra
# byte is recovered automatically)
python3 undzip.py -p 123456789 -o out encrypted.dzip
# Multiple archives at once
python3 undzip.py -p zyzy a.dzip b.dzip c.dzipA .dzip file is a standard ZIP with two modifications:
-
Signature swap. The 2-byte prefix
PK(0x504B) is replaced withUA(0x5541) in all four record signatures:Record ZIP dzip Local file header PK\x03\x04UA\x03\x04Data descriptor PK\x07\x08UA\x07\x08Central directory header PK\x01\x02UA\x01\x02End of central directory PK\x05\x06UA\x05\x06Everything else (header layout, little-endian sizes, deflate payload, central directory) is plain ZIP.
-
AES password twist. Encrypted entries use WinZip AES (method 99,
0x9901extra field, AE-1, layoutsalt + verify(2) + ciphertext + auth(10), PBKDF2-HMAC-SHA1 / 1000 iterations / AES-CTR little-endian counter from 1). But the encoder appends one random byte ((X % 241) + 1, per-archive) to the user's password before PBKDF2, so the raw password never verifies.
Two further custom artifacts exist but are not needed for extraction:
- a 64-byte footer appended after the EOCD (
comment_len == 0), - a per-entry
0x1a51extra field (17 00 20 00+ 32 bytes).
- Traditional ZipCrypto (GP-flag bit 0 with method != 99) is not supported (no sample encountered).
- The whole file is read into memory; very large archives use RAM proportionally.
- Zip64 is not handled (the samples are version 2.0 / 5.1, no Zip64 markers).
undzip.py 是针对 .dzip 格式的纯 Python 解压器。.dzip 是 解压专家(com.unzip.unzipmasterjar / com.fileunzip.zxwknight)使用的一种 ZIP 变体,解压时需要还原它的签名替换和非标准的 WinZip AES 密码处理。
- Python 3.7+
pycryptodome-- 仅在解压加密压缩包时需要。
pip install pycryptodomeusage: undzip.py [-h] [-o OUTPUT] [-l] [-p PASSWORD] archives [archives ...]
Extract or list .dzip archives (UA-magic ZIP variant).
positional arguments:
archives .dzip file(s) to read
options:
-h, --help show this help message and exit
-o, --output OUTPUT directory to extract into (default: current dir)
-l, --list list archive contents instead of extracting
-p, --password PASSWORD
password for AES-encrypted entries# 列出内容(无需密码)
python3 undzip.py -l archive.dzip
# 解压非加密归档到 ./out
python3 undzip.py -o out archive.dzip
# 解压 AES 加密归档
python3 undzip.py -p 123456789 -o out encrypted.dzip
# 一次处理多个归档
python3 undzip.py -p zyzy a.dzip b.dzip c.dzip.dzip 是标准 ZIP 加了两处改动:
-
签名替换。 四种记录签名的前两字节
PK(0x504B) 被换成UA(0x5541):记录 ZIP dzip 本地文件头 PK\x03\x04UA\x03\x04数据描述符 PK\x07\x08UA\x07\x08中央目录头 PK\x01\x02UA\x01\x02目录结束记录 PK\x05\x06UA\x05\x06其余(头部布局、小端长度、deflate 流、中央目录)全是标准 ZIP。
-
AES 密码修改。 加密条目用 WinZip AES(method 99、
0x9901extra 字段、AE-1、布局salt + verify(2) + ciphertext + auth(10)、PBKDF2-HMAC-SHA1 / 1000 轮 / AES-CTR 小端计数器从 1 开始)。但编码器在 PBKDF2 之前往用户密码末尾追加了一个随机字节((X % 241) + 1,每个压缩包一个)。
另外两个自定义产物解压时用不到:EOCD 之后追加的 64 字节 footer(comment_len == 0),以及每条目的 0x1a51 extra 字段(17 00 20 00 + 32 字节)。
- 不支持传统 ZipCrypto(GP flag bit0 且 method != 99)。
- 整文件读入内存,超大归档按比例占内存。
- 不处理 Zip64(样本为 version 2.0 / 5.1,无 Zip64 标记)。
MIT