apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.55k stars 1.52k forks source link

DeDRM not working on new Kobo epub #704

Open brasslock opened 5 years ago

brasslock commented 5 years ago

I am unable to decrypt a book that I just purchased from Kobo using the Calibre plugin..

calibre Debug log calibre 1.48 isfrozen: True is64bit: False Windows-XP-5.1.2600-SP3 Windows ('32bit', 'WindowsPE') ('Windows', 'XP', '5.1.2600') Python 2.7.5 Windows: ('XP', '5.1.2600', 'SP3', 'Uniprocessor Free') Starting up... Started up in 8.88 seconds with 0 books Worker Launch took: 0.0699999332428 Job: 1 Read metadata (0 of 1) finished Read metadata (0 of 1) DeDRM v6.6.1: Trying to decrypt Eleanor Oliphant is Completely Fine.epub DeDRM v6.6.1: Verifying zip archive integrity DeDRM v6.6.1: Eleanor Oliphant is Completely Fine.epub is a secure Adobe Adept ePub DeDRM v6.6.1: Looking for new default Adobe Digital Editions Keys after 4.9 seconds Found 1 keys DeDRM v6.6.1: Trying a new default key Could not decrypt ymvvfv.epub because of an exception: Traceback (most recent call last): File "calibre_plugins.dedrm.ineptepub", line 462, in decryptBook File "calibre_plugins.dedrm.ineptepub", line 378, in decrypt File "calibre_plugins.dedrm.ineptepub", line 368, in decompress error: Error -3 while decompressing: invalid stored block lengths

DeDRM v6.6.1: Failed to decrypt with new default key after 5.5 seconds
DeDRM v6.6.1: Ultimately failed to decrypt after 5.5 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "site-packages\calibre\customize\ui.py", line 154, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 632, in run
  File "calibre_plugins.dedrm.__init__", line 403, in ePubDecrypt
DeDRMError: DeDRM v6.6.1: Ultimately failed to decrypt after 5.5 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md

Added Eleanor Oliphant is Completely Fine to db in: 0.970999956131 seconds Worker Launch took: 0.0799999237061

I am running on Windows-XP, using ADE 2.0.1. I can read the book in ADE, but it fails to decrypt with the same error (invalid stored block lengths) when using the Calibre plugin or the windows application.

I have had no trouble decrypting books previously (and tried removing them from Calibre and adding them again to check).

Any ideas would be welcome. Thanks

brasslock commented 5 years ago

Something else that might be relevant .. it is a relatively large epub file @ 26M. It appears as if it may contain an audio file in addition to the text (although ADE does not show or play anything for the audio, but there is a line that says "tap the play button below to listen to the interview").

brasslock commented 5 years ago

a further update.. When it fails, the path is: 'OEBPS/audio/9780008172138_transcript.mp3'

Since I don't care about the audio, I ended up hacking around the failure by ignoring the exception in decompress in ineptepub.py

    def decompress(self, bytes):
        dc = zlib.decompressobj(-15)
        try:
            bytes = dc.decompress(bytes)  ## <= fails on this line
        except:
            return ''

        ex = dc.decompress('Z') + dc.flush()
        if ex:
            bytes = bytes + ex
        return bytes

I am still happy to help debug if anybody wants to fix this properly in the application.

ElleKayEm commented 5 years ago

Windows XP 32-bit and the old version of calibre you have to use with that could be factors too.

I was going to suggest seeing if you could unzip the epub and just remove any audio files. Then zip it back up and try again.