i have to write a scrypt (for a university class and i must send to proffesor until sunday) that will crack a pdf file, i have tryied a lot so far but cant make it work my code is:
#!/usr/bin/python2.7
from PyPDF2 import PdfFileReader, PdfFileWriter
import logging
import time
t=time.localtime()
t1=time.asctime(t)
log_filename='pass_found.log'
logging.basicConfig(filename=log_filename,level=logging.INFO)
output = PdfFileWriter()
pdf = PdfFileReader(file( "sf.pdf", "rb"))
f=open('datepass.txt')
content=f.readlines()
words=[x.strip() for x in content]
for i in words:
if (pdf.decrypt(i) == 1) or (pdf.decrypt(i) == 2):
logging.info('{0} :o kodikos einai "{1}"'.format(t1,i))
datepass is a txt that contains date passwords(DD-MM-YY-> date-month-year)