Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1635: Decypting PDF ebboks fixed #1689

Open
wants to merge 129 commits into
base: master
Choose a base branch
from

Conversation

frickeo
Copy link

@frickeo frickeo commented May 1, 2021

The decryption of pdf ebooks was broken (see #1635).

If fixed this with two modifications

First of all, I got an empty list of objids when parsing a pdf document: In Python 2, the build-in function zip() returns a list and not an iterator. This changed in Python 3. I converted the iterator into a list again and got objids back.

Another correction was needed. to make the predictor code work again.

Copy link

@abort-retry-fail-ignore abort-retry-fail-ignore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me. Tried with two problem pdfs, decrypted successfully. Thanks for tracking this down!

@gschenck
Copy link

Works. Thank you!

@Leseratte10
Copy link

I've found a PDF where this bugfix wasn't enough to make the DeDRM work again.

There's code in the nunpack function that looks like this:

return struct.unpack('>L', b'\x00'+s)[0]

and that gave me some Python error about being unable to combine str and bytes.
Changing that line to the following fixes this issue:

return struct.unpack('>L', bytes([0]) + s)[0]

Maybe that can be added to this PR as well.

noDRM and others added 30 commits August 6, 2022 20:19
Co-authored-by: Andrew Innes <[email protected]>
Co-authored-by: Satsuoni <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.