noDRM / DeDRM_tools

DeDRM tools for ebooks
6.57k stars 287 forks source link

DeDRM 10.0.9 not removing DRM from AZW files in Calibre 7.1.0 for Mac (Take 2) #453

Open zimdog1701 opened 6 months ago

zimdog1701 commented 6 months ago

Question / bug report

Downloaded AZW files from Kindle app on PC (where Calibre/DeDRM worked fine), then imported them to Calibre on Mac, but when trying to view imported files, Calibre viewer reported that they were still protected by DRM.

Which version of Calibre are you running?

7.1.0

Which version of the DeDRM plugin are you running?

v10.0.9

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

1.27.56109 (PC)

Log output

Using calibre Qt style: True 2023-12-10 08:41:53.079 calibre-debug[34547:811990] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES. calibre Debug log calibre 7.1 embedded-python: True macOS-14.1.1-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '23.1.0', 'Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64') Python 3.11.5 OSX: ('14.1.1', ('', '', ''), 'x86_64') Interface language: None Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 6, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 6, 0) && KFX metadata reader (from KFX Input) (2, 6, 0) && KFX Input (2, 6, 0) && Set KFX metadata (from KFX Output) (2, 4, 0) && KFX Output (2, 4, 0) calibre 7.1 embedded-python: True macOS-14.1.1-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '23.1.0', 'Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64') Python 3.11.5 OSX: ('14.1.1', ('', '', ''), 'x86_64') Interface language: None Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 6, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 6, 0) && KFX metadata reader (from KFX Input) (2, 6, 0) && KFX Input (2, 6, 0) && Set KFX metadata (from KFX Output) (2, 4, 0) && KFX Output (2, 4, 0) QPA platform: cocoa devicePixelRatio: 1.0 logicalDpi: 72.0 x 72.0 physicalDpi: 93.00000139671988 x 93.0000013967199 [0.00] Starting up... [0.02] Showing splash screen... [0.18] splash screen shown [0.18] Initializing db... [0.19] db initialized [0.19] Constructing main UI... [0.86] main UI initialized... [0.86] Hiding splash screen Starting QuickView Gather KFX-ZIP (from KFX Input) 2.6.0: Importing /Volumes/Public/My Kindle Content/B071QY23HZ_EBOK/B071QY23HZ_EBOK.azw Gather KFX-ZIP (from KFX Input): File is not KFX format DeDRM v10.0.9: Trying to decrypt B071QY23HZ_EBOK.azw [3.73] splash screen hidden [3.73] Started up in 3.73 seconds with 20 books MobiDeDrm v1.1. Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al. Decrypting Kindle Format 8 ebook: DC Comics Presents (1978-1986) Annual #4 Got SerialNumber from database default_key Got UsernameHash from database default_key Found 7 keys to try after 0.7 seconds Crypto Type is: 2 DeDRM v10.0.9: Failed to decrypt with error: No key found in 7 PIDs tried. DeDRM v10.0.9: Looking for new default Kindle Key after 0.7 seconds Found k4Mac kinf2018 file: /Users/charliez/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018 Found k4Mac kinf2018 file: /Users/charliez/Library/Application Support/Kindle/storage/.kinf2018 trying username b'charliez' on file /Users/charliez/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018 trying IDString: b'a545e9b2cd62' trying IDString: b'2f24f0deb164' trying IDString: b'3539eff5123b' Decrypted key file using IDString '3539eff5123b' and UserName 'charliez' trying username b'charliez' on file /Users/charliez/Library/Application Support/Kindle/storage/.kinf2018 trying IDString: b'a545e9b2cd62' trying IDString: b'2f24f0deb164' trying IDString: b'3539eff5123b' Decrypted key file using IDString '3539eff5123b' and UserName 'charliez' DeDRM v10.0.9: Found 2 new keys MobiDeDrm v1.1. Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al. Decrypting Kindle Format 8 ebook: DC Comics Presents (1978-1986) Annual #4 Got DSN key from database key_0 Got DSN key from database key_1 Found 8 keys to try after 3.7 seconds Crypto Type is: 2 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/charliez/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 203, in GetDecryptedBook mb.processBook(totalpids) File "/Users/charliez/Library/Preferences/calibre/plugins/DeDRM.zip/mobidedrm.py", line 401, in processBook raise DrmException("No key found in {0:d} PIDs tried.".format(len(goodpids))) mobidedrm.DrmException: No key found in 7 PIDs tried.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 965, in KindleMobiDecrypt book = k4mobidedrm.GetDecryptedBook(path_to_ebook,newkeys.items(),[],[],[],self.starttime) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/charliez/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 203, in GetDecryptedBook mb.processBook(totalpids) File "/Users/charliez/Library/Preferences/calibre/plugins/DeDRM.zip/mobidedrm.py", line 401, in processBook raise DrmException("No key found in {0:d} PIDs tried.".format(len(goodpids))) mobidedrm.DrmException: No key found in 8 PIDs tried. DeDRM v10.0.9: Ultimately failed to decrypt after 3.7 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 "/Users/charliez/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 203, in GetDecryptedBook mb.processBook(totalpids) File "/Users/charliez/Library/Preferences/calibre/plugins/DeDRM.zip/mobidedrm.py", line 401, in processBook raise DrmException("No key found in {0:d} PIDs tried.".format(len(goodpids))) mobidedrm.DrmException: No key found in 7 PIDs tried.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "calibre/customize/ui.py", line 187, in _run_filetype_plugins 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 3.7 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md QAbstractItemView::commitData called with an editor that does not belong to this view QAbstractItemView::closeEditor called with an editor that does not belong to this view 2023-12-10 08:42:41.890 calibre-parallel[34589:812876] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

ElleKayEm commented 6 months ago

If the book wasn't downloaded with the Kindle app on this machine and user, DeDRM won't be able to find the key. Each Kindle app has a unique key even for the same Amazon account.

zimdog1701 commented 6 months ago

Okay, so AZW files are device-specific... good to know! Are there any issues between different versions of the Kindle software?

ElleKayEm commented 6 months ago

All amazon drm is tied to a specific app installation or Kindle device. So if for whatever reason you re-installed an app and had to log in again, the key will likely have changed. DeDRM will save a key it has success with, but will look for a new key if the saved key doesn't work.

Older versions of Kindle for PC/Mac cannot download books published after 3 Jan 2023. Some of the older versions have different ways of avoiding kfx format. Details here under the spoiler button: https://www.mobileread.com/forums/showthread.php?t=283371

zimdog1701 commented 6 months ago

Well, I tried Method 2B on the Mac (thus disabling KFX support) but I still got KCR files. Which thus got me nowhere.

ElleKayEm commented 6 months ago

I suggest asking about only getting KCR files in the thread for that post. The site policy prevents detailed discussion of DRM removal. But asking about how to download another format will be fine. Someone there with Mac experience on this should be able to help.

ZolaLa9 commented 6 months ago

Well, I tried Method 2B on the Mac (thus disabling KFX support) but I still got KCR files. Which thus got me nowhere.

Did you see this for Mac? Note that you must be using an older version of Kindle for Mac — no later than v1.31 https://www.mobileread.com/forums/showpost.php?p=3819708&postcount=508