Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Flask Python PyMuPDF PyPDF2

🔐 PDF Security Suite

Encrypt · Decrypt · Crack · Convert



✨ Features

Feature Description Tech
🔒 PDF Encryption Password-protect your PDFs with strong encryption PyPDF2
🔓 PDF Decryption Unlock password-protected PDF files PyPDF2
🗝️ Password Cracking Recover lost PDF passwords via brute force + common wordlist PyPDF2
🖼️ PDF → Images Convert every PDF page to high-quality JPEG (300 DPI) pdf2image + Pillow
📄 Images → PDF Merge multiple images into a single PDF document Pillow
🌗 Dark/Light Theme Elegant UI with system-preference-aware theme toggle CSS Custom Props
🎯 Drag & Drop Intuitive file upload with drag-and-drop support Vanilla JS

🚀 Quick Start

# 1. Clone the repo
git clone https://github.com/ocean-master0/PDF-Security-Tool.git
cd PDF-Security-Tool

# 2. Install dependencies
pip install -r requirements.txt

# 3. Set secret key (recommended)
export SECRET_KEY="your-secure-secret-key-here"
# Windows: set SECRET_KEY="your-secure-secret-key-here"

# 4. Run the app
python app.py

Open http://localhost:5000 in your browser.


🛠️ Dependencies

Package Version Purpose
Flask ≥2.3.3 Web framework
PyPDF2 ≥3.0.1 PDF read/write/encrypt
PyMuPDF (fitz) ≥1.23.7 PDF image extraction
pdf2image ≥1.16.3 PDF page rasterization
Pillow ≥10.1.0 Image processing
Werkzeug ≥2.3.7 WSGI utilities
gunicorn ≥21.2.0 Production WSGI server

⚙️ Configuration

Variable Default Description
SECRET_KEY (auto-generated) Flask session signing key
PORT 5000 Server port
FLASK_DEBUG false Enable debug mode
ALLOW_DEBUG false Must be true to activate debug mode

Production: Always set SECRET_KEY and use gunicorn:

SECRET_KEY="your-secure-key" gunicorn -w 4 -b 0.0.0.0:8000 app:app

🖥️ Screenshots

┌─────────────────────────────────────────────┐
│  🔐 PDF Tools Pro v3.0                      │
│  Encrypt, decrypt, and convert your PDFs    │
│                                             │
│  ┌──────────────────────────────────────┐   │
│  │  📄 PDF Security Tools               │   │
│  │  ┌────────────────────────────────┐  │   │
│  │  │  ☁️  Choose PDF File          │  │   │
│  │  │  or drag and drop here        │  │   │
│  │  └────────────────────────────────┘  │   │
│  │  [Encrypt] [Decrypt] [Crack] [Img]  │   │
│  │  ┌─ Password ───────────────────┐   │   │
│  │  │  ●●●●●●●●●●            👁️  │   │   │
│  │  └──────────────────────────────┘   │   │
│  │  🔒 Encrypt PDF                   │   │
│  └──────────────────────────────────────┘   │
│                                             │
│  ┌──────────────────────────────────────┐   │
│  │  🖼️  Images to PDF Converter        │   │
│  │  ┌────────────────────────────────┐  │   │
│  │  │  🖼️  Choose Image Files       │  │   │
│  │  └────────────────────────────────┘  │   │
│  └──────────────────────────────────────┘   │
└─────────────────────────────────────────────┘

Clean, modern interface with a teal accent color scheme and smooth animations.


🧪 API Endpoints

Method Endpoint Description
GET / Web UI
POST /upload Process PDF (encrypt/decrypt/crack/convert)
POST /upload_images Convert images to PDF
GET /crack_status/<id> Poll crack progress
GET /download/<file> Download processed file

🏗️ Architecture

                         ┌─────────────┐
                         │   Browser   │
                         └──────┬──────┘
                                │ HTTP
                         ┌──────▼──────┐
                         │    Flask    │
                         │  (app.py)   │
                         └──┬──┬──┬───┘
                            │  │  │
              ┌─────────────┘  │  └─────────────┐
              ▼                ▼                ▼
        ┌──────────┐    ┌──────────┐    ┌──────────────┐
        │  PyPDF2  │    │ Pillow   │    │  pdf2image   │
        │Enc/Crack │    │Img→PDF   │    │  PDF→Images  │
        └──────────┘    └──────────┘    └──────────────┘

🔒 Security Notes

  • Rate limiting: 30 requests/min per IP (with X-Forwarded-For support)
  • Disk space check: Minimum 500MB free required before processing
  • Auto-cleanup: Uploaded and temporary files deleted after download
  • Password validation: Max 128 characters enforced

👨‍💻 Development

# Install dev dependencies
pip install -r requirements.txt

# Run with debug mode
set FLASK_DEBUG=true
set ALLOW_DEBUG=true
python app.py

📄 License

This project is open source and available under the MIT License.


Made with ❤️ and Python

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages