agourlay/zip-password-finder
GitHub: agourlay/zip-password-finder
一款基于 Rust 的多线程 ZIP 密码恢复工具,支持 ZipCrypto 与 AES 加密,提供暴力破解、字典和掩码三种攻击模式。
Stars: 551 | Forks: 57
# zip-password-finder
[](https://github.com/agourlay/zip-password-finder/actions/workflows/ci.yml)
[](https://crates.io/crates/zip-password-finder)
`zip-password-finder` 是一个用于查找受保护的 zip 文件密码的工具。
该工具的设计在以下博客文章中有详细描述:
- [在 Rust 中暴力破解受保护的 ZIP 档案](https://agourlay.github.io/brute-forcing-protected-zip-rust/)
- [关于在 Rust 中破解 ZIP 档案的后续](https://agourlay.github.io/follow-up-cracking-zip-rust/)
## 功能
- 同时支持 ZipCrypto 和 AES 加密
- 多线程,默认使用所有物理 CPU 核心
- 三种攻击模式:暴力破解、字典攻击和掩码攻击
- 支持通过 Ctrl-C 优雅中断,并显示最后测试的密码
- 可通过 `--startingPassword` 从特定密码恢复暴力破解
- 自动检测多文件档案中的加密文件
- 带有吞吐量和 ETA 的进度条
## 攻击模式
### 暴力破解(默认)
为给定的字符集和密码长度范围生成所有可能的密码。当未提供字典或掩码时,这是默认模式。
```
zip-password-finder -i archive.zip -c lud --minPasswordLen 1 --maxPasswordLen 6
```
可用的字符集预设包括:
```
l | abcdefghijklmnopqrstuvwxyz [a-z]
u | ABCDEFGHIJKLMNOPQRSTUVWXYZ [A-Z]
d | 0123456789 [0-9]
h | 0123456789abcdef [0-9a-f]
H | 0123456789ABCDEF [0-9A-F]
s | «space»!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
```
预设可以组合使用,例如 `lud`(默认)使用小写字母 + 大写字母 + 数字。
或者,可以通过 `--charsetFile` 提供自定义字符集文件。它应该是一个文本文件,包含一行用于生成的字符。
要恢复中断的暴力破解搜索,请使用 `--startingPassword` 向前跳过:
```
zip-password-finder -i archive.zip --startingPassword "abc"
```
### 字典
从文本文件中测试密码,每行一个单词。
```
zip-password-finder -i archive.zip -p wordlist.txt
```
### 掩码攻击
生成匹配特定模式的密码,其中每个位置都有自己的字符集。当您了解部分密码结构(例如,以大写字母开头,以数字结尾)时,这非常有用。
```
zip-password-finder -i archive.zip --mask '?u?l?l?l?d?d'
```
可用的掩码 token 包括:
```
?l | lowercase letters [a-z]
?u | uppercase letters [A-Z]
?d | digits [0-9]
?s | symbols
?a | all printable (lowercase + uppercase + digits + symbols)
?h | lowercase hex [0-9a-f]
?H | uppercase hex [0-9A-F]
?1 | custom charset 1 (--customCharset1)
?2 | custom charset 2 (--customCharset2)
?3 | custom charset 3 (--customCharset3)
?4 | custom charset 4 (--customCharset4)
?? | literal '?'
```
掩码中的任何其他字符都被视为字面量。
自定义字符集通过 `--customCharset1` 到 `--customCharset4` 定义,可以包含字面字符和/或内置 token。例如,`--customCharset1 "aeiou"` 定义元音,而 `--customCharset1 "?l?d"` 定义小写字母 + 数字。
示例:
```
# 3个小写字母后跟2位数字
zip-password-finder -i archive.zip --mask '?l?l?l?d?d'
# 已知前缀 "pass" 后跟4位数字
zip-password-finder -i archive.zip --mask 'pass?d?d?d?d'
# 大写字母、4个小写字母,然后是一个符号
zip-password-finder -i archive.zip --mask '?u?l?l?l?l?s'
# 自定义 charset:2个元音字母后跟一位数字
zip-password-finder -i archive.zip -1 "aeiou" --mask '?1?1?d'
```
## 安装
### Releases
使用 https://github.com/agourlay/zip-password-finder/releases 中提供的二进制文件
### Crates.io
通过 [crates.io](https://crates.io/crates/zip-password-finder) 使用 Cargo 安装。
```
cargo install zip-password-finder
```
### AUR
您可以使用 [AUR helper](https://wiki.archlinux.org/title/AUR_helpers) 从 AUR 安装 [`zip-password-finder`](https://aur.archlinux.org/packages?O=0&K=zip-password-finder)。例如:
```
paru -S zip-password-finder
```
## 使用方法
```
./zip-password-finder -h
Find the password of protected ZIP files
Usage: zip-password-finder [OPTIONS] --inputFile
Options:
-i, --inputFile path to zip input file
-w, --workers number of workers
-p, --passwordDictionary path to a password dictionary file
-c, --charset charset to use to generate password [default: lud]
--charsetFile path to a charset file
--minPasswordLen minimum password length [default: 1]
--maxPasswordLen maximum password length [default: 10]
--fileNumber file number in the zip archive [default: 0]
-s, --startingPassword password to start from
-m, --mask mask pattern for mask attack (e.g. '?l?l?l?d?d')
-1, --customCharset1 custom charset 1 for mask attack, referenced as ?1
-2, --customCharset2 custom charset 2 for mask attack, referenced as ?2
-3, --customCharset3 custom charset 3 for mask attack, referenced as ?3
-4, --customCharset4 custom charset 4 for mask attack, referenced as ?4
-h, --help Print help
-V, --version Print version
```
## 性能
对于 AES,请确保使用支持 `SHA` 指令的 CPU(Intel Sandy Bridge 或更新版本,AMD Bulldozer 或更新版本)以获得最佳性能。
Native 构建通常表现更好。
```
RUSTFLAGS="-C target-cpu=native" cargo build --release
```
worker 数量默认为物理 CPU 核心数。您可以使用 `--workers` 覆盖此设置,但由于资源竞争,使用超过物理核心数的 worker 通常没有帮助。
例如,在具有 16 线程的 8 核心 CPU 上,随着 worker 数量增加的可扩展性表现:

标签:DOS头擦除, PoC, Rust, SysWhispers, VEH, 压缩文件处理, 可视化界面, 字典攻击, 密码破解, 暴力破解, 用户模式钩子绕过, 网络流量审计, 通知系统