Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔓 Office and PDF Unlocker

Remove protection from Office (.pptx, .docx, .xlsx) and .pdf files — no passwords needed. Runs on Linux, headless, no GUI required.

What it does

Format Protection Method
.pptx .docx .xlsx Password to modify (Restrict Editing) Strips XML protection tags
.pdf Owner password (no edit/print/copy) Removes via pikepdf
.pptx .docx .xlsx .pdf Password to open (encryption) Brute-force (--bruteforce)
  • Scans source folder recursively
  • Strips protection from Office and PDF files
  • Preserves subfolder structure in output
  • Optional brute-force for encrypted files
  • Parallel processing with configurable workers

Quick Start

Linux / macOS

./scripts/setup.sh
./scripts/run_decryptor.sh

Windows

scripts\setup.bat
scripts\run_decryptor.bat

Optional: configure folders in config/.env

UNLOCKER_SOURCE_DIR=file_input
UNLOCKER_DEST_DIR=file_output
UNLOCKER_OUTPUT_PREFIX=unlocked_

Requirements

  • Python 3.8+
  • Linux, macOS, Windows

Dependencies (auto-installed by setup.sh / setup.bat):

  • msoffcrypto-tool — Office brute-force
  • pikepdf — PDF owner password removal

CLI Options

Usage: office-and-pdf-unlocker [OPTIONS]

Options:
  -s, --source DIR       Source folder (default: file_input)
  -d, --dest DIR         Destination folder (default: file_output)
  --prefix PREFIX        Output filename prefix (default: unlocked_)
  --dry-run              Simulate without writing files
  -v, --verbose          Verbose output (DEBUG)
  --no-recursive         Don't scan subfolders
  -w, --workers N        Parallel workers (default: 4)
  --log-dir DIR          Log directory (default: logs)

Brute-force:
  --bruteforce           Crack encryption password if protection removal fails
  --bruteforce-min N     Min password length (default: 1)
  --bruteforce-max N     Max password length (default: 4)
  --bruteforce-charset S Characters to use (default: 0123456789)

Examples

# Default
./scripts/run_decryptor.sh

# Dry-run
./scripts/run_decryptor.sh --dry-run --verbose

# With brute-force (4-digit PIN)
./scripts/run_decryptor.sh --bruteforce

# Brute-force with letters, max 3 chars
./scripts/run_decryptor.sh --bruteforce --bruteforce-charset "abcdefghijklmnopqrstuvwxyz" --bruteforce-max 3

Project Structure

office_unlocker/
├── src/
│   ├── main.py              # CLI entry point
│   ├── config.py            # Configuration & argument parsing
│   ├── decryptor.py         # Protection removal + brute-force
│   ├── file_handler.py      # File system operations
│   └── logger.py            # Logging setup
├── config/
│   ├── .env                 # Environment configuration
│   └── .env.example         # Configuration template
├── scripts/
│   ├── setup.sh             # One-shot setup
│   └── run_decryptor.sh     # Launch script
├── tests/                   # Unit tests (pytest)
├── avvia.sh                 # Quick launcher
├── requirements.txt         # Python dependencies
└── README.md

How It Works

Office (.pptx, .docx, .xlsx)

These are ZIP archives. Modify protection lives as XML tags inside the archive. The tool opens the ZIP, strips the tags with regex, and writes a clean copy.

PDF

PDF owner passwords are removed via pikepdf (libqpdf). The PDF is opened and re-saved without restrictions.

Testing

source venv/bin/activate
pytest tests/ -v

License

MIT — see LICENSE

About

Remove protection from Office (.pptx, .docx, .xlsx) and .pdf files — no passwords needed. Runs on Linux, headless, no GUI required.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages