-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdfcrack.py
34 lines (26 loc) · 918 Bytes
/
pdfcrack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pikepdf
import sys
import colorama
import argparse
from colorama import Fore, Back, Style
colorama.init(autoreset=True)
def crack_pdf(pdf, wordlist):
try:
with open(wordlists) as file:
content = file.read()
passwords = content.splitlines()
for password in passwords:
try:
with pikepdf.open(pdf_file, password=password) as pdf:
print(f"{Fore.GREEN}[+] Password Found: {Fore.RESET}", password)
exit()
except pikepdf._qpdf.PasswordError:
continue
print(f"{Fore.RED}[-] Password not found. {Fore.RESET}")
except Exception as e:
print(f"{Fore.RED}[!] Error: {Fore.RESET}", e)
argument_parser = argparse.ArgumentParser(description='pdf cracker')
argument_parser.add_argument("-f", required=True, type=str, help='PDF File')
argument_parser.add_argument("-w", required=True, type=str, help='Wordlist File')
args = argument_parser.parse_args()
crack_pdf(args.f, args.w)