python 爆破PDF密码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import PyPDF2
def decrypt_pdf(pdf_file_decrypt):
filename = 'password.txt'
file = open(filename, 'r')
file_type = file.readlines()
pdf_reader_1=PyPDF2.PdfFileReader(open(pdf_file_decrypt,'rb'))
for i in file_type:
rs = i.replace('\n', '')
#print str(rs)
if pdf_reader_1.decrypt(str(rs))==1:
print "yes:"+str(rs)
break
else:
pass
pdf_file_decrypt="as.pdf"
decrypt_pdf(pdf_file_decrypt)
 上一篇