2 releases (1 stable)
new 1.0.0 | Jan 6, 2025 |
---|---|
0.1.0 | Dec 27, 2024 |
#211 in Cryptography
250 downloads per month
1.5MB
639 lines
pkcs12cracker High-performance, multi-threaded PKCS#12 password cracker written in Rust. Supports dictionary, pattern-based, and brute force attacks with focus on performance and reliability. |
Documentation
API reference and usage examples are available at docs.rs.
Installation
cargo install pkcs12cracker
# Brew tap (macOS)
brew tap wowinter13/pkcs12cracker
brew install pkcs12cracker
# Or build from source
git clone https://github.com/wowinter13/pkcs12cracker
cd pkcs12cracker
cargo build --release
Know-How
- Memory-mapped file handling for efficient dictionary processing
- Parallel processing with configurable thread count
- Cache-friendly chunk-based password cracking
- Optimized string handling and memory allocation
- Multiple attack strategies support
Tasks to Complete
- Benchmarks (memory, CPU, time, and operations per second).
- Implement tests for all modules.
Discussable:
- OS related performance optimizations.
- Explore advanced multithreading techniques (try scoped threads or another raw threading approach).
Basic Usage
Help
Fast, multi-threaded PKCS#12 password cracker
Usage: pkcs12cracker [OPTIONS] <FILE>...
Arguments:
<FILE>... Path to the PKCS#12 (.p12/.pfx) file to crack
Options:
-d, --dictionary <FILE> Use dictionary-based attack with the specified wordlist file
-p, --pattern <PATTERN> Use pattern-based attack (e.g., 'Pass@@rd' where '@' marks variable positions)
-s, --pattern-symbol <CHAR> Symbol to mark variable positions in pattern [default: @] [default: @]
-m, --min-length <NUM> Minimum password length for brute force attack [default: 1] [default: 1]
--max-length <NUM> Maximum password length for brute force attack [default: 6] [default: 6]
-b, --brute-force Enable brute force attack mode
-c, --charset <SETS> Character sets to use in brute force attack
--custom-chars <CHARS> Custom character set for brute force attack
--delimiter <CHAR> Dictionary file entry delimiter [default: newline] [default: "\n"]
-t, --threads <NUM> Number of cracking threads [default: number of CPU cores] [default: 1]
-h, --help Print help (see more with '--help')
-V, --version Print version
Dictionary Attack
Uses a wordlist file to crack passwords:
# Basic usage with newline-separated dictionary
pkcs12cracker -d wordlist.txt cert.p12
Pattern-Based Attack
Cracks passwords matching a specific pattern:
# Custom symbol for variable positions
pkcs12cracker -p "Pass##rd" -s "#" cert.p12
Brute Force Attack
# Custom character sets
pkcs12cracker -b -c aAn cert.p12 # alphanumeric
Advanced Usage
Character Sets
The -c
flag supports combining multiple character sets:
a
- lowercase letters (a-z)A
- uppercase letters (A-Z)n
- digits (0-9)s
- special characters (!@#$%^&*...)x
- all of the above
Examples:
# Uppercase + numbers
pkcs12cracker -b -c An cert.p12
# All characters except special
pkcs12cracker -b -c aAn cert.p12
# Everything
pkcs12cracker -b -c x cert.p12
Custom Character Sets
For specific requirements, use --custom-chars
:
# Combine with standard sets
pkcs12cracker -b -c an --custom-chars="!@#" cert.p12
Benchmarks
See BENCHMARKS.md for more information.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~5.5MB
~109K SLoC