Skip to content

Instantly share code, notes, and snippets.

@antonlogvinenko
Created April 9, 2023 07:41
Show Gist options
  • Save antonlogvinenko/dc9a9b71290bff00f18afc2fdca7ff0b to your computer and use it in GitHub Desktop.
Save antonlogvinenko/dc9a9b71290bff00f18afc2fdca7ff0b to your computer and use it in GitHub Desktop.
pip3 install fitz
pip3 install PyMuPDF
# Contents of the tool crack.py
import fitz
import time
import sys
if len(sys.argv) != 2:
print("Pass file encrypted with SSN as a single argument")
sys.exit(1)
filename = sys.argv[1]
pdf = fitz.open(filename)
t = time.time()
for i in range(1000000000, 9999999999):
if pdf.authenticate(str(i)):
pdf.save("./decrypted.pdf")
print("Your SSN used as password is: %s" % i)
print("PDF file without password is: decrypted.pdf")
break
print(time.time() - t)
# Running the script; SSN password is printed, decrypted file is saved as decrypted.pdf
python3 crack.py encrypted.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment