apprenticeharper / DeDRM_tools

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

Adobe Digital Editions DeDRM PDF decryption doesn't work on 7.0.0b4 #1401

Open jefro108 opened 3 years ago

jefro108 commented 3 years ago

Adobe Digital Editions v 2.0.1.78765 Calibre 5.6.0 MacOS 10.14.6

Error message opening in Calibre e-book viewer:

calibre, version 5.6.0
ERROR: Loading book failed: Failed to open the book at /Users/jefro/Calibre Library/Unknown/Test (1107)/Test - Unknown.pdf. Click "Show details" for more info.

Failed to convert book: /Users/jefro/Calibre Library/Unknown/Test (1107)/Test - Unknown.pdf with error:
DeDRM v7.0.0: Trying to decrypt Test - Unknown.pdf
DeDRM v7.0.0: Test - Unknown.pdf is a PDF ebook
DeDRM v7.0.0: Trying Encryption key default_key_1
DeDRM v7.0.0: Exception when decrypting after 0.1 seconds
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 430, in PDFDecrypt
    result = ineptpdf.decryptBook(userkey, path_to_ebook, of.name)
  File "calibre_plugins.dedrm.ineptpdf", line 2175, in decryptBook
    serializer = PDFSerializer(inf, userkey)
  File "calibre_plugins.dedrm.ineptpdf", line 1980, in __init__
    parser = PDFParser(doc, inf)
  File "calibre_plugins.dedrm.ineptpdf", line 1788, in __init__
    self.doc.set_parser(self)
  File "calibre_plugins.dedrm.ineptpdf", line 1413, in set_parser
    self.xrefs = parser.read_xref()
  File "calibre_plugins.dedrm.ineptpdf", line 1914, in read_xref
    pos = self.find_xref()
  File "calibre_plugins.dedrm.ineptpdf", line 1865, in find_xref
    for line in self.revreadlines():
  File "calibre_plugins.dedrm.ineptpdf", line 851, in revreadlines
    n = max(s.rfind('\r'), s.rfind('\n'))
TypeError: argument should be integer or bytes-like object, not 'str'
DeDRM v7.0.0: Failed to decrypt with key default_key_1 after 0.1 seconds
DeDRM v7.0.0: Looking for new default Adobe Digital Editions Keys after 0.1 seconds
DeDRM v7.0.0: Trying a new default key
DeDRM v7.0.0: Exception when decrypting after 0.1 seconds
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 481, in PDFDecrypt
    result = ineptpdf.decryptBook(userkey, path_to_ebook, of.name)
  File "calibre_plugins.dedrm.ineptpdf", line 2175, in decryptBook
    serializer = PDFSerializer(inf, userkey)
  File "calibre_plugins.dedrm.ineptpdf", line 1980, in __init__
    parser = PDFParser(doc, inf)
  File "calibre_plugins.dedrm.ineptpdf", line 1788, in __init__
    self.doc.set_parser(self)
  File "calibre_plugins.dedrm.ineptpdf", line 1413, in set_parser
    self.xrefs = parser.read_xref()
  File "calibre_plugins.dedrm.ineptpdf", line 1914, in read_xref
    pos = self.find_xref()
  File "calibre_plugins.dedrm.ineptpdf", line 1865, in find_xref
    for line in self.revreadlines():
  File "calibre_plugins.dedrm.ineptpdf", line 851, in revreadlines
    n = max(s.rfind('\r'), s.rfind('\n'))
TypeError: argument should be integer or bytes-like object, not 'str'
DeDRM v7.0.0: Failed to decrypt with new default key after 0.1 seconds
DeDRM v7.0.0: 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
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler
pdfinfo errored out with return code: 1
InputFormatPlugin: PDF Input running
on /Users/jefro/Calibre Library/Unknown/Test (1107)/Test - Unknown.pdf
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 428, in get_file_type_metadata
  File "calibre/customize/builtins.py", line 342, in get_metadata
  File "calibre/ebooks/metadata/pdf.py", line 126, in get_metadata
ValueError: Could not read info dict from PDF
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 172, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 634, in run
    decrypted_ebook = self.PDFDecrypt(path_to_ebook)
  File "calibre_plugins.dedrm.__init__", line 509, in PDFDecrypt
    raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))
calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.0: 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
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 39, in <module>
  File "site.py", line 35, in main
  File "calibre/utils/ipc/worker.py", line 195, in main
  File "<string>", line 1, in <module>
  File "calibre/srv/render_book.py", line 865, in viewer_main
  File "calibre/srv/render_book.py", line 856, in render_for_viewer
  File "calibre/srv/render_book.py", line 833, in render
  File "calibre/ebooks/oeb/iterator/book.py", line 63, in extract_book
  File "calibre/customize/conversion.py", line 245, in __call__
  File "calibre/ebooks/conversion/plugins/pdf_input.py", line 54, in convert
  File "calibre/ebooks/pdf/pdftohtml.py", line 83, in pdftohtml
calibre.ebooks.ConversionError: pdftohtml failed with return code: 1
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler
Torgalide commented 3 years ago

Same for me.

Adobe Digital Editions v 4.5.11.187303 Calibre, version 5.6.0 Windows 10

ERREUR : Le chargement du livre a échoué: Impossible d'ouvrir le livre à la position C:\Users\Moi\Bibliothèque calibre\5e ed\Cybersecurite (2)\Cybersecurite - 5e ed.pdf. Cliquez sur "Afficher les détails" pour plus d'informations.

Failed to convert book: C:\Users\Moi\Bibliothèque calibre\5e ed\Cybersecurite (2)\Cybersecurite - 5e ed.pdf with error: DeDRM v7.0.0: Trying to decrypt Cybersecurite - 5e ed.pdf DeDRM v7.0.0: Cybersecurite - 5e ed.pdf is a PDF ebook DeDRM v7.0.0: Looking for new default Adobe Digital Editions Keys after 0.1 seconds Found 1 keys DeDRM v7.0.0: Trying a new default key DeDRM v7.0.0: Exception when decrypting after 0.1 seconds Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 481, in PDFDecrypt File "calibre_plugins.dedrm.ineptpdf", line 2175, in decryptBook File "calibre_plugins.dedrm.ineptpdf", line 1980, in init File "calibre_plugins.dedrm.ineptpdf", line 1788, in init File "calibre_plugins.dedrm.ineptpdf", line 1413, in set_parser File "calibre_plugins.dedrm.ineptpdf", line 1914, in read_xref File "calibre_plugins.dedrm.ineptpdf", line 1865, in find_xref File "calibre_plugins.dedrm.ineptpdf", line 851, in revreadlines TypeError: argument should be integer or bytes-like object, not 'str' DeDRM v7.0.0: Failed to decrypt with new default key after 0.1 seconds DeDRM v7.0.0: 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 Syntax Error: Couldn't find the 'EBX_HANDLER' security handler

pdfinfo errored out with return code: 1 InputFormatPlugin: PDF Input running on C:\Users\Moi\Bibliothèque calibre\5e ed\Cybersecurite (2)\Cybersecurite - 5e ed.pdf Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main() Traceback (most recent call last): File "calibre\customize\ui.py", line 428, in get_file_type_metadata File "calibre\customize\builtins.py", line 342, in get_metadata File "calibre\ebooks\metadata\pdf.py", line 126, in get_metadata ValueError: Could not read info dict from PDF Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre\customize\ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.dedrm.init", line 634, in run File "calibre_plugins.dedrm.init", line 509, in PDFDecrypt calibre_plugins.dedrm.DeDRMError: DeDRM v7.0.0: 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 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 195, in main File "", line 1, in File "calibre\srv\render_book.py", line 865, in viewer_main File "calibre\srv\render_book.py", line 856, in render_for_viewer File "calibre\srv\render_book.py", line 833, in render File "calibre\ebooks\oeb\iterator\book.py", line 63, in extract_book File "calibre\customize\conversion.py", line 245, in call File "calibre\ebooks\conversion\plugins\pdf_input.py", line 54, in convert File "calibre\ebooks\pdf\pdftohtml.py", line 83, in pdftohtml calibre.ebooks.ConversionError: pdftohtml failed with return code: 1 Syntax Error: Couldn't find the 'EBX_HANDLER' security handler Exception ignored in: <function NativeFunction.del at 0x000001A03249FF70> Traceback (most recent call last): File "calibre_plugins.dedrm.adobekey", line 266, in del TypeError: 'NoneType' object is not callable Exception ignored in: <function NativeFunction.del at 0x000001A03249FF70> Traceback (most recent call last): File "calibre_plugins.dedrm.adobekey", line 266, in del TypeError: 'NoneType' object is not callable

ElleKayEm commented 3 years ago

Yes, it looks like Adobe DRM PDF decryption still needs work in DeDRM 7. You can either use DeDRM 6.8 with calibre 4.23 or wait and try the next DeDRM release.

@Torgalide Be aware that it is possible to get hardened DRM which cannot currently be removed on ADE 3 and higher.

Torgalide commented 3 years ago

