noDRM / DeDRM_tools

DeDRM tools for ebooks
7.32k stars 323 forks source link

DeDRM not working #634

Closed Double-Jumper closed 1 month ago

Double-Jumper commented 1 month ago

Question / bug report

Failed to remove the DRM from "What If? 2". It worked fine for another book, though it was released in 2010 while this is from 2022, so that's not saying much.

Which version of Calibre are you running?

7.17.0

Which version of the DeDRM plugin are you running?

v10.0.9

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

2.4.0

Log output

ApplicationPaletteChange event ignored
Using calibre Qt style: True
calibre Debug log
calibre 7.17  embedded-python: False
Linux-6.10.5-arch1-1-x86_64-with-glibc2.40 Linux ('64bit', 'ELF')
('Linux', '6.10.5-arch1-1', '#1 SMP PREEMPT_DYNAMIC Thu, 15 Aug 2024 00:25:30 +0000')
Python 3.12.6
Interface language: None
EXE path: /usr/bin/python3
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 15, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 15, 0) && KFX metadata reader (from KFX Input) (2, 15, 0) && From KFX (2, 15, 0) && KFX Input (2, 15, 0)
calibre 7.17  embedded-python: False
Linux-6.10.5-arch1-1-x86_64-with-glibc2.40 Linux ('64bit', 'ELF')
('Linux', '6.10.5-arch1-1', '#1 SMP PREEMPT_DYNAMIC Thu, 15 Aug 2024 00:25:30 +0000')
Python 3.12.6
Interface language: None
EXE path: /usr/bin/python3
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 15, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 15, 0) && KFX metadata reader (from KFX Input) (2, 15, 0) && From KFX (2, 15, 0) && KFX Input (2, 15, 0)
QPA platform: wayland
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 81.55183946488295 x 81.64285714285714
[0.00] Starting up...
[0.00] Showing splash screen...
[1.03] splash screen shown
[1.03] Initializing db...
[1.18] db initialized
[1.18] Constructing main UI...
[1.96] GUI main window shown
[1.99] main UI initialized...
[1.99] Hiding splash screen
[1.99] splash screen hidden
[1.99] Started up in 1.99 seconds with 0 books
Gather KFX-ZIP (from KFX Input) 2.15.0: Importing /home/jumper/Documents/ebooks/B09RDS8J7J_EBOK/B09RDS8J7J_EBOK.azw
Gather KFX-ZIP (from KFX Input): Gathered 10 file(s) as /tmp/calibre_7.17.0_tmp__nskkfqu/y7l_m29m.kfx-zip
DeDRM v10.0.9: Trying to decrypt y7l_m29m.kfx-zip
Decrypting KFX-ZIP ebook: y7l_m29m
Found 0 keys to try after 0.6 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.6a16a866-fd1d-4c04-bdda-5779190aa980.voucher
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Decryption failed, trying next fallback 
Traceback (most recent call last):
  File "/home/jumper/.config/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher
    voucher.decryptvoucher()
  File "/home/jumper/.config/calibre/plugins/DeDRM.zip/ion.py", line 1368, in decryptvoucher
    raise ex
          ^^
UnboundLocalError: cannot access local variable 'ex' where it is not associated with a value
DeDRM v10.0.9: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key
DeDRM v10.0.9: Looking for new default Kindle Key after 0.6 seconds
0098:fixme:wineusb:query_id Unhandled ID query type 0x5.
0098:fixme:wineusb:query_id Unhandled ID query type 0x5.
0098:fixme:wineusb:query_id Unhandled ID query type 0x5.
0098:fixme:wineusb:query_id Unhandled ID query type 0x5.
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: File not found.

DeDRM v10.0.9: wine py.exe -3 is not python3
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: File not found.

DeDRM v10.0.9: wine python3.exe is not python3
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: File not found.

DeDRM v10.0.9: wine python.exe is not python3
wine: failed to open "C:\\Python27\\python.exe": c0000135
DeDRM v10.0.9: wine C:\Python27\python.exe does not exist
DeDRM v10.0.9: Unable to find python3 executable in WINEPREFIX=""
DeDRM v10.0.9: Ultimately failed to decrypt after 1.3 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_plugins.dedrm.__init__", line 931, in KindleMobiDecrypt
    book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jumper/.config/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 203, in GetDecryptedBook
    mb.processBook(totalpids)
  File "/home/jumper/.config/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook
    self.decrypt_voucher(totalpids)
  File "/home/jumper/.config/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, in decrypt_voucher
    raise Exception("Failed to decrypt KFX DRM voucher with any key")
Exception: Failed to decrypt KFX DRM voucher with any key

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 199, in _run_filetype_plugins
    nfp = plugin.run(nfp) or nfp
          ^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 1030, in run
    decrypted_ebook = self.KindleMobiDecrypt(path_to_ebook)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 981, in KindleMobiDecrypt
    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.9: Ultimately failed to decrypt after 1.3 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Package KFX (from KFX Input) 2.15.0: Packaging /tmp/calibre_7.17.0_tmp__nskkfqu/y7l_m29m.kfx-zip
Processing container: B09RDS8J7J_EBOK.azw
Running file type plugin Package KFX (from KFX Input) failed with traceback:
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 199, in _run_filetype_plugins
    nfp = plugin.run(nfp) or nfp
          ^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.package_filetype", line 23, in run
    return self.package_kfx(path_to_ebook)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.package_filetype", line 34, in package_kfx
    kfx_data = YJ_Book(path_to_ebook).convert_to_single_kfx()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 79, in convert_to_single_kfx
    self.decode_book()
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 212, in decode_book
    container = self.get_container(datafile)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 321, in get_container
    raise KFXDRMError("Book container %s has DRM and cannot be converted" % datafile.name)
calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B09RDS8J7J_EBOK.azw has DRM and cannot be converted
KFX metadata reader (from KFX Input) activated for /tmp/calibre_7.17.0_tmp__nskkfqu/o2mlgmr6_add_books/0/B09RDS8J7J_EBOK.kfx-zip
Added What If?2: Additional Serious Scientific Answers to Absurd Hypothetical Questions to db in: 0.2
Added 1 books in 2.7 seconds
ElleKayEm commented 1 month ago

2010 vs 2022 or even 2024 shouldn't be an issue. Did you download the other one the same way with the same installation of Kindle for PC? This doesn't look like it is finding your key and there wasn't a previously saved key.

Double-Jumper commented 1 month ago

2010 vs 2022 or even 2024 shouldn't be an issue. Did you download the other one the same way with the same installation of Kindle for PC? This doesn't look like it is finding your key and there wasn't a previously saved key.

Yes, they were downloaded during the same session, even zipped together to transfer between PCs. I suppose I'll try to erase everything and redo the process for sanity sake, let's see... Yep, same results. Would it help to send a log showing both being added in the same session? The book that worked was Jumper, by Steven Gould.

ElleKayEm commented 1 month ago

DeDRM can't retrieve your key if Kindle for PC is on a different computer.

Double-Jumper commented 1 month ago

DeDRM can't retrieve your key if Kindle for PC is on a different computer.

Ah. That makes more sense, I just feel silly now thinking it was all in the book files somehow. I suppose I didn't consider that possibly being a requirement after one of them worked. Anyway thanks, now it works.