Skip to main content

A modern refactoring of the legacy pdf2john library

Project description

pdf2john

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

A modern refactoring of the legacy pdf2john.py library, aimed at making the code easier to read and maintain.

Install

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 --only main

Usage

To pass the hash to john:

pdf2john example.pdf >> .hash
john .hash
john --show --format=PDF .hash

If you don't want to use poetry, you can run pdf2john as a standalone script:

git clone https://github.com/benjamin-awd/pdf2john.git
cd pdf2john && pip install -r requirements.txt
./src/pdf2john/pdf2john.py example.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:

./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.10.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf2john-0.1.10-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pdf2john-0.1.10.tar.gz.

File metadata

  • Download URL: pdf2john-0.1.10.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.6 Linux/5.15.133.1-microsoft-standard-WSL2

File hashes

Hashes for pdf2john-0.1.10.tar.gz
Algorithm Hash digest
SHA256 dc65d58d77f44e0821a82086b8939f8fcaa58aa3cbddde720f9eef527d477b29
MD5 9ef8e12a4d01d4a80eb7c1f71a04247b
BLAKE2b-256 d5d15fef451947d6b4fa4f04f3d8b5d3c588322e5d32fa7338e5e19cfa6f3049

See more details on using hashes here.

File details

Details for the file pdf2john-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: pdf2john-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.6 Linux/5.15.133.1-microsoft-standard-WSL2

File hashes

Hashes for pdf2john-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 76f806658a9709dfe65aa2b2c1981ba8bfc86f782e11b625aed7426164102e52
MD5 3e7cc8bd1a37e4f545badb27b623ce8a
BLAKE2b-256 e71403ba0e582e8014309aef2ef6e3d6e5eeea9e75a7aaf7ae5438f9db3fb44c

See more details on using hashes here.

Supported by

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