apprenticeharper / DeDRM_tools

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

DeDRM failing to remove DRM #2176

Open archz2 opened 1 year ago

archz2 commented 1 year ago

I have Calibre 6.9 and DeDRM 10.0.3. I am unable to remove DRM from an azw file that I downloaded from Amazon Kindle app installed on my laptop running Windows 10.

My Environment - Windows 10

Calibre: 6.9

Kindle: Version1.330 (62002) - This is the version of the Kindle app installed on my laptop

DeDRM: 10.0.3

Log

Log Title ```log Convert book 1 of 1 (Build, Don't Talk) DeDRM v10.0.3: Trying to decrypt lxqh5dq3.kfx-zip Using Library AlfCrypto DLL/DYLIB/SO Decrypting KFX-ZIP ebook: lxqh5dq3 Found 0 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.b2de78c5-10e0-445e-8339-d941e7be75c2.voucher Traceback (most recent call last): File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 102, in _assert Exception: Incorrect padding - Wrong key DeDRM v10.0.3: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v10.0.3: Looking for new default Kindle Key after 0.1 seconds searching for kinfoFiles in C:\Users\NITROFZ\AppData\Local Found K4PC 1.25+ kinf2018 file: C:\Users\NITROFZ\AppData\Local\Amazon\Kindle\storage\.kinf2018 Decrypted key file using IDString '877471082' and UserName 'NITROFZ' DeDRM v10.0.3: Found 1 new key Decrypting KFX-ZIP ebook: lxqh5dq3 Got DSN key from database key_0 Found 1 keys to try after 0.4 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.b2de78c5-10e0-445e-8339-d941e7be75c2.voucher Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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 "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 102, in _assert Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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 "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 102, in _assert Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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_plugins.dedrm.__init__", line 991, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, in decrypt_voucher Exception: Failed to decrypt KFX DRM voucher with any key DeDRM v10.0.3: Ultimately failed to decrypt after 0.4 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 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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 178, in _run_filetype_plugins File "calibre_plugins.dedrm.__init__", line 1056, in run File "calibre_plugins.dedrm.__init__", line 1007, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.4 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md Conversion options changed from defaults: read_metadata_from_opf: 'C:\\Users\\NITRO~1\\AppData\\Local\\Temp\\calibre_a0hd4krl\\l4b9r1g8.opf' verbose: 2 cover: 'C:\\Users\\NITRO~1\\AppData\\Local\\Temp\\calibre_a0hd4krl\\fl0xu8sj.jpeg' output_profile: 'generic_eink' Resolved conversion options calibre version: 6.9.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\\NITRO~1\\AppData\\Local\\Temp\\calibre_a0hd4krl\\fl0xu8sj.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\\NITRO~1\\AppData\\Local\\Temp\\calibre_a0hd4krl\\l4b9r1g8.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': '[]', 'transform_html_rules': '[]', 'unsmarten_punctuation': False, 'unwrap_lines': True, 'use_auto_toc': False, 'verbose': 2} DeDRM v10.0.3: Trying to decrypt lxqh5dq3.kfx-zip Decrypting KFX-ZIP ebook: lxqh5dq3 Found 0 keys to try after 0.0 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.b2de78c5-10e0-445e-8339-d941e7be75c2.voucher Traceback (most recent call last): File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 102, in _assert Exception: Incorrect padding - Wrong key DeDRM v10.0.3: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v10.0.3: Looking for new default Kindle Key after 0.0 seconds searching for kinfoFiles in C:\Users\NITROFZ\AppData\Local Found K4PC 1.25+ kinf2018 file: C:\Users\NITROFZ\AppData\Local\Amazon\Kindle\storage\.kinf2018 Decrypted key file using IDString '877471082' and UserName 'NITROFZ' DeDRM v10.0.3: Found 1 new key Decrypting KFX-ZIP ebook: lxqh5dq3 Got DSN key from database key_0 Found 1 keys to try after 0.2 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.b2de78c5-10e0-445e-8339-d941e7be75c2.voucher Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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 "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 102, in _assert Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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 "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 102, in _assert Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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_plugins.dedrm.__init__", line 991, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, in decrypt_voucher Exception: Failed to decrypt KFX DRM voucher with any key DeDRM v10.0.3: Ultimately failed to decrypt after 0.2 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 957, in KindleMobiDecrypt File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook File "C:\Users\NITROFZ\AppData\Roaming\calibre\plugins\DeDRM.zip\kfxdedrm.py", line 111, 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 178, in _run_filetype_plugins File "calibre_plugins.dedrm.__init__", line 1056, in run File "calibre_plugins.dedrm.__init__", line 1007, in KindleMobiDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.2 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md InputFormatPlugin: KFX Input running on C:\Users\NITRO~1\AppData\Local\Temp\calibre_a0hd4krl\lxqh5dq3.kfx-zip Software versions: KFX Input 1.50.0, calibre 6.9, Windows-10-10.0.19045-SP0 KFX Input plugin help is available at https://www.mobileread.com/forums/showthread.php?t=291290 Converting C:\Users\NITRO~1\AppData\Local\Temp\calibre_a0hd4krl\lxqh5dq3.kfx-zip Processing container: B0BLD6VK6B_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 210, in decode_book File "calibre_plugins.kfx_input.kfxlib.yj_book", line 317, in get_container calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B0BLD6VK6B_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 196, in _run_module_as_main File "runpy.py", line 86, in _run_code File "site.py", line 83, in File "site.py", line 78, in main File "site.py", line 50, in run_entry_point File "calibre\utils\ipc\worker.py", line 215, in main File "calibre\gui2\convert\gui_conversion.py", line 38, in gui_convert_override File "calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert File "calibre\ebooks\conversion\plumber.py", line 1108, in run File "calibre\customize\conversion.py", line 242, in __call__ File "calibre_plugins.kfx_input.__init__", line 125, in convert calibre.ebooks.DRMError: This book has DRM! ```
ElleKayEm commented 1 year ago

That's the newer KFX format which cannot be decrypted. See this post for disabling KFX downloads: https://www.mobileread.com/forums/showthread.php?t=283371

archz2 commented 1 year ago

Thanks , I used the KFX_begone4.bat mentioned in the post you shared (original link was this post https://www.mobileread.com/forums/showpost.php?p=4021279&postcount=966).

Then while trying to download the book, I got this error. error1

I am on Kindle 1.33 right now.

I am on Kindle app v. 1.33.62002 right now.

j-howell commented 1 year ago

There are some books that Amazon will only deliver to customers in KFX format using the latest DRM that has not yet been broken. These are mostly expensive textbooks and a few other categories that are more likely to be pirated. If your book is one of these then there is no DRM removal solution at this time.

If you share the ASIN (ten character identifier of the book on Amazon) it should be possible to determine if it is one of those.

archz2 commented 1 year ago

There's no ASIN available for this book. https://www.amazon.in/Build-Dont-Talk-Things-Taught/dp/0143459686/ref=sr_1_2?crid=2YHESJSIKXATN&keywords=build+dont+talk+raj+shamani&qid=1670692606&sprefix=build+dont+%2Caps%2C453&sr=8-2

It's a very affordable book. It seems as if Amazon has beefed up its security for all the newly released books.

j-howell commented 1 year ago

The ASIN B0BLD6VK6B. Many book published in India use the stronger DRM that cannot be removed. This is one of them.

archz2 commented 1 year ago

Okay, is there any alpha-numeric pattern you see in the ASIN that gave you the clue of unbreakable DRM?

ElleKayEm commented 1 year ago

On the page for that specific ASIN, it says:

On Android and Fire tablets, the latest version of the Kindle app is required. This title is not available on Kindle Cloud Reader.

j-howell commented 1 year ago

The web page for that book on Amazon.com (https://www.amazon.com/Build-Dont-Talk-Things-Taught-ebook/dp/B0BLD6VK6B) is even more explicit. It adds:

On PC & Mac, the latest version of the Kindle app is required. On E-readers, this title is available on select devices, and latest software update is required.

These are indications that the book is only available on apps and devices with unbroken DRM. That is common for books published in India, expensive textbooks, and a few other categories where the publisher has opted for only the strongest DRM.

archz2 commented 1 year ago

Thanks a ton @ElleKayEm and @j-howell . Really appreciate this insight! I bought an Indian book today that got published this month which costs thrice as much. I was able to remove its DRM successfully, thanks to the info shared by you!

archz2 commented 1 year ago

The web page for that book on Amazon.com (https://www.amazon.com/Build-Dont-Talk-Things-Taught-ebook/dp/B0BLD6VK6B) is even more explicit. It adds:

On PC & Mac, the latest version of the Kindle app is required. On E-readers, this title is available on select devices, and latest software update is required.

These are indications that the book is only available on apps and devices with unbroken DRM. That is common for books published in India, expensive textbooks, and a few other categories where the publisher has opted for only the strongest DRM.

The DRM cannot be removed even if the book is downloaded on a Kindle paper e-reader device, then transferred via USB to Calibre on a PC for DRM removal?

ElleKayEm commented 1 year ago

No, that will still have the latest unbroken KFX DRM.

archz2 commented 1 year ago

How old is this latest KFX DRM system? I'm thinking that it's a cat and mouse play that happens between the updates of this plugin and Amazon Kindle amping up its DRM security.

ElleKayEm commented 1 year ago

Very much so. The last two updates to DeDRM which addressed this stopped working within a day. So Amazon is watching. They mearly flip a switch and all subsequent downloads are undecryptable by DeDRM but their own software can already handle the change.

archz2 commented 1 year ago

Okay.