noDRM / DeDRM_tools

DeDRM tools for ebooks
7.37k stars 324 forks source link

Cant remove DRM #637

Closed zenki2023 closed 2 months ago

zenki2023 commented 2 months ago

Question / bug report

In the Kindle for PC software, I downloaded all the books, which by default are stored in the "My Kindle Content" folder under "My Documents". Later, I reinstalled the OS, but before doing so, I backed up the "My Kindle Content" folder from "My Documents". After reinstalling the OS, I copied the contents of "My Kindle Content" back to My Documents, but these previously downloaded books wouldn't open. When trying to open them, I was prompted to delete and re-download them. I tried using Calibre with the DeDRM plugin, and even after entering my Kindle's serial number in the plugin configuration, I still couldn't open these books. Here's the error message:

I would be incredibly grateful if you could take a look at this issue when you have the time.

Which version of Calibre are you running?

5.44

Which version of the DeDRM plugin are you running?

v10.0.9

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

No response

Log output

calibre 调试日志
calibre 5.44 [64bit]  embedded-python: True is64bit: True
Windows-10-10.0.22621 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22621')
Python 3.8.5
Windows: ('10', '10.0.22621', '', 'Multiprocessor Free')
Interface language: zh_CN
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 15, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 15, 0) && KFX metadata reader (from KFX Input) (2, 15, 0) && From KFX (2, 15, 0) && KFX Input (2, 15, 0)
calibre 5.44 [64bit]  embedded-python: True is64bit: True
Windows-10-10.0.22621 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22621')
Python 3.8.5
Windows: ('10', '10.0.22621', '', 'Multiprocessor Free')
Interface language: zh_CN
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 15, 0) && DeDRM (10, 0, 9) && Package KFX (from KFX Input) (2, 15, 0) && KFX metadata reader (from KFX Input) (2, 15, 0) && From KFX (2, 15, 0) && KFX Input (2, 15, 0)
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 157.8252427184466 x 157.65517241379308
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.45] splash screen shown
[0.45] Initializing db...
[0.45] db initialized
[0.45] Constructing main UI...
Using proxies: {'socks': '127.0.0.1:1080'}
[1.25] main UI initialized...
[1.25] Hiding splash screen
Starting QuickView
Using proxies: {'socks': '127.0.0.1:1080'}
Gather KFX-ZIP (from KFX Input) 2.15.0: Importing C:\Users\Zenki\Documents\My Kindle Content\B01F7IEMQC_EBOK\B01F7IEMQC_EBOK.azw
Gather KFX-ZIP (from KFX Input): File is not KFX format
DeDRM v10.0.9: Trying to decrypt B01F7IEMQC_EBOK.azw
[2.69] splash screen hidden
[2.69] Started up in 2.69 seconds with 0 books
stdout+stderr from file dialog helper: [b'', b'']
piped data from file dialog helper: [b'\xbb\xa0\x17z\x98\x05\x1b=FF\xc0\xbc=\x15{\xc2\x99A<J\xf7\xa2h\xf6\xd5k\xec\xba\x13\x80$\xa1', b'C:\\Users\\Zenki\\Documents\\My Kindle Content\\B01F7IEMQC_EBOK\\B01F7IEMQC_EBOK.azw']
MobiDeDrm v1.1.
Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al.
Decrypting Kindle Format 8 ebook: PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列)
Found 0 keys to try after 0.5 seconds
Crypto Type is: 2
DeDRM v10.0.9: Failed to decrypt with error: No key found in 0 PIDs tried.
DeDRM v10.0.9: Looking for new default Kindle Key after 0.5 seconds
searching for kinfoFiles in C:\Users\Zenki\AppData\Local
Found K4PC 1.25+ kinf2018 file: C:\Users\Zenki\AppData\Local\Amazon\Kindle\storage\.kinf2018
Decrypted key file using IDString '1392386471' and UserName 'Zenki'
DeDRM v10.0.9: Found 1 new key
MobiDeDrm v1.1.
Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al.
Decrypting Kindle Format 8 ebook: PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列)
Got DSN key from database key_0
Found 4 keys to try after 0.7 seconds
Crypto Type is: 2
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 931, in KindleMobiDecrypt
  File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
  File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
