apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.46k stars 1.49k forks source link

plugin failing for adobe digital editions on linux #1025

Open dhdurgee opened 4 years ago

dhdurgee commented 4 years ago

As per recommendations I ran calibre with debug and captured the following:

QApplication: invalid style override 'gtk' passed, ignoring it. Available styles: Windows, Fusion devicePixelRatio: 1.0 logicalDpi: 96.0 x 96.0 physicalDpi: 100.861627907 x 100.55257732 Using calibre Qt style: True [0.00] Starting up... [0.00] Showing splash screen... [0.10] splash screen shown [0.11] Initializing db... [0.18] db initialized [0.18] Constructing main UI... Looking for desktop notifier support from: org.freedesktop.Notifications org.freedesktop.Notifications found in 0.0 seconds [1.32] main UI initialized... [1.32] Hiding splash screen [1.70] splash screen hidden [1.70] Started up in 1.70 seconds with 288 books ['zenity', '--modal', '--file-selection', '--title=Select books', '--separator=\n', '--attach=113246228', '--filename=/home/dhdurgee/Downloads/Windows/.fgdfg.gdfhjdhf*&^839', '--file-filter=Books | *.lrf *.rar *.zip *.rtf *.lit *.txt *.txtz *.text *.htm *.xhtm *.html *.htmlz *.xhtml *.pdf *.pdb *.updb *.pdr *.prc *.mobi *.azw *.doc *.epub *.fb2 *.fbz *.djv *.djvu *.lrx *.cbr *.cbz *.cbc *.oebzip *.rb *.imp *.odt *.chm *.tpz *.azw1 *.pml *.pmlz *.mbp *.tan *.snb *.xps *.oxps *.azw4 *.book *.zbf *.pobi *.docx *.docm *.md *.textile *.markdown *.ibook *.ibooks *.iba *.azw3 *.ps *.kepub *.kfx *.kpf', '--file-filter=EPUB books | *.epub *.kepub', '--file-filter=Kindle books | *.mobi *.prc *.azw *.azw3 *.kfx *.tpz *.azw1 *.azw4', '--file-filter=PDF books | *.pdf *.azw4', '--file-filter=HTML books | *.htm *.html *.xhtm *.xhtml', '--file-filter=LIT books | *.lit', '--file-filter=Text books | *.txt *.text *.rtf *.md *.markdown *.textile *.txtz', '--file-filter=Comics | *.cbz *.cbr *.cbc', '--file-filter=Archives | *.zip *.rar', '--file-filter=Wordprocessor files | *.odt *.doc *.docx', '--file-filter=All files | *', '--multiple'] DeDRM v6.7.0: Trying to decrypt Switch On Your Brain.epub DeDRM v6.7.0: Verifying zip archive integrity DeDRM v6.7.0: Switch On Your Brain.epub is a secure Adobe Adept ePub DeDRM v6.7.0: Trying Encryption key RTC

That is all that was captured. There was a pop-up error in calibre as follows:

calibre, version 4.12.0
ERROR: Cannot add books: Failed to add some books, click "Show details" for more information.

Worker process crashed while executing job
Traceback (most recent call last):
  File "site-packages/calibre/utils/ipc/pool.py", line 108, in recv
  File "site-packages/calibre/utils/ipc/__init__.py", line 23, in eintr_retry_call
EOFError

Let me know what else you may need to correct this.

ElleKayEm commented 4 years ago

Can you add the books to calibre with the DeDRM plugin disabled?

dhdurgee commented 4 years ago

Yes, with the plugin disabled the book is added. Of course as it is encrypted it is unusable so I deleted it immediately after adding it.

ElleKayEm commented 4 years ago

I'm afraid I don't know what the problem is. Are you able to decrypt other books or other types of books?

dhdurgee commented 4 years ago

I have in the past, both Kindle and Adobe.

Could I run this in a linux terminal window and get you more information about the problem? From the above log it appears the problem hits when the attempt to decrypt with the "RTC" key. If you give me the command to enter with arguments I will give it a shot.

Altenatively, are there any debug settings for the plugin itself that would yield more information?

ElleKayEm commented 4 years ago

Were Adobe books with the same setup? Same Adobe ID?

dhdurgee commented 4 years ago

Same Adobe ID. The book came from CloudLibrary where previous ones were fetched by Adobe Digital Editions via an acsm file from OverDrive. I confirmed it matched prior format as I was able to add the book to my Adobe Digital Editions library from the CloudLibrary file and open and read it there. So it is definitely encrypted with the same Adobe ID.

ElleKayEm commented 4 years ago

Since these tools are intended for purchased books, I'm bowing out here.

dhdurgee commented 4 years ago

The reason I need to use the tools is to be able to read the book on my Kindle. Thus I need to decrypt it to convert it to an azw file to load to the kindle. This book is only made available in epub, not kindle format, by the library. Thus my problem.

dhdurgee commented 4 years ago

DeDRM_plugin.zip Follow-up: I thought to try an older version of the plugin from 2017 to add the book with. That version worked. So I now have my book converted to read on my Kindle.

Is there any further information I can provide you to allow you to fix whatever I encountered with the current release?

PS: in case it helps I have attached the version that worked for me

ErroneousBosch commented 4 years ago

This is a book I purchased off Play Books.

I tried this and it does not detect the book as adobe adept, even though I confirmed that it is:

DeDRM v6.6.3: Trying to decrypt While_the_Black_Stars_Burn.epub DeDRM v6.6.3: Verifying zip archive integrity DeDRM v6.6.3: “While_the_Black_Stars_Burn.epub” is neither an Adobe Adept nor a Barnes & Noble encrypted ePub Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "site-packages/calibre/customize/ui.py", line 172, in _run_filetype_plugins File "calibre_plugins.dedrm.init", line 635, in run File "calibre_plugins.dedrm.init", line 411, in ePubDecrypt DeDRMError: DeDRM v6.6.3: Couldn't decrypt after 0.0 seconds. DRM free perhaps?

when I try to convert it to Mobi:

Convert book 1 of 1 (While the Black Stars Burn) Integration status: True Conversion options changed from defaults: read_metadata_from_opf: u'/tmp/calibre_4.12.0_tmp_Y3IJZt/kwpVGf.opf' verbose: 2 cover: u'/tmp/calibre_4.12.0_tmp_Y3IJZt/lXpPPC.jpeg' Resolved conversion options calibre version: 4.12.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': u'/tmp/calibre_4.12.0_tmp_Y3IJZt/lXpPPC.jpeg', 'debug_pipeline': None, 'dehyphenate': True, 'delete_blank_paragraphs': True, 'disable_font_rescaling': False, 'dont_compress': False, 'duplicate_links_in_toc': False, 'embed_all_fonts': False, 'embed_font_family': None, 'enable_heuristics': False, 'expand_css': False, 'extra_css': None, 'extract_to': None, 'filter_css': u'', 'fix_indents': True, 'font_size_mapping': None, 'format_scene_breaks': True, 'html_unwrap_factor': 0.4, 'input_encoding': None, 'input_profile': <calibre.customize.profiles.InputProfile object at 0x7f8cb2ae0350>, '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, 'mobi_file_type': u'old', 'mobi_ignore_margins': False, 'mobi_keep_original_images': False, 'mobi_toc_at_start': False, 'no_chapters_in_toc': False, 'no_inline_navbars': False, 'no_inline_toc': False, 'output_profile': <calibre.customize.profiles.OutputProfile object at 0x7f8cb2ae0710>, 'page_breaks_before': u'/', 'personal_doc': u'[PDOC]', 'prefer_author_sort': False, 'prefer_metadata_cover': False, 'pretty_print': False, 'pubdate': None, 'publisher': None, 'rating': None, 'read_metadata_from_opf': u'/tmp/calibre_4.12.0_tmp_Y3IJZt/kwpVGf.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, 'share_not_sync': False, '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} InputFormatPlugin: EPUB Input running on /tmp/calibre_4.12.0_tmp_Y3IJZt/YDBHwZ.epub Traceback (most recent call last): File "site.py", line 77, in main 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/epub_input.py", line 290, in convert DRMError: YDBHwZ.epub

When I open the epub as a zip, the META-INF/encryption.xml confirms adobe adept:

<encryption xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
  <EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#">
    <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
    <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
      <resource xmlns="http://ns.adobe.com/adept">urn:uuid:a2191ad8-0a09-ff25-2a2b-158b735b1921</resource>
    </KeyInfo>
    <CipherData>
      <CipherReference URI="cover.jpeg"/>
    </CipherData>
  </EncryptedData>

This is on Calibre Linux 4.12 with the latest version of the plugin (http://download.epubor.com/DeDRM_plugin.zip)

I'll try the old version linked above.

ErroneousBosch commented 4 years ago

Same results with the older plugin.

ElleKayEm commented 4 years ago

Looks like there isn't a rights.xml file inside the epub. How did you download the book?

(What's with the epubor link?? Latest release is 6.7.0.)

ErroneousBosch commented 4 years ago

I hadn't tried the version from the releases here. Just did (on Windows 10 this time), with the same result.

I downloaded the ACSM file from Play Books, and then downloaded the epub from the link in the XML (full path with all flags), after correcting &amp; -> &.

I don't see a rights.xml anywhere in the file.

ElleKayEm commented 4 years ago

If you open the .acsm file with Adobe Digital Editions, you will get an epub with rights.xml and be able to decrypt it.

ErroneousBosch commented 4 years ago

I see. Sadly no Linux only solution then. Ahh well.