Skip to main content

No project description provided

Project description

pdf2john

Tests CI Code style: black Linting: pylint License: MIT

This repository is a modern refactoring of the legacy pdf2john.py library, aimed at making the code easier to read and maintain.

Install

Clone the repo

git clone https://github.com/benjamin-awd/pdf2john.git

Install dependencies using Homebrew

brew bundle

Create a virtual environment and install Python dependencies

pyenv virtualenv 3.11.4 pdf2john
pyenv shell pdf2john
poetry install

or if you don't want to use a virtual environment, simply

pip install -r requirements.txt

Usage

Run pdf2john.py with a PDF of choice

python3 pdf2john.py tests/pdf/pypdf/r6-user-password.pdf

To pass the hash to john:

python3 pdf2john.py tests/pdf/pypdf/r6-empty-password.pdf >> .hash
john --format=PDF tests/pdf/pypdf/r6-empty-password.pdf .hash
john --show --format=PDF .hash

Features

  • Responsibility for PDF parsing and handling has been delegated to pyHanko (a crytography focused fork of PyPDF2)
  • CICD workflow that tests pdf2john against PDFs ranging from Security Handler Revision 2 -> 6
  • Removal of legacy Python 2.x support
  • An optional debugging flag that shows the encryption dictionary of a PDF
  • Readability improvements (a general attempt to be more Pythonic)

Troubleshooting

To access the encryption dictionary:

python3 pdf2john.py tests/pdf/pypdf/r6-user-password.pdf --debug

Acknowledgement

This repository was based on the original pdf2john.py by Shane Quigley

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf2john-0.1.3.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

pdf2john-0.1.3-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page