Skip to content
V-ConetPublic

About

Extract or list .dzip archives

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

DZIP Extractor

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.


English

Dependencies

  • Python 3.7+
  • pycryptodome -- only required for encrypted archives.
pip install pycryptodome

Usage

usage: 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

Examples

# 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.dzip

dzip format

A .dzip file is a standard ZIP with two modifications:

  1. Signature swap. The 2-byte prefix PK (0x504B) is replaced with UA (0x5541) in all four record signatures:

    Record ZIP dzip
    Local file header PK\x03\x04 UA\x03\x04
    Data descriptor PK\x07\x08 UA\x07\x08
    Central directory header PK\x01\x02 UA\x01\x02
    End of central directory PK\x05\x06 UA\x05\x06

    Everything else (header layout, little-endian sizes, deflate payload, central directory) is plain ZIP.

  2. AES password twist. Encrypted entries use WinZip AES (method 99, 0x9901 extra field, AE-1, layout salt + 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 0x1a51 extra field (17 00 20 00 + 32 bytes).

Limitations

  • 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 pycryptodome

功能

usage: 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 格式

.dzip 是标准 ZIP 加了两处改动:

  1. 签名替换。 四种记录签名的前两字节 PK(0x504B) 被换成 UA(0x5541):

    记录 ZIP dzip
    本地文件头 PK\x03\x04 UA\x03\x04
    数据描述符 PK\x07\x08 UA\x07\x08
    中央目录头 PK\x01\x02 UA\x01\x02
    目录结束记录 PK\x05\x06 UA\x05\x06

    其余(头部布局、小端长度、deflate 流、中央目录)全是标准 ZIP。

  2. AES 密码修改。 加密条目用 WinZip AES(method 99、0x9901 extra 字段、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 标记)。

Detailed reverse engineering :

License

MIT

About

Extract or list .dzip archives

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages