diff --git a/DeDRM_plugin/__init__.py b/DeDRM_plugin/__init__.py index a8059a58..173db21b 100644 --- a/DeDRM_plugin/__init__.py +++ b/DeDRM_plugin/__init__.py @@ -5,7 +5,7 @@ # Copyright © 2008-2020 Apprentice Harper et al. __license__ = 'GPL v3' -__version__ = '7.1.0' +__version__ = '7.2.0' __docformat__ = 'restructuredtext en' @@ -75,6 +75,7 @@ # 7.0.2 - More Python 3 changes. Adobe PDF decryption should now work on PC too. # 7.0.3 - More Python 3 changes. Integer division in ineptpdf.py # 7.1.0 - Full release for calibre 5.x +# 7.2.0 - Update for latest KFX changes, and Python 3 Obok fixes. """ Decrypt DRMed ebooks. diff --git a/DeDRM_plugin/kfxdedrm.py b/DeDRM_plugin/kfxdedrm.py index 29dc60da..d6b0e1f1 100644 --- a/DeDRM_plugin/kfxdedrm.py +++ b/DeDRM_plugin/kfxdedrm.py @@ -4,10 +4,12 @@ # Engine to remove drm from Kindle KFX ebooks # 2.0 - Python 3 for calibre 5.0 +# 2.1 - Some fixes for debugging import os import shutil +import traceback import zipfile from io import BytesIO @@ -65,6 +67,9 @@ def decrypt_voucher(self, totalpids): print("Decrypting KFX DRM voucher: {0}".format(info.filename)) for pid in [''] + totalpids: + # Belt and braces. PIDs should be unicode strings, but just in case... + if isinstance(pid, bytes): + pid = pid.decode('ascii') for dsn_len,secret_len in [(0,0), (16,0), (16,40), (32,40), (40,0), (40,40)]: if len(pid) == dsn_len + secret_len: break # split pid into DSN and account secret @@ -77,7 +82,8 @@ def decrypt_voucher(self, totalpids): voucher.decryptvoucher() break except: - pass + traceback.print_exc() + pass else: raise Exception("Failed to decrypt KFX DRM voucher with any key") diff --git a/FAQs.md b/FAQs.md index 3ac1066c..09bf19cb 100644 --- a/FAQs.md +++ b/FAQs.md @@ -51,7 +51,9 @@ Mac Note: If the chmod command fails with a permission error try again using `su After restarting the Kindle program any books previously downloaded in KFX format will no longer open. You will need to remove them from your device and re-download them. All future downloads will use the older Kindle formats instead of KFX although they will continue to be placed in one individual subdirectory per book. Note that books soudl be downoad by right-click and 'Download', not by just opening the book. Recent (1.25+) versions of Kindle for Mac/PC may convert KF8 files to a new format that is not supported by these tools when the book is opened for reading. #### Decrypting KFX -Thanks to work by several people, the tools can now decrypt KFX format ebooks from Kindle for Mac/PC version 1.26 or earlier (version later than 1.26 use a new encryption scheme for KFX files). In addition to the DeDRM plugin, calibre users will also need to install jhowell's KFX Input plugin which is available through the standard plugin menu in calibre, or directly from [his plugin thread](https://www.mobileread.com/forums/showthread.php?t=291290) on Mobileread. +Thanks to work by several people, the tools can now decrypt KFX format ebooks from Kindle for Mac/PC. In addition to the DeDRM plugin, calibre users will also need to install jhowell's KFX Input plugin which is available through the standard plugin menu in calibre, or directly from [his plugin thread](https://www.mobileread.com/forums/showthread.php?t=291290) on Mobileread. + +It's quite possible that Amazon will update their KFX DeDRM to prevent DRM removal from KFX books again. So Remove DRM as soon as possible! #### Thanks Thanks to jhowell for his investigations into KFX format and the KFX Input plugin. Some of these instructions are from [his thread on the subject](https://www.mobileread.com/forums/showthread.php?t=283371) at MobileRead. diff --git a/Obok_plugin/__init__.py b/Obok_plugin/__init__.py index 62440a98..722c088b 100644 --- a/Obok_plugin/__init__.py +++ b/Obok_plugin/__init__.py @@ -3,7 +3,7 @@ print_function) __license__ = 'GPL v3' -__version__ = '7.1.0' +__version__ = '7.2.0' __docformat__ = 'restructuredtext en' ##################################################################### @@ -20,7 +20,7 @@ PLUGIN_NAME = 'Obok DeDRM' PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_') PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.') -PLUGIN_VERSION_TUPLE = (7, 1, 0) +PLUGIN_VERSION_TUPLE = (7, 2, 0) PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE]) HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm' PLUGIN_AUTHORS = 'Anon' diff --git a/README.md b/README.md index d568e962..5461e584 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,12 @@ The individual scripts are now released as two plugins for calibre: DeDRM and Ob The DeDRM plugin handles books that use Amazon DRM, Adobe Digital Editions DRM (version 1), Barnes & Noble DRM, and some historical formats. The Obok plugin handles Kobo DRM. -Users with calibre 5.x or later should use release 7.0.0b2 or later of the tools. -Users with calibe 4.x or earlier should use release 6.8.0 of the tools. - -Developers might be interested in forking the repository, as it contains unzipped versions of those tools that are zipped to make the changes over time easier to follow. +Users with calibre 5.x or later should use release 7.2.0 or later of the tools. +Users with calibe 4.x or earlier should use release 6.8.x of the tools. For the latest Amazon KFX format, users of the calibre plugin should also install the KFX Input plugin from the standard calibre plugin menu. It's also available from the MobileRead thread here: https://www.mobileread.com/forums/showthread.php?t=291290 -Note that DRM can only be removed from KFX format files downloaded with Kindle for PC/Mac 1.26 or earlier. Amazon changes the DRM for KFX files in Kindle for PC/Mac 1.27 and later. +Note that Amazon changes the DRM for KFX files frequently. What works for KFX today might not work tomorrow. I welcome contributions from others to improve these tools, from expanding the range of books handled, improving key retrieval, to just general bug fixes, speed improvements and UI enhancements. diff --git a/ReadMe_Overview.txt b/ReadMe_Overview.txt index 6738e4d3..ca5bca12 100644 --- a/ReadMe_Overview.txt +++ b/ReadMe_Overview.txt @@ -26,7 +26,7 @@ The tools are provided in the form of plugins for calibre. Calibre is an open so DeDRM plugin for calibre (Mac OS X, Windows) ------------------------------------------------------- -calibe 5.x and later are now written in Python 3, and plugins must also use Python 3. If you have calibre 5, you must use version 7.x or later of the plugins. For calibre 4.x and earlier, use version 6.8.0 of the plugins. +calibe 5.x and later are now written in Python 3, and plugins must also use Python 3. If you have calibre 5, you must use version 7.x or later of the plugins. For calibre 4.x and earlier, use version 6.8.x of the plugins. The DeDRM plugin for calibre removes DRM from your Kindle and Adobe DRM ebooks when they are imported to calibre. Just install the DeDRM plugin (DeDRM_plugin.zip), following the instructions and configuration directions provided in the ReadMe file and the help links in the plugin's configuration dialogs.