Skip to content

Instantly share code, notes, and snippets.

Created July 2, 2021 09:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import pikepdf
from tqdm import tqdm
# load password list
passwords = []
for y in range(70, 99):
for m in range(1, 12):
for d in range(1, 31):
passwords.append(str(y) + ('0' + str(m))[-2:] + ('0' + str(d))[-2:])
# iterate over passwords
for password in tqdm(passwords, "Decrypting PDF"):
# open PDF file
with"../Downloads/1.pdf", password=password) as pdf:
# Password decrypted successfully, break out of the loop
print("[+] Password found:", password)
except pikepdf._qpdf.PasswordError as e:
# wrong password, just continue in the loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment