noDRM / DeDRM_tools

DeDRM tools for ebooks
6.56k stars 287 forks source link

Drm removal not working #522

Closed heldilira closed 2 months ago

heldilira commented 2 months ago

Question / bug report

Any help on why this is not working, i tried both on the kindle mac app and downloading from the amazon website!

Which version of Calibre are you running?

7.7.0

Which version of the DeDRM plugin are you running?

v10.0.09

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

No response

Log output

ApplicationPaletteChange event ignored
Using calibre Qt style: True
2024-04-02 12:28:42.171 calibre-debug[79721:5915895] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
2024-04-02 12:28:43.012 calibre-debug[79721:5915895] TSMSendMessageToUIServer: CFMessagePortSendRequest FAILED(-1) to send to port com.apple.tsm.uiserver
2024-04-02 12:28:43.012 calibre-debug[79721:5915895] TSMSendMessageToUIServer: CFMessagePortSendRequest FAILED(-1) to send to port com.apple.tsm.uiserver
2024-04-02 12:28:43.012 calibre-debug[79721:5915895] TSMSendMessageToUIServer: CFMessagePortSendRequest FAILED(-1) to send to port com.apple.tsm.uiserver
2024-04-02 12:28:43.012 calibre-debug[79721:5915895] TSMSendMessageToUIServer: CFMessagePortSendRequest FAILED(-1) to send to port com.apple.tsm.uiserver
calibre Debug log
calibre 7.7  embedded-python: True
macOS-14.3.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.3.0', 'Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000')
Python 3.11.5
OSX: ('14.3.1', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre-debug
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 10, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 10, 0) && KFX metadata reader (from KFX Input) (2, 10, 0) && From KFX (2, 10, 0) && KFX Input (2, 10, 0)
calibre 7.7  embedded-python: True
macOS-14.3.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.3.0', 'Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000')
Python 3.11.5
OSX: ('14.3.1', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre-debug
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 10, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 10, 0) && KFX metadata reader (from KFX Input) (2, 10, 0) && From KFX (2, 10, 0) && KFX Input (2, 10, 0)
QPA platform: cocoa
devicePixelRatio: 2.0
logicalDpi: 72.0 x 72.0
physicalDpi: 127.50000191485789 x 127.50000191485789
[0.00] Starting up...
[0.01] Showing splash screen...
[0.15] splash screen shown
[0.15] Initializing db...
[0.16] db initialized
[0.16] Constructing main UI...
[0.66] GUI main window shown
[0.69] main UI initialized...
[0.69] Hiding splash screen
2024-04-02 12:29:16.164 calibre-debug[79721:5915895] TSMSendMessageToUIServer: CFMessagePortSendRequest FAILED(-1) to send to port com.apple.tsm.uiserver
2024-04-02 12:29:16.166 calibre-debug[79721:5915895] TSMSendMessageToUIServer: CFMessagePortSendRequest FAILED(-1) to send to port com.apple.tsm.uiserver
Gather KFX-ZIP (from KFX Input) 2.10.0: Importing /Users/helderlira/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/My Kindle Content/B0BLHXRPDG_EBOK/B0BLHXRPDG_EBOK.azw
[10.50] splash screen hidden
[10.50] Started up in 10.50 seconds with 6 books
Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as /var/folders/rw/z16hgrsx3p75sh1hkkc0r9y80000gn/C/calibre_7.7.0_tmp_twun1wyo/ubcbtjyr.kfx-zip
DeDRM v10.0.9: Trying to decrypt ubcbtjyr.kfx-zip
Decrypting KFX-ZIP ebook: ubcbtjyr
Found 0 keys to try after 0.3 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.5de806db-ef07-4067-9fbc-e6b09085a633.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 "/Users/helderlira/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher
    voucher.decryptvoucher()
  File "/Users/helderlira/Library/Preferences/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.3 seconds
Found k4Mac kinf2018 file: /Users/helderlira/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018
trying username  b'helderlira'  on file  /Users/helderlira/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018
trying IDString: b'9b210eb528c6'
trying IDString: b'9b210eb528c1'
trying IDString: b'9b210eb528c0'
trying IDString: b'93f2e3ec0ca5'
trying IDString: b'1975d114978a'
Decrypted key file using IDString '1975d114978a' and UserName 'helderlira'
DeDRM v10.0.9: Found 1 new key
Decrypting KFX-ZIP ebook: ubcbtjyr
Got DSN key from database key_0
Found 1 keys to try after 1.0 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.5de806db-ef07-4067-9fbc-e6b09085a633.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 "calibre_plugins.dedrm.__init__", line 931, in KindleMobiDecrypt
    book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/helderlira/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 203, in GetDecryptedBook
    mb.processBook(totalpids)
  File "/Users/helderlira/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook
    self.decrypt_voucher(totalpids)
  File "/Users/helderlira/Library/Preferences/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 "/Users/helderlira/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher
    voucher.decryptvoucher()
  File "/Users/helderlira/Library/Preferences/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
Decryption failed, trying next fallback 
Decryption succeeded
KFX DRM voucher successfully decrypted
Decrypting KFX DRMION: B0BLHXRPDG_EBOK.azw
Decryption succeeded after 1.1 seconds
DeDRM v10.0.9: Saving 1 new key
DeDRM v10.0.9: Finished after 1.1 seconds
Package KFX (from KFX Input) 2.10.0: Packaging /var/folders/rw/z16hgrsx3p75sh1hkkc0r9y80000gn/C/calibre_7.7.0_tmp_twun1wyo/m3zzb4b9.kfx-zip
Processing container: B0BLHXRPDG_EBOK.azw
Processing container: CR!JCHFBD32951Z35S2G3SH16FZTT40.azw.res
Processing container: CR!QW419X0SB90654K5N419R6SNPRVK.azw.md
Features: CanonicalFormat-2, kfxgen.textBlock-1, max_id-825, reflow-section-size-2, reflow-style-6, yj_table-6, yj_table_viewer-2
Metadata: ASIN=B0BLHXRPDG, asset_id=CR!NWB41PSH0H0CV8GS218MJ71Z3W16, author="Alvarenga, Marle", book_id=5fcHP5izRDq1f_gnt-A2Yg0, cde_content_type=EBOK, content_id=B0BLHXRPDG, cover_image=1319x1920, creator_version=2.15.0, file_creator=YJConversionTools, is_sample=False, kfxgen=20.12.238.0, language=pt, nested_span=enabled, override_kindle_font=False, pages=314, publisher="Editora Manole", reading_orders=1, selection=enabled, title="Nutrição comportamental: ciência, prática clínica e comunicação"
Package KFX (from KFX Input): Imported as KFX
KFX metadata reader (from KFX Input) activated for /var/folders/rw/z16hgrsx3p75sh1hkkc0r9y80000gn/C/calibre_7.7.0_tmp_twun1wyo/9_8l5lld_add_books/0/B0BLHXRPDG_EBOK.kfx
Added Nutrição comportamental: ciência, prática clínica e comunicação to db in: 0.0
Added 1 books in 3.7 seconds
ElleKayEm commented 2 months ago

I'm not sure why the Kindle for Mac copy did not work. Was it downloaded with the current installation of Kindle for Mac on the same computer and user as calibre/DeDRM?

As for the copy downloaded from the website, did you choose an E-ink Kindle (not a Fire) for the device? If so, you need to add that Kindle's serial number into DeDRM's customization.

heldilira commented 2 months ago

Nice, i added the Kindle's Serial Number and it worked for the downloaded amazon website version, the other Kindle for Mac version (Version: 1.40.3 (66426) Last Updated: 11/9/2022 11:50 AM) still not working, but i least i got it! Thank you so much @ElleKayEm

I'm not sure why the Kindle for Mac copy did not work. Was it downloaded with the current installation of Kindle for Mac on the same computer and user as calibre/DeDRM?

As for the copy downloaded from the website, did you choose an E-ink Kindle (not a Fire) for the device? If so, you need to add that Kindle's serial number into DeDRM's customization.

ElleKayEm commented 2 months ago

Looking at the log again, it shows that the decryption eventually succeeded with the Kindle for Mac version too.