apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.52k stars 1.51k forks source link

[QUESTION] Couldn't DeDRM Purchased Amazon Ebook #1387

Open matheusaraujotrd opened 3 years ago

matheusaraujotrd commented 3 years ago

Couldn't DeDRM Purchased Amazon Ebook

My Environment

Calibre: 5.6

Kindle: 1.24 (Kindle for PC [Windows])

DeDRM: 7.0.0b3

Log

tmp7kaatin_.txt ```log calibre Log de Debug calibre 5.6 embedded-python: True is64bit: False Windows-10-10.0.18362 Windows ('32bit', 'WindowsPE') 32bit process running on 64bit windows ('Windows', '10', '10.0.18362') Python 3.8.5 Windows: ('10', '10.0.18362', '', 'Multiprocessor Free') Interface language: pt_BR Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 36, 0) && DeDRM (7, 0, 0) && Package KFX (from KFX Input) (1, 36, 0) && KFX metadata reader (from KFX Input) (1, 36, 0) && KFX Input (1, 36, 0) calibre 5.6 embedded-python: True is64bit: False Windows-10-10.0.18362 Windows ('32bit', 'WindowsPE') 32bit process running on 64bit windows ('Windows', '10', '10.0.18362') Python 3.8.5 Windows: ('10', '10.0.18362', '', 'Multiprocessor Free') Interface language: pt_BR Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 36, 0) && DeDRM (7, 0, 0) && Package KFX (from KFX Input) (1, 36, 0) && KFX metadata reader (from KFX Input) (1, 36, 0) && KFX Input (1, 36, 0) Turning on automatic hidpi scaling devicePixelRatio: 1.0 logicalDpi: 96.0 x 96.0 physicalDpi: 100.86162790697674 x 101.07357512953367 Using calibre Qt style: True [0.00] Starting up... [0.00] Showing splash screen... [0.78] splash screen shown [0.78] Initializing db... [0.78] db initialized [0.78] Constructing main UI... [1.36] main UI initialized... [1.36] Hiding splash screen Starting QuickView Gather KFX-ZIP (from KFX Input) 1.36.0: Importing C:/Users/Ibyte/Documents/My Kindle Content/B081D8SF4C_EBOK/B081D8SF4C_EBOK.azw Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\Ibyte\AppData\Local\Temp\calibre_uiqj2ios\gmmo9f1a.kfx-zip DeDRM v7.0.0: Trying to decrypt gmmo9f1a.kfx-zip Using Library AlfCrypto DLL/DYLIB/SO Using Library AlfCrypto DLL/DYLIB/SO [23.25] splash screen hidden [23.25] Started up in 23.25 seconds with 13 books Decrypting KFX-ZIP ebook: gmmo9f1a Found 0 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c216290a-04f1-4cc7-ad09-408334232125.voucher DeDRM v7.0.0: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.0.0: Looking for new default Kindle Key after 0.1 seconds searching for kinfoFiles in C:\Users\Ibyte\AppData\Local Found K4PC 1.9+ kinf2011 file: C:\Users\Ibyte\AppData\Local\Amazon\Kindle\storage\.kinf2011 Decrypted key file using IDString '2363320576' and UserName 'Matheus' DeDRM v7.0.0: Found 1 new key Decrypting KFX-ZIP ebook: gmmo9f1a Got DSN key from database default_key_1 DeDRM v7.0.0: Ultimately failed to decrypt after 0.2 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\Ibyte\AppData\Local\Temp\calibre_uiqj2ios\gmmo9f1a.kfx-zip Processing container: B081D8SF4C_EBOK.azw KFX metadata reader (from KFX Input) activated for C:\Users\Ibyte\AppData\Local\Temp\calibre_uiqj2ios\n235ymgy_add_books\0\B081D8SF4C_EBOK.kfx-zip Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 534, 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 627, in run File "calibre_plugins.dedrm.__init__", line 577, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.0: Ultimately failed to decrypt after 0.2 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 B081D8SF4C_EBOK.azw has DRM and cannot be converted Added As quatro incomensuráveis: Práticas para abrir o coração to db in: 0.1 Added 1 books in 1.4 seconds Worker Launch took: 0.21143436431884766 Job: 0 Converter livro 1 de 1 (As quatro incomensuráveis: Práticas para abrir o coração) finished Converter livro 1 de 1 (As quatro incomensuráveis: Práticas para abrir o coração) DeDRM v7.0.0: Trying to decrypt _kvezqat.kfx-zip Using Library AlfCrypto DLL/DYLIB/SO Using Library AlfCrypto DLL/DYLIB/SO Decrypting KFX-ZIP ebook: _kvezqat Found 0 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c216290a-04f1-4cc7-ad09-408334232125.voucher DeDRM v7.0.0: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.0.0: Looking for new default Kindle Key after 0.1 seconds searching for kinfoFiles in C:\Users\Ibyte\AppData\Local Found K4PC 1.9+ kinf2011 file: C:\Users\Ibyte\AppData\Local\Amazon\Kindle\storage\.kinf2011 Decrypted key file using IDString '2363320576' and UserName 'Matheus' DeDRM v7.0.0: Found 1 new key Decrypting KFX-ZIP ebook: _kvezqat Got DSN key from database default_key_1 DeDRM v7.0.0: Ultimately failed to decrypt after 0.2 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Conversion options changed from defaults: verbose: 2 read_metadata_from_opf: 'C:\\Users\\Ibyte\\AppData\\Local\\Temp\\calibre_uiqj2ios\\ti577a6l.opf' output_profile: 'tablet' cover: 'C:\\Users\\Ibyte\\AppData\\Local\\Temp\\calibre_uiqj2ios\\bfp67yz2.jpeg' Resolved conversion options calibre version: 5.6.0 {'allow_conversion_with_errors': False, 'asciiize': False, 'author_sort': None, 'authors': None, 'base_font_size': 0.0, 'book_producer': None, 'change_justification': 'original', 'chapter': "//*[((name()='h1' or name()='h2') and re:test(., " "'\\s*((chapter|book|section|part)\\s+)|((prolog|prologue|epilogue)(\\s+|$))', " "'i')) or @class = 'chapter']", 'chapter_mark': 'pagebreak', 'comments': None, 'cover': 'C:\\Users\\Ibyte\\AppData\\Local\\Temp\\calibre_uiqj2ios\\bfp67yz2.jpeg', 'debug_pipeline': None, 'dehyphenate': True, 'delete_blank_paragraphs': True, 'disable_font_rescaling': False, 'dont_split_on_page_breaks': False, 'duplicate_links_in_toc': False, 'embed_all_fonts': False, 'embed_font_family': None, 'enable_heuristics': False, 'epub_flatten': False, 'epub_inline_toc': False, 'epub_toc_at_end': False, 'epub_version': '2', 'expand_css': False, 'extra_css': None, 'extract_to': None, 'filter_css': '', 'fix_indents': True, 'flow_size': 260, 'font_size_mapping': None, 'format_scene_breaks': True, 'html_unwrap_factor': 0.4, 'input_encoding': None, 'input_profile': , 'insert_blank_line': False, 'insert_blank_line_size': 0.5, 'insert_metadata': False, 'isbn': None, 'italicize_common_cases': True, 'keep_ligatures': False, 'language': None, 'level1_toc': None, 'level2_toc': None, 'level3_toc': None, 'line_height': 0.0, 'linearize_tables': False, 'margin_bottom': 5.0, 'margin_left': 5.0, 'margin_right': 5.0, 'margin_top': 5.0, 'markup_chapter_headings': True, 'max_toc_links': 50, 'minimum_line_height': 120.0, 'no_chapters_in_toc': False, 'no_default_epub_cover': False, 'no_inline_navbars': False, 'no_svg_cover': False, 'output_profile': , 'page_breaks_before': '/', 'prefer_metadata_cover': False, 'preserve_cover_aspect_ratio': False, 'pretty_print': True, 'pubdate': None, 'publisher': None, 'rating': None, 'read_metadata_from_opf': 'C:\\Users\\Ibyte\\AppData\\Local\\Temp\\calibre_uiqj2ios\\ti577a6l.opf', 'remove_fake_margins': True, 'remove_first_image': False, 'remove_paragraph_spacing': False, 'remove_paragraph_spacing_indent_size': 1.5, 'renumber_headings': True, 'replace_scene_breaks': '', 'search_replace': '[]', 'series': None, 'series_index': None, 'smarten_punctuation': False, 'sr1_replace': None, 'sr1_search': None, 'sr2_replace': None, 'sr2_search': None, 'sr3_replace': None, 'sr3_search': None, 'start_reading_at': None, 'subset_embedded_fonts': False, 'tags': None, 'timestamp': None, 'title': None, 'title_sort': None, 'toc_filter': None, 'toc_threshold': 6, 'toc_title': None, 'transform_css_rules': '[]', 'unsmarten_punctuation': False, 'unwrap_lines': True, 'use_auto_toc': False, 'verbose': 2} Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 534, 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 627, in run File "calibre_plugins.dedrm.__init__", line 577, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.0: Ultimately failed to decrypt after 0.2 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md DeDRM v7.0.0: Trying to decrypt _kvezqat.kfx-zip Decrypting KFX-ZIP ebook: _kvezqat Found 0 keys to try after 0.0 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c216290a-04f1-4cc7-ad09-408334232125.voucher DeDRM v7.0.0: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.0.0: Looking for new default Kindle Key after 0.0 seconds searching for kinfoFiles in C:\Users\Ibyte\AppData\Local Found K4PC 1.9+ kinf2011 file: C:\Users\Ibyte\AppData\Local\Amazon\Kindle\storage\.kinf2011 Decrypted key file using IDString '2363320576' and UserName 'Matheus' DeDRM v7.0.0: Found 1 new key Decrypting KFX-ZIP ebook: _kvezqat Got DSN key from database default_key_1 DeDRM v7.0.0: 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 DeDRM failed with traceback: Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 534, 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 627, in run File "calibre_plugins.dedrm.__init__", line 577, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.0: 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 InputFormatPlugin: KFX Input running on C:\Users\Ibyte\AppData\Local\Temp\calibre_uiqj2ios\_kvezqat.kfx-zip Software versions: KFX Input 1.36.0, calibre 5.6, Windows-10-10.0.18362 KFX Input plugin help is available at https://www.mobileread.com/forums/showthread.php?t=291290 Converting C:\Users\Ibyte\AppData\Local\Temp\calibre_uiqj2ios\_kvezqat.kfx-zip Processing container: B081D8SF4C_EBOK.azw Traceback (most recent call last): File "calibre_plugins.kfx_input.__init__", line 105, in convert 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 B081D8SF4C_EBOK.azw has DRM and cannot be converted During handling of the above exception, another exception occurred: Traceback (most recent call last): File "runpy.py", line 194, in _run_module_as_main File "runpy.py", line 87, in _run_code File "site.py", line 82, in File "site.py", line 77, in main File "site.py", line 49, in run_entry_point File "calibre\utils\ipc\worker.py", line 215, in main File "calibre\gui2\convert\gui_conversion.py", line 41, in gui_convert_override File "calibre\gui2\convert\gui_conversion.py", line 28, in gui_convert File "calibre\ebooks\conversion\plumber.py", line 1108, in run File "calibre\customize\conversion.py", line 245, in __call__ File "calibre_plugins.kfx_input.__init__", line 123, in convert calibre.ebooks.DRMError: This b k has DRM! ```
pdurrant commented 3 years ago

It looks like KFX decryption still isn't working in 7.0.0b3. I'd suggested using one of the methods to avoid KFX for now.

xxyzz commented 3 years ago

Current code hides the real error but it should be working for Kindle device KFX books.

matheusaraujotrd commented 3 years ago

It looks like KFX decryption still isn't working in 7.0.0b3. I'd suggested using one of the methods to avoid KFX for now.

I see. I also tried using 6.8. and wasn't able to DeDRM it. Maybe it is an unrelated issue?

matheusaraujotrd commented 3 years ago

For now I just tried the avoiding method and it worked.

ElleKayEm commented 3 years ago

It looks like KFX decryption still isn't working in 7.0.0b3. I'd suggested using one of the methods to avoid KFX for now.

I see. I also tried using 6.8. and wasn't able to DeDRM it. Maybe it is an unrelated issue?

I'd guess so. Because that should work as long as the KFX format book was downloaded with Kindle for PC 1.26 or earlier on the same machine and user as calibre 4.x with DeDRM 6.8.x.

cgaspar commented 3 years ago

I can confirm the same issue (with, I assume, a different book, and on the same computer that was previously working). Let me know if any additional debugging would be helpful.

ElleKayEm commented 3 years ago

The same issue as the OP where calibre 4 with DeDRM 6.8 no longer works on KFX after trying calibre 5 with DeDRM 7?

