Skip to content

joelpeter-c/unlock-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unlock-pdf

A small CLI that removes password protection from a PDF using pikepdf. Supports two modes:

  • password: a single password attempt.
  • brute-date: brute-force a password of the form PREFIX + formatted-date across a date range, for the case where you know the password is built from a known pattern (e.g. OLIV2403 for someone's birthday) but you have forgotten the exact day.

Setup

Uses uv.

uv sync

Usage

# Single password
uv run python unlock_pdf.py locked.pdf password mypassword

# Custom output path
uv run python unlock_pdf.py locked.pdf -o decrypted.pdf password mypassword

# Brute-force OLIV + ddmm across all of 2024
uv run python unlock_pdf.py locked.pdf brute-date --prefix OLIV --start 2024-01-01 --end 2024-12-31

# Different date format. e.g. yyyymmdd, no prefix
uv run python unlock_pdf.py locked.pdf brute-date --start 1990-01-01 --end 2000-12-31 --format "%Y%m%d"

The --format argument is a Python strftime format string. %d%m is 2403, %Y%m%d is 19900124, etc.

Notes

Brute-force runs serially and tries one password per day, so a 365-day window finishes in well under a minute on a small PDF. For larger keyspaces this script is the wrong tool. Use a dedicated cracker.

About

CLI that removes PDF password protection using pikepdf. Supports a single-password mode and a brute-force-by-date mode for known prefix+date patterns (e.g. OLIV2403).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages