Skip to content

Sergios9494/pdf-protection-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

PDF Protection Tool

A Python tool for adding password protection to PDF files. This tool allows you to encrypt PDF documents with a password to secure sensitive information.

Features

🔒 PDF Protection

  • Password Encryption: Add password protection to PDF files
  • Metadata Preservation: Maintains original PDF structure and metadata
  • Error Handling: Comprehensive error handling for various scenarios
  • Simple Interface: Easy-to-use command-line interface

Installation

Prerequisites

  • Python 3.7+
  • PyPDF2 library

Dependencies

# Install required packages
pip install PyPDF2

# Or on Kali Linux
sudo apt install python3-pypdf2

Setup

# Download the tool
git clone https://github.com/Sergios9494/pdf-protection-tool.git
cd pdf-protection-tool

# Make executable
chmod +x ProtectionPDF_Tool.py

Usage

Basic Usage

# Protect a PDF with password
python3 ProtectionPDF_Tool.py input.pdf output_protected.pdf mypassword

Command Line Arguments

python3 ProtectionPDF_Tool.py <input_pdf> <output_pdf> <password>

Parameters:

  • input_pdf: Path to the original PDF file
  • output_pdf: Path for the password-protected PDF file
  • password: Password to protect the PDF

Examples

Example 1: Protect a Document

python3 ProtectionPDF_Tool.py document.pdf secure_document.pdf secret123

Output:

Password-protected PDF saved as secure_document.pdf

Example 2: Protect Multiple Files

# Protect financial report
python3 ProtectionPDF_Tool.py financial_report.pdf financial_report_secure.pdf finance2024

# Protect confidential document
python3 ProtectionPDF_Tool.py confidential.pdf confidential_secure.pdf topsecret

Error Handling

The tool handles various error scenarios:

  • File Not Found: If the input PDF doesn't exist
  • Invalid PDF: If the file is not a valid PDF
  • Permission Errors: If there are file access issues
  • General Errors: Catches and reports other exceptions

Security Considerations

⚠️ Important: This tool is designed for:

  • Legitimate document protection
  • Personal file security
  • Business document encryption
  • Educational purposes

Security Tips

  • Use strong passwords (at least 12 characters)
  • Include uppercase, lowercase, numbers, and symbols
  • Store passwords securely
  • Test password protection before sharing files

Troubleshooting

Common Issues

Module Not Found

pip install PyPDF2
# or
sudo apt install python3-pypdf2

Permission Denied

chmod +x ProtectionPDF_Tool.py

File Not Found

  • Check file path and spelling
  • Ensure file exists in the specified location
  • Use absolute paths if needed

Invalid PDF Error

  • Verify the file is a valid PDF
  • Check if the PDF is corrupted
  • Try opening the PDF in a PDF viewer first

Use Cases

Personal Use

  • Protect personal documents
  • Secure financial records
  • Encrypt sensitive photos/scans

Business Use

  • Protect confidential reports
  • Secure client documents
  • Encrypt internal communications

Educational Use

  • Learn PDF security concepts
  • Understand encryption principles
  • Practice Python file handling

Technical Details

Dependencies

  • PyPDF2: Python library for PDF manipulation
  • Standard Library: sys module for command-line arguments

File Processing

  • Reads PDF files in binary mode
  • Preserves all pages and content
  • Applies encryption using PyPDF2's encrypt method
  • Writes protected PDF in binary mode

Contributing

Contributions are welcome! Please feel free to submit:

  • Bug reports
  • Feature requests
  • Code improvements
  • Documentation updates

License

This project is licensed under the MIT License.

Author

Sergios9494 - Cybersecurity Professional

Acknowledgments

  • Built for document security needs
  • Designed for educational and professional use
  • Inspired by cybersecurity best practices

Secure Your Documents! 🔒

About

Python tool for adding password protection to PDF files. Secure your sensitive documents with encryption.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages