I wrote this brute force attacker in Python. It cracks any file numeric password protected file.
import pikepdf
def brute_num_attack(file):
i = 0
while True:
try:
print(i)
with pikepdf.open(file, password=str(i)) as file:
print("Password: ", i)
print("Total pages:", len(file.pages))
break
except:
i += 1
If I need this to do a brute force attack of all alphanumeric characters and punctuation, how should I do it?
Using this:
characters = string.ascii_letters + string.digits + string.punctuation
This is just for proof of concept how brute force is implemented.