mobidedrm.DrmException: No key found in 0 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
  File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
  File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
mobidedrm.DrmException: No key found in 4 PIDs tried.
DeDRM v10.0.9: Ultimately failed to decrypt after 0.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
  File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
  File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
mobidedrm.DrmException: No key found in 0 PIDs tried.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre\customize\ui.py", line 175, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 1030, in run
  File "calibre_plugins.dedrm.__init__", line 981, in KindleMobiDecrypt
calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.9: Ultimately failed to decrypt after 0.7 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Added PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列) to db in: 0.1
Added 1 books in 1.5 seconds
Worker Launch took: 0.02 seconds
Job: 0 转换书籍 第 1 本,共 1 本 (PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列)) finished
转换书籍 第 1 本,共 1 本 (PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列))
    DeDRM v10.0.9: Trying to decrypt a36ciy70.azw
    MobiDeDrm v1.1.
    Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al.
    Decrypting Kindle Format 8 ebook: PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列)
    Found 0 keys to try after 0.5 seconds
    Crypto Type is: 2
    DeDRM v10.0.9: Failed to decrypt with error: No key found in 0 PIDs tried.
    DeDRM v10.0.9: Looking for new default Kindle Key after 0.5 seconds
    searching for kinfoFiles in C:\Users\Zenki\AppData\Local
    Found K4PC 1.25+ kinf2018 file: C:\Users\Zenki\AppData\Local\Amazon\Kindle\storage\.kinf2018
    Decrypted key file using IDString '1392386471' and UserName 'Zenki'
    DeDRM v10.0.9: Found 1 new key
    MobiDeDrm v1.1.
    Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al.
    Decrypting Kindle Format 8 ebook: PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列)
    Got DSN key from database key_0
    Found 4 keys to try after 0.7 seconds
    Crypto Type is: 2
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.__init__", line 931, in KindleMobiDecrypt
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
    mobidedrm.DrmException: No key found in 0 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
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
    mobidedrm.DrmException: No key found in 4 PIDs tried.
    DeDRM v10.0.9: Ultimately failed to decrypt after 0.7 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
    Conversion options changed from defaults:
      output_profile: 'generic_eink'
      verbose: 2
      cover: 'C:\\Users\\Zenki\\AppData\\Local\\Temp\\calibre_pn7ivyni\\1_ldeawy.jpeg'
      read_metadata_from_opf: 'C:\\Users\\Zenki\\AppData\\Local\\Temp\\calibre_pn7ivyni\\4yv6hs_r.opf'
    Resolved conversion options
    calibre version: 5.44.0
    {'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\\Zenki\\AppData\\Local\\Temp\\calibre_pn7ivyni\\1_ldeawy.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': <calibre.customize.profiles.InputProfile object at 0x000002849EBC5F40>,
     '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': <calibre.customize.profiles.GenericEink object at 0x000002849EBCD8B0>,
     'page_breaks_before': "//*[name()='h1' or name()='h2']",
     'prefer_metadata_cover': False,
     'preserve_cover_aspect_ratio': False,
     'pretty_print': True,
     'pubdate': None,
     'publisher': None,
     'rating': None,
     'read_metadata_from_opf': 'C:\\Users\\Zenki\\AppData\\Local\\Temp\\calibre_pn7ivyni\\4yv6hs_r.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}
    Running file type plugin DeDRM failed with traceback:
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.__init__", line 931, in KindleMobiDecrypt
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
    mobidedrm.DrmException: No key found in 0 PIDs tried.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "calibre\customize\ui.py", line 175, in _run_filetype_plugins
      File "calibre_plugins.dedrm.__init__", line 1030, in run
      File "calibre_plugins.dedrm.__init__", line 981, in KindleMobiDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.9: Ultimately failed to decrypt after 0.7 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
    DeDRM v10.0.9: Trying to decrypt a36ciy70.azw
    MobiDeDrm v1.1.
    Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al.
    Decrypting Kindle Format 8 ebook: PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列)
    Found 0 keys to try after 0.0 seconds
    Crypto Type is: 2
    DeDRM v10.0.9: Failed to decrypt with error: No key found in 0 PIDs tried.
    DeDRM v10.0.9: Looking for new default Kindle Key after 0.0 seconds
    searching for kinfoFiles in C:\Users\Zenki\AppData\Local
    Found K4PC 1.25+ kinf2018 file: C:\Users\Zenki\AppData\Local\Amazon\Kindle\storage\.kinf2018
    Decrypted key file using IDString '1392386471' and UserName 'Zenki'
    DeDRM v10.0.9: Found 1 new key
    MobiDeDrm v1.1.
    Copyright © 2008-2022 The Dark Reverser, Apprentice Harper et al.
    Decrypting Kindle Format 8 ebook: PHP基础教程(第4版) (图灵程序设计丛书·Web开发系列)
    Got DSN key from database key_0
    Found 4 keys to try after 0.2 seconds
    Crypto Type is: 2
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.__init__", line 931, in KindleMobiDecrypt
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
    mobidedrm.DrmException: No key found in 0 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
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
    mobidedrm.DrmException: No key found in 4 PIDs tried.
    DeDRM v10.0.9: 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 931, in KindleMobiDecrypt
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\k4mobidedrm.py", line 203, in GetDecryptedBook
      File "C:\Users\Zenki\AppData\Roaming\calibre\plugins\DeDRM.zip\mobidedrm.py", line 401, in processBook
    mobidedrm.DrmException: No key found in 0 PIDs tried.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "calibre\customize\ui.py", line 175, in _run_filetype_plugins
      File "calibre_plugins.dedrm.__init__", line 1030, in run
      File "calibre_plugins.dedrm.__init__", line 981, in KindleMobiDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.9: 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: MOBI Input running
    on C:\Users\Zenki\AppData\Local\Temp\calibre_pn7ivyni\a36ciy70.azw
    Found KF8 MOBI of type 'standalone'
    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 <module>
      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 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\ebooks\conversion\plugins\mobi_input.py", line 44, in convert
      File "calibre\ebooks\mobi\reader\mobi8.py", line 85, in __call__
      File "calibre\ebooks\mobi\reader\mobi6.py", line 162, in check_for_drm
    calibre.ebooks.DRMError: PHP基础教程(第4版) (图灵程序 
计丛书·Web开发系列)
ElleKayEm commented 2 months ago

If the books were downloaded with a different installation of Kindle for PC than the one which is currently installed, then DeDRM will not have access to the key needed to unlock them.

Update to the current calibre. Update to DeDRM 10.0.9. Install the KFX Input plugin. Download your books with Kindle for PC 2.4.0 (70904) aka 2.4.70904. Be sure to block updates to Kindle for PC. See method 2 in this post: https://www.mobileread.com/forums/showthread.php?t=361503

zenki2023 commented 2 months ago

If the books were downloaded with a different installation of Kindle for PC than the one which is currently installed, then DeDRM will not have access to the key needed to unlock them.

Update to the current calibre. Update to DeDRM 10.0.9. Install the KFX Input plugin. Download your books with Kindle for PC 2.4.0 (70904) aka 2.4.70904. Be sure to block updates to Kindle for PC. See method 2 in this post: https://www.mobileread.com/forums/showthread.php?t=361503

Thank you so much for your response. I finally understand the root of the problem.

Unfortunately, Kindle has already exited the Chinese market, so I can no longer download these books. Thank you again for your explanation. I hope you have a great day.