我必须写一个scrypt(对于一个大学课程,我必须发送给proffesor,直到星期天),这将破解pdf文件,我已经尝试了很多,但我不能使它工作我的代码是:
#!/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是包含日期密码的txt(DD-MM-YY-> date-month-year)