ANN: Python Decrypt PDF script -- builds on pdftools
Hi,
I wanted to extract the meta-data from an encrypted/protected PDF file
and could not find any Python scripts to do this. So, I decided to
write something myself, the result follows.
This demonstration utility requires the `pdftools` files from
http://www.boddie.org.uk/david/Projects/Python/pdftools/ but the
decryption functions themselves should be usable with other Python PDF
libraries.
Documentation is marginal and all I can say is that worked on the
three PDF files I tested it on... :-)
--Phil.
P.S. The usual Usenet-mangling warning applies--yeah, I know--I should
put it up on a web site somewhere... :-)
#!/usr/bin/python
#
# Decrypt PDF Info
#
# Decrypts PDF files and displays meta-data associated with them. (If
the
# file isn't encrypted the information is displayed as is.)
#
# The results are similar to xpdf's `pdfinfo` utility.
#
# It should be possible to decrypt all of the objects contained
# in the PDF, but this only reads the Document Information Dictionary.
#
# (Note: All the PDF handling is provided by `pdftools`, this just
adds
# the ability to deal with encrypted PDF files.)
#
# Requires:
# + pdftools
# http://www.boddie.org.uk/david/Projects/Python/pdftools/
#
# Based on:
# + `pdfdecrypt.pl`
# http://www-2.cs.cmu.edu/~dst/Adobe/Gallery/pdfdecrypt.pl
[PDFPL]
#
# Incorporates:
# + RC4 from CipherSaber implementation by Ka-Ping Yee
participants (1)
-
follower@gmail.com