| Crates.io | pkcrack |
| lib.rs | pkcrack |
| version | 0.1.0 |
| created_at | 2025-12-04 14:56:01.2491+00 |
| updated_at | 2025-12-04 14:56:01.2491+00 |
| description | A Rust implementation of pkcrack - Known-plaintext attack against PkZip encryption |
| homepage | https://gitcode.net/dnrops/pkcrack |
| repository | https://gitcode.net/dnrops/pkcrack |
| max_upload_size | |
| id | 1966567 |
| size | 138,281 |
A complete Rust implementation of the known-plaintext attack against PkZip encryption, based on the original C implementation by Peter Conrad.
This tool implements the Biham/Kocher known-plaintext attack against the proprietary PkZip encryption scheme (also known as ZipCrypto). The attack is divided into three main stages:
git clone <repository>
cd pkcrack
cargo build --release
The compiled binary will be available at target/release/pkcrack (or pkcrack.exe on Windows).
# Attack encrypted file with known plaintext
pkcrack -c encrypted.zip -p known_plaintext.txt
# Specify custom offset
pkcrack -c encrypted.zip -p known_plaintext.txt -o 12
# Extract files from ZIP archives
pkcrack -C encrypted.zip -c "secret.txt" -P plaintext.zip -p "secret.txt"
pkcrack -C flag.zip -c "key.txt" -P key.zip -p "key.txt"
Usage: pkcrack.exe [OPTIONS]
Options:
-c, --ciphertext <CIPHERTEXT> Ciphertext file
-p, --plaintext <PLAINTEXT> Plaintext file
-C, --ciphertext-zip <CIPHERTEXT_ZIP> ZIP archive containing ciphertext
-P, --plaintext-zip <PLAINTEXT_ZIP> ZIP archive containing plaintext
-d, --decrypt <OUTPUT_ZIP> Output decrypted ZIP archive
-o, --offset <OFFSET> Offset of plaintext into ciphertext (may be negative) [default: 12]
-i, --case-sensitive Case-sensitive filename matching in ZIP archives
-a, --abort Abort key searching after first success
-n, --no-progress Disable progress indicator
-h, --help Print help
# You have an encrypted ZIP file and know part of its contents
pkcrack -c secret.zip -p known_text.txt
# The program will:
# 1. Load both files
# 2. Execute the three-stage attack
# 3. Display results including recovered keys and/or password
# Extract encrypted file from ZIP and known plaintext from another ZIP
pkcrack -C archive.zip -c "secret.txt" -P known.zip -p "known.txt" -d decrypted.zip
# Use custom offset and disable progress indicator
pkcrack -c encrypted.dat -p plaintext.dat -o 8 -n -a
The attack works in three stages:
Two possible approaches:
The tool provides:
This tool is designed for:
IMPORTANT: Only use on files you own or have explicit permission to analyze.
The attack exploits weaknesses in PkZip's key initialization:
key3[n] = plaintext[n] XOR ciphertext[n]The algorithm maintains three 32-bit keys:
Run the test suite:
cargo test
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is for educational and research purposes only. Users are responsible for ensuring compliance with applicable laws and regulations.