A powerful Python tool for extracting password hashes from encrypted PDF files for use with password cracking tools like Hashcat and John the Ripper.
- ✅ Multi-format PDF Support: Handles PDF 1.1-1.3, 1.4-1.6, and 1.7 encryption
- ✅ Multiple Hash Formats: Supports both MD5 (40-char) and SHA-256 (64-char) hashes
- ✅ Robust Extraction: Handles different PDF string formats (parentheses, angle brackets, square brackets)
- ✅ Hash Validation: Validates extracted hashes to ensure correctness
- ✅ Multiple Output Formats: Creates files compatible with Hashcat, John the Ripper, and other tools
- ✅ Comprehensive Debugging: Shows detailed PDF structure analysis
- ✅ Beautiful CLI: Color-coded output with progress indicators
- Clone the repository:
git clone https://github.com/yourusername/PDF-Hash-Extractor.git
cd PDF-Hash-Extractor- Install required dependencies:
pip install PyPDF2python pdf_hash_extractor.py encrypted.pdfpython pdf_hash_extractor.py encrypted.pdf -o hash.txt# Extract hash and display on screen
python pdf_hash_extractor.py "CASHAPP TRANSFER SAUCE 2025.pdf"
# Extract hash and save to file
python pdf_hash_extractor.py "document.pdf" -o extracted_hash.txt
# Extract hash with custom output filename
python pdf_hash_extractor.py "secure.pdf" --output my_hash.txt| PDF Version | Adobe Acrobat | Hash Type | Hashcat Mode |
|---|---|---|---|
| 1.1-1.3 | 2-4 | MD5/SHA-256 + RC4 | 10400 |
| 1.4-1.6 | 5-8 | MD5/SHA-256 + RC4 | 10500 |
| 1.7 | 9+ | MD5/SHA-256 + AES-256 | 10501 |
The tool creates multiple output formats:
- Hashcat Format:
$pdf$1*1*40*hash1*hash2 - John the Ripper Format: Compatible with JtR
- Clean Format: Simplified hash format
╔══════════════════════════════════════════════════════════════╗
║ PDF HASH EXTRACTOR ║
║ ║
║ Extract password hashes from PDF files for Hashcat ║
║ ║
║ 🔓 Extract • 📝 Hash • 🚀 Ready for Hashcat ║
╚══════════════════════════════════════════════════════════════╝
🔄 Reading PDF file: document.pdf
🔄 Analyzing PDF structure...
ℹ️ Found encryption parameters:
Owner password (O) - angle brackets: [b'8b0207cafd2d6bbf...']
User password (U) - angle brackets: [b'0eb75dbfd72cf2b3...']
Permissions (P): [b'2', b'-4']
Version (V): [b'5', b'8']
Revision (R): [b'0', b'7']
🔄 Trying PDF 1.4-1.6 (MD5 + RC4)...
✅ Hash validation passed: Hash format is valid
✅ Hash extracted successfully!
ℹ️ PDF Type: PDF 1.4-1.6 (SHA-256 + RC4)
Extracted Hash:
$pdf$1*1*64*8b0207cafd2d6bbf535bade69e0691848984138f6163360a02f902758e2dfe51*0eb75dbfd72cf2b349d578ab05b5b1490122456a91bae5134273a6db134c87c4
✅ Hash saved to: hash.txt
✅ Hash saved in hashcat format: hash_hashcat.txt
✅ Hash saved in john format: hash_john.txt
✅ Hash saved in clean format: hash_clean.txt
Once you have the extracted hash, you can use it with password cracking tools:
# Dictionary attack
hashcat -m 10500 -a 0 hash.txt wordlist.txt
# Brute force attack
hashcat -m 10500 -a 3 hash.txt ?a?a?a?a?a?a?a?a
# Mask attack
hashcat -m 10500 -a 3 hash.txt ?d?d?d?d?d?d?d?djohn --wordlist=wordlist.txt hash.txtPDF-Hash-Extractor/
├── pdf_hash_extractor.py # Main extraction script
├── extract_hash.bat # Windows batch file for easy execution
├── crack_pdf.bat # Password cracking helper script
├── README.md # This file
└── .gitignore # Git ignore file
- Python 3.6+
- PyPDF2 library
- Password-protected PDF file
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is for educational and authorized testing purposes only. Only use it on PDF files you own or have explicit permission to test. The authors are not responsible for any misuse of this tool.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include the PDF version and error messages
- Initial release
- Support for PDF 1.1-1.7 encryption
- Multiple hash format support
- Hash validation
- Multiple output formats
- Comprehensive debugging output