pdurrant commented 3 years ago

I suspect that if their calibre 4 installation stoped working after trying out 5.x, it's because they haven't reinstalled DeDRM 6.8.x.

(Certainly on Mac OS, calibre 4 and calibre 5 use the same folders for plugins, etc.)

ElleKayEm commented 3 years ago

Same on PC. The OP specifically says 6.8, but maybe that was before not after using 7.

cgaspar commented 3 years ago

The same issue as the OP where calibre 4 with DeDRM 6.8 no longer works on KFX after trying calibre 5 with DeDRM 7?

No, the Calibre 5 / DeDRM 7.0b3 DRM issue. I fell back to my Kindle 1.17 VM for now.

matheusaraujotrd commented 3 years ago

Same on PC. The OP specifically says 6.8, but maybe that was before not after using 7.

Yeah, just trying to clarify some data:

I tried using both DeDRM 6.8 and 7 with Calibre 5.x Didn't had any success DeDRMing KFX files, neither by using 6.8 nor 7, so I just bypassed the KFX files altogether by blocking Kindle's renderer.

That seems to be the best option for now.

ElleKayEm commented 3 years ago

KFX format can be decrypted with DeDRM 6.8 in calibre 4.23 as long as you're using Kindle for PC/Mac 1.26 or earlier and also have the KFX Input plugin installed. But the azw3/kf8 format is generally better for conversion or just archiving anyway.

