noDRM / DeDRM_tools

DeDRM tools for ebooks
7.05k stars 316 forks source link

2 our of 39 books failed to remove DRM #602

Open EvanMaxGitHub opened 1 month ago

EvanMaxGitHub commented 1 month ago

Question / bug report

I downloaded a batch of 39 books from Kobo that all had DRM on them (same series/author/format/etc.) I successfully loaded these books into Adobe Digital Editions on my Mac, and then from ADE to Calibre. I attempted to load the books to my 11th gen Kindle first without installing the DeDRM plugin, and was met with 40 "this book has DRM" pop-ups, which I now understand is to be expected.

I installed the plugin and attempted again, and the majority of the books now converted properly, but two books still gave em the error messages. I attempted to remove and re-add these two books multiple times, and to convert directly prior to adding them to my device, but met the errors on these books every time. Eventually I removed them and re-added them in debug mode, and I have attched the log from that attempt to this ticket.

Which version of Calibre are you running?

7.16.0

Which version of the DeDRM plugin are you running?

v10.0.3

If applicable, which version of the Kindle software are you running?

No response

Log output

ApplicationPaletteChange event ignored
Using calibre Qt style: True
2024-08-15 14:33:08.820 calibre-debug[51606:75589615] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
calibre Debug log
calibre 7.16  embedded-python: True
macOS-14.2.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.2.0', 'Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020')
Python 3.11.5
OSX: ('14.2.1', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre-debug
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
calibre 7.16  embedded-python: True
macOS-14.2.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.2.0', 'Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020')
Python 3.11.5
OSX: ('14.2.1', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre-debug
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
QPA platform: cocoa
devicePixelRatio: 2.0
logicalDpi: 72.0 x 72.0
physicalDpi: 93.0000013967199 x 91.50000137419215
[0.00] Starting up...
[0.02] Showing splash screen...
[0.17] splash screen shown
[0.17] Initializing db...
[0.18] db initialized
[0.18] Constructing main UI...
DEBUG:    0.0 obok::utilities.py - loading translations
DEBUG:    0.0 obok::dialogs.py - loading translations
DEBUG:    0.0 obok::config.py - loading translations
DEBUG:    0.0 obok::action_err.py - loading translations
[0.48] GUI main window shown
[0.52] main UI initialized...
[0.52] Hiding splash screen
2024-08-15 14:33:13.010 calibre-debug[51606:75589615] Warning: Window move completed without beginning
Failed to request permission for showing notification: The operation couldn’t be completed. (UNErrorDomain error 1.)
DeDRM v10.0.3: Trying to decrypt Men at Arms A Discworld Novel.epub
DeDRM v10.0.3: Verifying zip archive integrity
DeDRM v10.0.3: Men at Arms A Discworld Novel.epub is a secure Adobe Adept ePub for UUID 62fbb279-c40f-48f9-bd53-04ad03879d68
DeDRM v10.0.3: Trying Encryption key default_ade_key_uuid_781d2ada-1fc2-483b-8019-53f32f2bca8e_AdobeID_evanmaxrosenberg@gmail.com
hym6rm3x.epub is a secure Adobe Adept ePub.
Could not decrypt hym6rm3x.epub because of an exception:
Traceback (most recent call last):
  File "/Users/evan/Library/Preferences/calibre/plugins/DeDRM.zip/ineptepub.py", line 327, in decryptBook
    decryptor = Decryptor(bookkey, encryption)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/evan/Library/Preferences/calibre/plugins/DeDRM.zip/ineptepub.py", line 150, in __init__
    self._aes = AES.new(bookkey, AES.MODE_CBC, b'\x00'*16)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Crypto/Cipher/AES.py", line 228, in new
  File "Crypto/Cipher/__init__.py", line 79, in _create_cipher
  File "Crypto/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
  File "Crypto/Cipher/AES.py", line 90, in _create_base_cipher
ValueError: Incorrect AES key length (0 bytes)

DeDRM v10.0.3: Failed to decrypt with key default_ade_key_uuid_781d2ada-1fc2-483b-8019-53f32f2bca8e_AdobeID_evanmaxrosenberg@gmail.com after 0.1 seconds
DeDRM v10.0.3: Looking for new default Adobe Digital Editions Keys after 0.1 seconds
DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 199, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 1067, in run
    decrypted_ebook = self.ePubDecrypt(path_to_ebook)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 665, in ePubDecrypt
    raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
[8.63] splash screen hidden
[8.63] Started up in 8.63 seconds with 38 books

{'bsd_drives': {'main': '/dev/disk8'},
 'drives': {'main': '/Volumes/Kindle'},
 'mount_map': {'/dev/disk11s1': '/Volumes/FreeCAD_0.20.2-2022-12-27-conda-macOS-x86_64-py310',
               '/dev/disk1s1': '/System/Volumes/iSCPreboot',
               '/dev/disk1s2': '/System/Volumes/xarts',
               '/dev/disk1s3': '/System/Volumes/Hardware',
               '/dev/disk2s1': '/System/Volumes/Update/SFR/mnt1',
               '/dev/disk3s1': '/System/Volumes/Update/mnt1',
               '/dev/disk3s1s1': '/',
               '/dev/disk3s2': '/System/Volumes/Preboot',
               '/dev/disk3s4': '/System/Volumes/Update',
               '/dev/disk3s5': '/System/Volumes/Data',
               '/dev/disk3s6': '/System/Volumes/VM',
               '/dev/disk5s2': '/Volumes/Satechi HD',
               '/dev/disk7s1': '/Volumes/calibre-7.16.0',
               '/dev/disk8': '/Volumes/Kindle',
               'devfs': '/dev',
               'map auto_home': '/System/Volumes/Data/home'}}
Syncing cover thumbnails to workaround amazon cover bug
Restored 0 cover thumbnails that were destroyed by Amazon
Job: 0 Get device information started
DeviceJob: 0 Get device information done, calling callback
DeviceJob: 0 Get device information callback returned
Job: 1 Set library information started
DeviceJob: 1 Set library information done, calling callback
DeviceJob: 1 Set library information callback returned
Job: 2 Get list of books on device started
DEBUG:    0.0 USBMS: Fetching list of books from device. Device= KINDLE2 oncard= None
DEBUG:    0.0 USBMS: dirs are: /Volumes/Kindle/ documents
DEBUG:    0.0 USBMS: scan from root False /Volumes/Kindle/documents
DEBUG:    0.1 USBMS: count found in cache: 40, count of files in metadata: 40, need_sync: False
DEBUG:    0.1 USBMS: Finished fetching list of books from device. oncard= None
DEBUG:    0.1 USBMS: Fetching list of books from device. Device= KINDLE2 oncard= carda
DEBUG:    0.1 USBMS: Fetching list of books from device. Device= KINDLE2 oncard= cardb
DeviceJob: 2 Get list of books on device done, calling callback
DEBUG:    0.1 DeviceJob: metadata_downloaded: Starting set_books_in_library
DEBUG:    0.1 DeviceJob: set_books_in_library: books to process= 40
DEBUG:    0.1 DeviceJob: set_books_in_library finished: time= 0.001840829849243164
DEBUG:    0.1 DeviceJob: metadata_downloaded: updating views
DEBUG:    0.1 DeviceJob: metadata_downloaded: syncing
DEBUG:    0.1 DeviceJob: metadata_downloaded: refreshing ondevice
DEBUG:    0.1 DeviceJob: metadata_downloaded: sending metadata_available signal
DeviceJob: 2 Get list of books on device callback returned
Job: 0 Get device information finished
No details available.
Job: 1 Set library information finished
No details available.
Job: 2 Get list of books on device finished
No details available.
Added Men at Arms: A Discworld Novel to db in: 0.0
Added 1 books in 0.4 seconds
DeDRM v10.0.3: Trying to decrypt Guards! Guards!.epub
DeDRM v10.0.3: Verifying zip archive integrity
DeDRM v10.0.3: Guards! Guards!.epub is a secure Adobe Adept ePub for UUID 62fbb279-c40f-48f9-bd53-04ad03879d68
DeDRM v10.0.3: Trying Encryption key default_ade_key_uuid_781d2ada-1fc2-483b-8019-53f32f2bca8e_AdobeID_evanmaxrosenberg@gmail.com
xb1l6b4w.epub is a secure Adobe Adept ePub.
Could not decrypt xb1l6b4w.epub because of an exception:
Traceback (most recent call last):
  File "/Users/evan/Library/Preferences/calibre/plugins/DeDRM.zip/ineptepub.py", line 327, in decryptBook
    decryptor = Decryptor(bookkey, encryption)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/evan/Library/Preferences/calibre/plugins/DeDRM.zip/ineptepub.py", line 150, in __init__
    self._aes = AES.new(bookkey, AES.MODE_CBC, b'\x00'*16)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Crypto/Cipher/AES.py", line 228, in new
  File "Crypto/Cipher/__init__.py", line 79, in _create_cipher
  File "Crypto/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
  File "Crypto/Cipher/AES.py", line 90, in _create_base_cipher
ValueError: Incorrect AES key length (0 bytes)

DeDRM v10.0.3: Failed to decrypt with key default_ade_key_uuid_781d2ada-1fc2-483b-8019-53f32f2bca8e_AdobeID_evanmaxrosenberg@gmail.com after 0.1 seconds
DeDRM v10.0.3: Looking for new default Adobe Digital Editions Keys after 0.1 seconds
DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 199, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 1067, in run
    decrypted_ebook = self.ePubDecrypt(path_to_ebook)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 665, in ePubDecrypt
    raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Added Guards! Guards! to db in: 0.0
Added 1 books in 0.4 seconds
ElleKayEm commented 1 month ago

That's weird. It is usually all or nothing. These were downloaded via ADE on the same computer and user as calibre/DeDRM? Same as the other books? I've seen DeDRM get overwhelmed if you try to add too many books at once to calibre. But it should have been fine when you added just these two.

EvanMaxGitHub commented 1 month ago

Yes, same computer, same user (for ADE, for Kobo, for calibre/DeDRM), same session, same everything.

I downloaded the books from the Rakutan Kobo webpage, and them opened the downloaded files in ADE. Then I loaded the epubs from the ADE documents file into calibre. 9I've also downloaded the Kobo Mac Desktop application and downloaded all of the books there, if there's any sort of workaround to use those files instead, but I haven't been able to figure anythign out.)

I thought it might be an overload thing at first too, but even when I try to load those two books in individually they still throw up the error.

As a test I installed Epubor Ultimate, and that seems to be able to get through the DRM on the books, but I'd rather not pay for a licence for that (required to export more than just 20% of them) just to get in to two books I've already paid for in the first place, when it seems like DeDRM should be able to do it.

ElleKayEm commented 1 month ago

Yeah, if Epubor can work, then DeDRM should work. Try DeDRM 10.0.9: https://github.com/noDRM/DeDRM_tools/releases/tag/v10.0.9

Delete the Adobe key that is saved in DeDRM. Restart calibre and add your books.

You can import the Kobo Desktop books with Obok.