hornikmatej/pdf_pycrack
GitHub: hornikmatej/pdf_pycrack
一款基于Python的并行PDF密码破解工具,支持多核处理和可自定义参数。
Stars: 0 | Forks: 0
# PDF-PyCrack
[](https://badge.fury.io/py/pdf-pycrack)
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
[](https://github.com/psf/black)
[](https://github.com/astral-sh/uv)
**一个尚未达到极致速度的并行 PDF 密码破解工具,支持 Python 3.12+。**
## 目录
- [功能](#features)
- [安装](#installation)
- [快速开始](#quick-start)
- [使用方法](#usage)
- [性能测试](#benchmarking)
- [测试与错误处理](#testing--error-handling)
- [贡献指南](#contributing)
- [许可证](#license)
## 功能
- **多核破解:** 利用所有 CPU 核心实现最大速度。
- **高效内存使用:** 处理大型 PDF 文件时占用最小内存。
- **弹性工作进程:** 工作进程优雅处理错误,主进程继续运行。
- **进度跟踪:** 实时进度条和统计数据。
- **可自定义:** 可调整密码长度、字符集、批处理大小等。
- **全面的错误处理:** 清晰的错误消息和针对所有边缘情况的健壮测试覆盖。
## 安装
从 PyPI 安装(推荐):
```
uv pip install pdf-pycrack
```
开发安装:
```
git clone https://github.com/hornikmatej/pdf_pycrack.git
cd pdf_pycrack
uv sync
```
## 快速开始
```
uv run pdf-pycrack --help
```
## 使用方法
**基本用法:**
```
uv run pdf-pycrack tests/test_pdfs/numbers/100.pdf
```
**自定义字符集和长度:**
```
uv run pdf-pycrack tests/test_pdfs/letters/ab.pdf --min-len 2 --max-len 2 --charset abcdef
```
### 作为 Python 库使用
您还可以在 Python 代码中以编程方式使用 pdf-pycrack:
```
from pdf_pycrack import crack_pdf_password, PasswordFound
result = crack_pdf_password(
pdf_path="my_encrypted_file.pdf",
min_len=4,
max_len=6,
charset="0123456789"
)
if isinstance(result, PasswordFound):
print(f"Password found: {result.password}")
```
## 性能测试
使用高级性能测试工具测量和比较密码破解速度:
```
uv run python benchmark/benchmark.py --standard
```
**性能回归测试:**
```
# 检查最新 benchmark 性能 regression
uv run python benchmark/regression_detector.py
# 使用自定义 threshold 检查并在 regression 时失败
uv run python benchmark/regression_detector.py --threshold 10.0 --fail-on-regression
```
**自定义运行:**
```
uv run python benchmark/benchmark.py --pdf tests/test_pdfs/letters/ab.pdf --min-len 1 --max-len 2 --charset abcdef
uv run python benchmark/benchmark.py --processes 4 --batch-size 1000
```
结果以 JSON 和 CSV 格式保存在 `benchmark/results/` 中。该系统通过与最近的基准进行比较来自动检测性能回归。请参阅 [`benchmark/README.md`](
标签:DOS头擦除, PDF, PoC, 代码生成, 加密文件破解, 多进程, 密码攻击, 密码破解, 并行计算, 暴力破解, 暴力破解攻击, 渗透测试工具, 逆向工具