cgaspar commented 3 years ago

7.0b4 resolved the issue for me.

ElleKayEm commented 3 years ago

@cgaspar Good to hear. Thanks for the report.

jabenza commented 3 years ago

It's not working for me in Calibre 5 with the lates't plugin (v7.0.0b4). I can decrypt the book in Calibre 4 without problem, but with 5 I get this:

C:\Users\User>calibre-debug -g calibre 5.1 [64bit] embedded-python: True is64bit: True Windows-10-10.0.18362-SP0 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.18362') Python 3.8.5 Windows: ('10', '10.0.18362', 'SP0', 'Multiprocessor Free') Interface language: en_GB Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 36, 0) && DeDRM (7, 0, 0) && Package KFX (from KFX Input) (1, 36, 0) && EpubMerge (2, 11, 0) && KFX metadata reader (from KFX Input) (1, 36, 0) && KFX Input (1, 36, 0) && Kindle Collections (1, 7, 29) Turning on automatic hidpi scaling devicePixelRatio: 1.0 logicalDpi: 96.0 x 96.0 physicalDpi: 94.14671814671814 x 94.07407407407408 Using calibre Qt style: True [0.00] Starting up... [0.02] Showing splash screen... [0.39] splash screen shown [0.39] Initializing db... [0.42] db initialized [0.42] Constructing main UI... EpubMerge: DEBUG: 2020-12-05 01:58:19,164: calibre_plugins.epubmerge.epubmerge_plugin(158): macmenuhack file_path:C:\Users\User\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt [1.05] main UI initialized... [1.05] Hiding splash screen Starting QuickView [1.27] splash screen hidden [1.27] Started up in 1.27 seconds with 570 books stdout+stderr from file dialog helper: [b'', b''] piped data from file dialog helper: [b'\xa7\xf24\x04\xfd\x13L\xe0\xeaq\xab\xed\xa5u\x18\xd5\xb9sb\x93%\x19\x0bu\x12\rC\xfeeoK\xa0', b'C:\Users\User\Downloads\default_key.k4i'] Gather KFX-ZIP (from KFX Input) 1.36.0: Importing C:/Users/User/Documents/My Kindle Content/B08BYWH6CS_EBOK/B08BYWH6CS_EBOK.azw Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\User\AppData\Local\Temp\calibre_gx9txiob\gev3clo0.kfx-zip DeDRM v7.0.0: Trying to decrypt gev3clo0.kfx-zip Using Library AlfCrypto DLL/DYLIB/SO Using Library AlfCrypto DLL/DYLIB/SO Decrypting KFX-ZIP ebook: gev3clo0 Got DSN key from database default_key Found 1 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.f878df2f-3574-458e-878a-7eba883371ce.voucher DeDRM v7.0.0: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.0.0: Looking for new default Kindle Key after 0.1 seconds searching for kinfoFiles in C:\Users\User\AppData\Local Found K4PC 1.25+ kinf2018 file: C:\Users\User\AppData\Local\Amazon\Kindle\storage.kinf2018 Found K4PC 1.9+ kinf2011 file: C:\Users\User\AppData\Local\Amazon\Kindle\storage.kinf2011 Decrypted key file using IDString '649252517' and UserName 'User' Decrypted key file using IDString '649252517' and UserName 'User' DeDRM v7.0.0: Found 2 new keys Decrypting KFX-ZIP ebook: gev3clo0 Got DSN key from database default_key_1 Got DSN key from database default_key_2 Found 1 keys to try after 2.7 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.f878df2f-3574-458e-878a-7eba883371ce.voucher DeDRM v7.0.0: Ultimately failed to decrypt after 2.7 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md

You can see that I add a key file since this was not working, so I tried adding the key from the Calibre 4 plugin, but no luck either.

jabenza commented 3 years ago

Just for the sake of it, I've updated to the latest version, deleted and re-installed the plugin, and tried to add the book, with the same error.

Origin is Kindle 1.24.3, and as I said, I can decrypt the same file in Calibre 4.

I've added the debug in a file.

Error_while_importing.txt