Work with DeDRM 6.8, calibre 4.23 and ADE 2.0

filippocastelli commented 3 years ago

Confirm Adobe DRM PDF decript working on DeDRM 6.8 while not in 7.0.0b4

Jonima42 commented 3 years ago

Yes, it looks like Adobe DRM PDF decryption still needs work in DeDRM 7. You can either use DeDRM 6.8 with calibre 4.23 or wait and try the next DeDRM release.

@Torgalide Be aware that it is possible to get hardened DRM which cannot currently be removed on ADE 3 and higher.

I hace this issue, any help? calibre, version 4.23.0 (win32, embedded-python: True) Error de conversión: Fallo: Convertido el libro 1 de 1 (A dame to kill for a tale from Sin City)

Convertido el libro 1 de 1 (A dame to kill for a tale from Sin City) C:\Program Files\Calibre2\app\pylib.zip\dateutil\parser_parser.py:1177: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal Conversion options changed from defaults: output_profile: u'generic_eink' verbose: 2 prefer_metadata_cover: True read_metadata_from_opf: u'C:\Users\IRIBAR~1.STJ\AppData\Local\Temp\calibre_mlpz1h\nl8atw.opf' Resolved conversion options calibre version: 4.23.0 {'asciiize': False, 'author_sort': None, 'authors': None, 'base_font_size': 0.0, 'book_producer': None, 'change_justification': u'original', 'chapter': u"//[((name()='h1' or name()='h2') and re:test(., '\s((chapter|book|section|part)\s+)|((prolog|prologue|epilogue)(\s+|$))', 'i')) or @class = 'chapter']", 'chapter_mark': u'pagebreak', 'comments': None, 'cover': None, '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': u'2', 'expand_css': False, 'extra_css': None, 'extract_to': None, 'filter_css': u'', '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 0x00000280F6E0C208>, '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, 'new_pdf_engine': False, 'no_chapters_in_toc': False, 'no_default_epub_cover': False, 'no_images': False, 'no_inline_navbars': False, 'no_svg_cover': False, 'output_profile': <calibre.customize.profiles.GenericEink object at 0x00000280F6E18508>, 'page_breaks_before': u"//*[name()='h1' or name()='h2']", 'prefer_metadata_cover': True, 'preserve_cover_aspect_ratio': False, 'pretty_print': True, 'pubdate': None, 'publisher': None, 'rating': None, 'read_metadata_from_opf': u'C:\Users\IRIBAR~1.STJ\AppData\Local\Temp\calibre_mlpz1h\nl8atw.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': u'', '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_factor': 0.45, 'unwrap_lines': True, 'use_auto_toc': False, 'verbose': 2} InputFormatPlugin: PDF Input running on C:\Users\IRIBAR~1.STJ\AppData\Local\Temp\calibre_mlpz1h\fkdjhi.pdf Converting file to html... Python function terminated unexpectedly pdftohtml failed with return code: 1 Syntax Error: Couldn't find the 'EBX_HANDLER' security handler (Error Code: 1) Traceback (most recent call last): File "site.py", line 114, in main File "site.py", line 88, in run_entry_point File "site-packages\calibre\utils\ipc\worker.py", line 209, in main File "site-packages\calibre\gui2\convert\gui_conversion.py", line 43, in gui_convert_override File "site-packages\calibre\gui2\convert\gui_conversion.py", line 28, in gui_convert File "site-packages\calibre\ebooks\conversion\plumber.py", line 1110, in run File "site-packages\calibre\customize\conversion.py", line 246, in call File "site-packages\calibre\ebooks\conversion\plugins\pdf_input.py", line 54, in convert File "site-packages\calibre\ebooks\pdf\pdftohtml.py", line 90, in pdftohtml calibre.ebooks.ConversionError: pdftohtml failed with return code: 1 Syntax Error: Couldn't find the 'EBX_HANDLER' security handler

ElleKayEm commented 3 years ago

@Jonima42 Can't tell anything from this log. Do you have Adobe Digital Editions 2.0.1 authorized with your Adobe ID and installed on the same machine and user as calibre with DeDRM? Let's see an import log: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md#i-cannot-solve-my-problem-with-the-dedrm-plugin-and-now-i-need-to-post-a-log-how-do-i-do-that

onedeeper commented 3 years ago

Yes, it looks like Adobe DRM PDF decryption still needs work in DeDRM 7. You can either use DeDRM 6.8 with calibre 4.23 or wait and try the next DeDRM release.

@Torgalide Be aware that it is possible to get hardened DRM which cannot currently be removed on ADE 3 and higher.

This worked for me for Adobe files