Get up and running with PDF-PyCrack in under 5 minutes! This guide will walk you through your first password cracking session.
Make sure you have PDF-PyCrack installed. If not, see the Installation Guide.
# Verify installation
pdf-pycrack --help
Let’s start with a simple example using one of the test files included in the repository.
If you installed from source, you can use the test files:
# Navigate to the project directory
cd pdf_pycrack
# Use a simple test file with password "100"
uv run pdf-pycrack tests/test_pdfs/numbers/100.pdf
If you don’t have the test files, you can create a simple encrypted PDF for testing or use your own file.
# Basic crack with default settings
pdf-pycrack your_file.pdf
You’ll see output like this:
🔒 PDF-PyCrack v0.1.0
📄 File: your_file.pdf
🎯 Testing passwords: length 4-5, charset: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
🖥️ Using 8 CPU cores, batch size: 100
Cracking: 100%|████████████████| 14776336/14776336 [00:45<00:00, 325891.23it/s]
✅ Password found: "secret"
⏱️ Time: 45.23 seconds
🔢 Passwords tested: 14,776,336
📊 Rate: 325,891 passwords/second
Let’s break down what you’re seeing:
If you suspect the password is numeric only:
pdf-pycrack file.pdf --charset-numbers --min-len 4 --max-len 8
For alphabetic passwords:
pdf-pycrack file.pdf --charset-letters --min-len 6 --max-len 10
If you know the password contains only specific characters:
pdf-pycrack file.pdf --charset-custom "abcdef123456" --min-len 5 --max-len 7
For unknown passwords (warning: this can take a very long time!):
pdf-pycrack file.pdf --charset-numbers --charset-letters --charset-special --min-len 1 --max-len 6
Begin with shorter password lengths and expand if needed:
# Start with 1-4 characters
pdf-pycrack file.pdf --min-len 1 --max-len 4
# If not found, try 5-6
pdf-pycrack file.pdf --min-len 5 --max-len 6
The smaller the character set, the faster the cracking:
# Numbers only (10 characters) - fastest
pdf-pycrack file.pdf --charset-numbers
# Letters only (52 characters) - medium
pdf-pycrack file.pdf --charset-letters
# All characters (94 characters) - slowest
pdf-pycrack file.pdf --charset-numbers --charset-letters --charset-special
Use all available cores but leave some headroom for system tasks:
# Use 6 cores instead of all 8 on an 8-core system
pdf-pycrack file.pdf --cores 6
You can also use PDF-PyCrack programmatically:
from pdf_pycrack import crack_pdf_password, PasswordFound
# Basic usage
result = crack_pdf_password("encrypted_file.pdf")
# Custom parameters
result = crack_pdf_password(
pdf_path="file.pdf",
min_len=4,
max_len=6,
charset="0123456789",
cores=4,
batch_size=1000
)
# Handle results
if isinstance(result, PasswordFound):
print(f"Success! Password: {result.password}")
print(f"Time taken: {result.duration:.2f} seconds")
print(f"Passwords tested: {result.passwords_tested:,}")
else:
print(f"Failed: {result}")
Here are rough time estimates for different scenarios on a modern 8-core CPU:
Password Type | Length | Character Set | Estimated Time |
---|---|---|---|
Numeric | 4 digits | 0-9 | < 1 second |
Numeric | 6 digits | 0-9 | < 10 seconds |
Alphabetic | 4 letters | a-z | < 30 seconds |
Alphabetic | 6 letters | a-z | ~10 minutes |
Mixed | 4 chars | a-z, A-Z, 0-9 | ~2 minutes |
Mixed | 6 chars | a-z, A-Z, 0-9 | ~6 hours |
Full | 6 chars | All printable | ~24 hours |
!!! warning “Time Complexity” Password cracking time grows exponentially with length and character set size. A 8-character password with full character set could take years to crack!
# DON'T do this first
pdf-pycrack file.pdf --min-len 1 --max-len 12 --charset-numbers --charset-letters --charset-special
# DO this instead
pdf-pycrack file.pdf --min-len 4 --max-len 6 --charset-numbers
Read error messages carefully - they often contain helpful suggestions.
# Verify the file is actually encrypted
pdf-pycrack file.pdf --min-len 1 --max-len 1 --charset-numbers
Now that you’ve run your first crack, explore more advanced features:
If you run into issues:
Solution: Try expanding your search parameters:
# Increase length range
pdf-pycrack file.pdf --min-len 1 --max-len 8
# Try different character sets
pdf-pycrack file.pdf --charset-letters --charset-special
Solution: The PDF doesn’t have a password. Verify with:
# Check if file opens without password in PDF viewer
Solution: Reduce search space:
# Use smaller character set or length range
pdf-pycrack file.pdf --charset-numbers --max-len 6
Happy cracking! 🔓