apprenticeharper / DeDRM_tools

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

Failure to remove DRM from a purchased kfx book #1512

Open extesy opened 3 years ago

extesy commented 3 years ago

CheckList


Problem

Two different ways of stripping DRM from kfx file both fail: 1) using Kindle for PC, 2) using Kindle Voyager. Second one looks like still has python3 issues, but first one I have no clue what's wrong. No obvious errors other than all keys failed.

My Environment

Calibre: 5.10.1

Kindle: Voyager, Kindle for PC 1.24.3

DeDRM: 7.0.3 with #1490 and #1499 applied

Log

Debug log ```log calibre Debug log calibre 5.10.1 [64bit] embedded-python: True is64bit: True Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', '', 'Multiprocessor Free') Interface language: None Failed to initialize plugin: 'C:\\Users\\olega\\AppData\\Roaming\\calibre\\plugins\\FictionDB.zip' Failed to initialize plugin: 'C:\\Users\\olega\\AppData\\Roaming\\calibre\\plugins\\Inept Epub DeDRM.zip' Failed to initialize plugin: 'C:\\Users\\olega\\AppData\\Roaming\\calibre\\plugins\\Kindle and Mobipocket DeDRM.zip' Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 36, 0) && DeDRM (7, 0, 3) && Package KFX (from KFX Input) (1, 36, 0) && Barnes & Noble (1, 2, 16) && Find Duplicates (1, 8, 4) && Goodreads (1, 5, 1) && Goodreads Sync (1, 15, 0) && Job Spy (1, 0, 190) && KFX metadata reader (from KFX Input) (1, 36, 0) && KFX Input (1, 36, 0) && Kindle Collections (1, 7, 29) && Overdrive Link (2, 44, 0) && Quality Check (1, 11, 0) && Save To Format (0, 0, 6) calibre 5.10.1 [64bit] embedded-python: True is64bit: True Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', '', 'Multiprocessor Free') Interface language: None Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 36, 0) && DeDRM (7, 0, 3) && Package KFX (from KFX Input) (1, 36, 0) && Barnes & Noble (1, 2, 16) && Find Duplicates (1, 8, 4) && Goodreads (1, 5, 1) && Goodreads Sync (1, 15, 0) && Job Spy (1, 0, 190) && KFX metadata reader (from KFX Input) (1, 36, 0) && KFX Input (1, 36, 0) && Kindle Collections (1, 7, 29) && Overdrive Link (2, 44, 0) && Quality Check (1, 11, 0) && Save To Format (0, 0, 6) Turning on automatic hidpi scaling devicePixelRatio: 1.0 logicalDpi: 96.0 x 96.0 physicalDpi: 108.91792294807368 x 108.85714285714285 Using calibre Qt style: True [0.00] Starting up... [0.00] Initializing db... [0.05] db initialized [0.05] Constructing main UI... DEBUG: 0.0 Goodreads Sync::dialogs.py - loading translations DEBUG: 0.0 GoodreadsSync::action.py - loading translations DEBUG: 0.7 HttpHelper::__init__: proxy=None Job Spy has begun initialization... Calibre, and hence Job Spy, was gracefully shut down last time? True Last time daemon started: never Last time daemon failed: never Total daemon starts inception_to_date: 0 Total daemon failures inception-to-date: 0 Job Spy has finished initialization... [1.44] main UI initialized... [1.44] Started up in 1.44 seconds with 771 books Starting QuickView stdout+stderr from file dialog helper: [b'', b''] piped data from file dialog helper: [b'G\x02 ".8v\x03\xb7\xba\xa2\xf1\xa9%T\xb1\xb1w\xce\x05\xb4\xec\x99d\x84\x17\xc1\x06cnv\xd5', b'C:\\Users\\olega\\Documents\\My Kindle Content\\B0847KH373_EBOK\\B0847KH373_EBOK.azw'] Gather KFX-ZIP (from KFX Input) 1.36.0: Importing C:\Users\olega\Documents\My Kindle Content\B0847KH373_EBOK\B0847KH373_EBOK.azw Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\olega\AppData\Local\Temp\calibre_15e67mg2\dsoiyiqx.kfx-zip DeDRM v7.0.3: Trying to decrypt dsoiyiqx.kfx-zip Using Library AlfCrypto DLL/DYLIB/SO Using Library AlfCrypto DLL/DYLIB/SO Decrypting KFX-ZIP ebook: dsoiyiqx Got DSN key from database default_key_2 Got DSN key from database default_key_3 Found 11 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.f39532d4-b2c6-4a96-b3a6-83f04d2b04d6.voucher DeDRM v7.0.3: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.0.3: Looking for new default Kindle Key after 0.1 seconds searching for kinfoFiles in C:\Users\olega\AppData\Local Found K4PC 1.9+ kinf2011 file: C:\Users\olega\AppData\Local\Amazon\Kindle\storage\.kinf2011 Decrypted key file using IDString '81055232' and UserName 'olega' DeDRM v7.0.3: Found 1 new key Decrypting KFX-ZIP ebook: dsoiyiqx Got DSN key from database default_key_1 Found 1 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.f39532d4-b2c6-4a96-b3a6-83f04d2b04d6.voucher DeDRM v7.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Package KFX (from KFX Input) 1.36.0: Packaging C:\Users\olega\AppData\Local\Temp\calibre_15e67mg2\dsoiyiqx.kfx-zip Processing container: B0847KH373_EBOK.azw stdout+stderr from file dialog helper: [b'', b''] piped data from file dialog helper: [b'V\x90\xa7\xdf\x13\xc41\x04;\x11\xd2N\xd1\xb8J\xfb\x95\xc4\xc5\x1a\xadI\xe5\xeaxb\x0fF\x81\xce\xa3\x0e', b'C:\\Users\\olega\\Documents\\My Kindle Content\\B0847KH373_EBOK\\B0847KH373_EBOK.azw'] Gather KFX-ZIP (from KFX Input) 1.36.0: Importing C:\Users\olega\Documents\My Kindle Content\B0847KH373_EBOK\B0847KH373_EBOK.azw Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\olega\AppData\Local\Temp\calibre_15e67mg2\lnjxyg74.kfx-zip DeDRM v7.0.3: Trying to decrypt lnjxyg74.kfx-zip Decrypting KFX-ZIP ebook: lnjxyg74 Got DSN key from database default_key_2 Got DSN key from database default_key_3 Found 11 keys to try after 0.0 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.f39532d4-b2c6-4a96-b3a6-83f04d2b04d6.voucher DeDRM v7.0.3: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.0.3: Looking for new default Kindle Key after 0.0 seconds searching for kinfoFiles in C:\Users\olega\AppData\Local Found K4PC 1.9+ kinf2011 file: C:\Users\olega\AppData\Local\Amazon\Kindle\storage\.kinf2011 Decrypted key file using IDString '81055232' and UserName 'olega' DeDRM v7.0.3: Found 1 new key Decrypting KFX-ZIP ebook: lnjxyg74 Got DSN key from database default_key_1 Found 1 keys to try after 0.0 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.f39532d4-b2c6-4a96-b3a6-83f04d2b04d6.voucher DeDRM v7.0.3: Ultimately failed to decrypt after 0.0 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Package KFX (from KFX Input) 1.36.0: Packaging C:\Users\olega\AppData\Local\Temp\calibre_15e67mg2\lnjxyg74.kfx-zip Processing container: B0847KH373_EBOK.azw stdout+stderr from file dialog helper: [b'', b''] piped data from file dialog helper: [b"\xb7A\xe4\xf1'v\xb0\x81\x83\xe8\xde[\x8d\xd2\xf5\xf2a\x0f\xea\x94\x83\x10;\x96\x8f\x8c\xaf\xa65\xd5\x95\xec", b'C:\\Users\\olega\\Documents\\My Kindle Content\\The Trouble with Peace (The Age of Madness Book 2)_B0847KH373.kfx'] Gather KFX-ZIP (from KFX Input) 1.36.0: Importing C:\Users\olega\Documents\My Kindle Content\The Trouble with Peace (The Age of Madness Book 2)_B0847KH373.kfx Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\olega\AppData\Local\Temp\calibre_15e67mg2\jylkvaj3.kfx-zip DeDRM v7.0.3: Trying to decrypt jylkvaj3.kfx-zip Decrypting KFX-ZIP ebook: jylkvaj3 Got DSN key from database default_key_2 Got DSN key from database default_key_3 Found 11 keys to try after 0.0 seconds Decrypting KFX DRM voucher: voucher DeDRM v7.0.3: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.0.3: Looking for new default Kindle Key after 0.0 seconds searching for kinfoFiles in C:\Users\olega\AppData\Local Found K4PC 1.9+ kinf2011 file: C:\Users\olega\AppData\Local\Amazon\Kindle\storage\.kinf2011 Decrypted key file using IDString '81055232' and UserName 'olega' DeDRM v7.0.3: Found 1 new key Decrypting KFX-ZIP ebook: jylkvaj3 Got DSN key from database default_key_1 Found 1 keys to try after 0.0 seconds Decrypting KFX DRM voucher: voucher DeDRM v7.0.3: Ultimately failed to decrypt after 0.0 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Package KFX (from KFX Input) 1.36.0: Packaging C:\Users\olega\AppData\Local\Temp\calibre_15e67mg2\jylkvaj3.kfx-zip Processing container: CR!BC314EP9M57JQB4YP9W7YBYW0RJ2.kfx Processing container: The Trouble with Peace (The Age of Madness Book 2)_B0847KH373.kfx Traceback (most recent call last): File "calibre\customize\ui.py", line 703, in initialize_plugins File "calibre\customize\ui.py", line 61, in load_plugin File "calibre\customize\zipplugin.py", line 293, in load File "importlib\__init__.py", line 127, in import_module File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "calibre\customize\zipplugin.py", line 192, in exec_module File "calibre_plugins.fictiondb.__init__", line 11, in ImportError: cannot import name 'quote' from 'urllib' (C:\Tools\Text\Calibre\app\bin\python-lib.bypy.frozen\urllib\__init__.pyc) Traceback (most recent call last): File "calibre\customize\ui.py", line 703, in initialize_plugins File "calibre\customize\ui.py", line 61, in load_plugin File "calibre\customize\zipplugin.py", line 293, in load File "importlib\__init__.py", line 127, in import_module File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "calibre\customize\zipplugin.py", line 185, in exec_module File "calibre\customize\zipplugin.py", line 181, in get_code File "calibre_plugins.ineptepub.__init__", line 168 print 'IneptEpub: Using libcrypto.' ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print('IneptEpub: Using libcrypto.')? Traceback (most recent call last): File "calibre\customize\ui.py", line 703, in initialize_plugins File "calibre\customize\ui.py", line 61, in load_plugin File "calibre\customize\zipplugin.py", line 293, in load File "importlib\__init__.py", line 127, in import_module File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "calibre\customize\zipplugin.py", line 185, in exec_module File "calibre\customize\zipplugin.py", line 181, in get_code File "calibre_plugins.k4mobidedrm.__init__", line 78 print "'%s' is not a valid Mobipocket PID." % pid ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("'%s' is not a valid Mobipocket PID." % pid)? Traceback (most recent call last): File "calibre\gui2\ui.py", line 134, in __init__ File "calibre\gui2\ui.py", line 152, in init_iaction File "calibre\customize\__init__.py", line 616, in load_actual_plugin File "importlib\__init__.py", line 127, in import_module File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "calibre\customize\zipplugin.py", line 185, in exec_module File "calibre\customize\zipplugin.py", line 181, in get_code File "calibre_plugins.savetoformat.savetoformataction", line 53 print 'Default saving' ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Default saving')? Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 537, in KindleMobiDecrypt File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook File "calibre_plugins.dedrm.kfxdedrm", line 42, in processBook File "calibre_plugins.dedrm.kfxdedrm", line 82, in decrypt_voucher 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 "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.dedrm.__init__", line 630, in run File "calibre_plugins.dedrm.__init__", line 580, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Running file type plugin Package KFX (from KFX Input) failed with traceback: Traceback (most recent call last): File "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.kfx_input.package_filetype", line 21, in run File "calibre_plugins.kfx_input.package_filetype", line 32, in run_kfx File "calibre_plugins.kfx_input.kfxlib.yj_book", line 83, in convert_to_single_kfx File "calibre_plugins.kfx_input.kfxlib.yj_book", line 208, in decode_book File "calibre_plugins.kfx_input.kfxlib.yj_book", line 315, in get_container calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B0847KH373_EBOK.azw has DRM and cannot be converted Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 537, in KindleMobiDecrypt File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook File "calibre_plugins.dedrm.kfxdedrm", line 42, in processBook File "calibre_plugins.dedrm.kfxdedrm", line 82, in decrypt_voucher 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 "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.dedrm.__init__", line 630, in run File "calibre_plugins.dedrm.__init__", line 580, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.3: Ultimately failed to decrypt after 0.0 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Running file type plugin Package KFX (from KFX Input) failed with traceback: Traceback (most recent call last): File "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.kfx_input.package_filetype", line 21, in run File "calibre_plugins.kfx_input.package_filetype", line 32, in run_kfx File "calibre_plugins.kfx_input.kfxlib.yj_book", line 83, in convert_to_single_kfx File "calibre_plugins.kfx_input.kfxlib.yj_book", line 208, in decode_book File "calibre_plugins.kfx_input.kfxlib.yj_book", line 315, in get_container calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B0847KH373_EBOK.azw has DRM and cannot be converted Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 537, in KindleMobiDecrypt File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook File "calibre_plugins.dedrm.kfxdedrm", line 42, in processBook File "calibre_plugins.dedrm.kfxdedrm", line 82, in decrypt_voucher 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 "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.dedrm.__init__", line 630, in run File "calibre_plugins.dedrm.__init__", line 580, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.3: Ultimately failed to decrypt after 0.0 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Running file type plugin Package KFX (from KFX Input) failed with traceback: Traceback (most recent call last): File "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.kfx_input.package_filetype", line 21, in run File "calibre_plugins.kfx_input.package_filetype", line 32, in run_kfx File "calibre_plugins.kfx_input File "calibre_plugins.kfx_input.kfxlib.yj_book", line 208, in decode_book File "calibre_plugins.kfx_input.kfxlib.yj_book", line 315, in get_container calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container The Trouble with Peace (The Age of Madness Book 2)_B0847KH373.kfx has DRM and cannot be converted ```
ElleKayEm commented 3 years ago

For Kindle for PC, you'll probably need to disable KFX downloads and get the older format to stick with DeDRM 7.0.3. If you want to stick with KFX format, calibre 4.23 and DeDRM 6.8.1 will work.

I don't think KFX format from E-ink Kindles can be decrypted yet. Do you have the Voyager's serial number in DeDRM's customization? You can decrypt the older format that you get from the website by choosing "download & transfer via USB" and selecting the Voyage as the device.

extesy commented 3 years ago

@ElleKayEm It did work with other kfx books on calibre 5, just not this book. Yes, I do have Voyager's serial number and azw3 decryption does work, but I also want kfx and it does work for other books with the same setup.

ElleKayEm commented 3 years ago

KFX from Kindle for PC should work with calibre 4.23 and DeDRM 6.8.1.

extesy commented 3 years ago

I know and it does, but if you ever plan to address calibre 5 compatibility, you do need bug reports. And today's state of this repo is that kfx drm stripping mostly works in calibre 5, and here is an exception where it doesn't.

ElleKayEm commented 3 years ago

Good to know that it mostly works now. All I usually see here are the cases where it doesn't! And often it's hard to tell if that's DeDRM 7 or a problem with the person's setup.