Skip to content

sabercodes/PDF_Password_Cracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

🔓 PDF Password Cracker

A simple Python script that recovers a forgotten password from an encrypted PDF using a dictionary attack. It tries passwords from a wordlist one by one until it finds the correct one, then saves a clean decrypted copy — all automatically, with no configuration needed.


⚠️ Disclaimer

This tool is intended only for recovering passwords from PDF files you own or have explicit permission to unlock. Using this tool on files you do not own is illegal and unethical. The author takes no responsibility for misuse.


📋 How It Works

  1. You place your locked PDF in the same folder as the script.
  2. The script automatically finds it — no file paths to edit.
  3. It reads each password from common_passwords.txt (14 million+ real-world passwords) and tries it against the PDF.
  4. When the correct password is found, it saves a decrypted copy named unlocked_yourfile.pdf in the same folder.
  5. If no password matches, it tells you the wordlist was exhausted.

🖥️ Requirements

  • Python 3.7 or higher
  • PyPDF2 library

Install Python

Download from https://www.python.org/downloads/

✅ During installation, check "Add Python to PATH"

Install PyPDF2

Open your terminal (Command Prompt on Windows, Terminal on Mac/Linux) and run:

pip install PyPDF2

🚀 How to Use

Step 1 — Set up the project folder

Make sure all three files are in the same folder:

pdf-crack/
├── pdf_crack_script.py
├── common_passwords.txt
└── your_locked_file.pdf     ← place your PDF here

That's it. No editing the script.

Step 2 — Run the script

Open a terminal in that folder and run:

python pdf_crack_script.py

On Windows, you can also double-click the script if Python is installed.

Step 3 — Wait for results

The script will show live progress:

==================================================
       PDF Password Cracker
==================================================

[*] Target PDF  : my_document.pdf
[*] Wordlist    : common_passwords.txt
[*] Output will : unlocked_my_document.pdf
--------------------------------------------------
[*] PDF is encrypted. Starting password search...

[*] Tried 1,000 passwords so far...
[*] Tried 2,000 passwords so far...

[+] Password found : sunshine
[+] Saving decrypted copy...
[+] Done! Saved as : unlocked_my_document.pdf

The unlocked file will appear in the same folder as the script.


📂 Multiple PDFs

If the script finds more than one PDF in the folder, it will ask you to choose:

[?] Multiple PDF files found in this folder:
    [1] report.pdf
    [2] invoice.pdf

Enter the number of the PDF you want to unlock:

❓ Common Issues

Problem Solution
ModuleNotFoundError: No module named 'PyPDF2' Run pip install PyPDF2 in your terminal
[!] Wordlist not found Make sure common_passwords.txt is in the same folder as the script
[!] No PDF file found Place your locked PDF in the same folder as the script
[*] This PDF is not password-protected The PDF has no password — nothing to crack
[-] Password not found in the wordlist The password wasn't in the list — it may be too complex or unusual

🔑 About the Wordlist

common_passwords.txt contains 14+ million real-world passwords from the famous RockYou data leak. It covers the vast majority of weak and common passwords. If your password was something simple (a word, name, number, or common phrase), it's very likely in this list.

If the password is not found, it means the PDF was protected with a strong or unique password, and a larger/specialized wordlist would be needed.


📄 License

This project is released for personal and educational use only.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages