Skip to content

Instantly share code, notes, and snippets.

@amalmurali47
Last active August 13, 2020 20:58
Show Gist options
  • Save amalmurali47/482708f0c20bdab592f328d1b91daa88 to your computer and use it in GitHub Desktop.
Save amalmurali47/482708f0c20bdab592f328d1b91daa88 to your computer and use it in GitHub Desktop.
PDF password bruteforcer for cracking bank statements. Written in 10 mins for fun.

PDF Password Bruteforcer

Usage

python3 pdf_brute.py
time cat /tmp/brute.txt | xargs -I{} -P 10 bash -c "qpdf --password={} --decrypt stmt.pdf out.pdf"
watch ls

PS: Just use JohnTheRipper or something.

import datetime
import re
from itertools import product
from string import ascii_lowercase
import requests
# create a list of possible names
names_list = requests.get('http://ix.io/2u5u').text.splitlines()
names = [n[0:5] for n in names if re.match(r'[a-z]{4,}', n)]
# in case you need a bigger sample set, use this
keywords = list(map(''.join, product(ascii_lowercase, repeat=4)))
# create all possible ddmm dates, while accounting for leap years
base = datetime.datetime.today()
date_list = [base - datetime.timedelta(days=x) for x in range(5*366)] # coz why not
dates = set(d.strftime('%d%m') for d in date_list)
# create possible wordlist
with open('/tmp/brute.txt', 'a') as f:
for name in names:
for date in dates:
print(f'{name}{date}', file=f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment