noDRM / DeDRM_tools

DeDRM tools for ebooks
7.25k stars 323 forks source link

Can't remove AZW DRM with DeDRM #331

Open rcmit opened 1 year ago

rcmit commented 1 year ago

Using DeDRM 10.0.3 with Calibre 6.1 on MacBook Air with M1 processor running MAC OS Venture 13.3.1. Have 3 different Kindle Oasis serial numbers configured because I wasn't certain if some symbols were "O" or zero. Downloaded several books to Mac. All received error that file contains DRM with I attempt to export to ePUB.

Using calibre Qt style: True calibre Debug log calibre 6.17 embedded-python: True macOS-13.3.1-arm64-arm-64bit Darwin ('64bit', '') ('Darwin', '22.4.0', 'Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:41 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8103') Python 3.10.1 OSX: ('13.3.1', ('', '', ''), 'arm64') Interface language: None Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 51, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 51, 0) && KFX metadata reader (from KFX Input) (1, 51, 0) && KFX Input (1, 51, 0) && Overdrive Link (2, 54, 0) calibre 6.17 embedded-python: True macOS-13.3.1-arm64-arm-64bit Darwin ('64bit', '') ('Darwin', '22.4.0', 'Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:41 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8103') Python 3.10.1 OSX: ('13.3.1', ('', '', ''), 'arm64') Interface language: None Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 51, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 51, 0) && KFX metadata reader (from KFX Input) (1, 51, 0) && KFX Input (1, 51, 0) && Overdrive Link (2, 54, 0) QPA platform: cocoa devicePixelRatio: 2.0 logicalDpi: 72.0 x 72.0 physicalDpi: 127.50000191485789 x 127.50000191485789 [0.00] Starting up... [0.05] Showing splash screen... [0.20] splash screen shown [0.20] Initializing db... [0.21] db initialized [0.21] Constructing main UI... [0.66] main UI initialized... [0.66] Hiding splash screen Starting QuickView 2023-05-10 10:09:26.781 calibre-debug[43123:6309246] +[CATransaction synchronize] called within transaction 2023-05-10 10:16:27.745 calibre-debug[43123:6309246] +[CATransaction synchronize] called within transaction Gather KFX-ZIP (from KFX Input) 1.51.0: Importing /Users/robertmitilieri/Documents/Kindle Books/My Kindle Content/B07VMZYK13_EBOK/B07VMZYK13_EBOK.azw Gather KFX-ZIP (from KFX Input): Gathered 12 file(s) as /var/folders/5x/25n_qt1x27s1dzdwfpmp832m0000gn/C/calibre_6.17.0_tmp_69fs9z4b/e3fxbxpm.kfx-zip DeDRM v10.0.3: Trying to decrypt e3fxbxpm.kfx-zip Using Library AlfCrypto Python Decrypting KFX-ZIP ebook: e3fxbxpm Found 3 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.81353e72-4071-46ad-9e46-864eeb8f2d3e.voucher Traceback (most recent call last): File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher voucher.decryptvoucher() File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher b = pkcs7unpad(b, 16) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 762, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher voucher.decryptvoucher() File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher b = pkcs7unpad(b, 16) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 762, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher voucher.decryptvoucher() File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher b = pkcs7unpad(b, 16) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 762, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher voucher.decryptvoucher() File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher b = pkcs7unpad(b, 16) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 762, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert raise Exception(msg) 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 Found k4Mac kinf2018 file: /Users/robertmitilieri/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018 trying username b'robertmitilieri' on file /Users/robertmitilieri/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018 trying IDString: b'4b6e240f7076' trying IDString: b'4b6e240f7071' trying IDString: b'93781972cc25' trying IDString: b'bd9b4ada7eb4' Decrypted key file using IDString 'bd9b4ada7eb4' and UserName 'robertmitilieri' DeDRM v10.0.3: Found 1 new key Decrypting KFX-ZIP ebook: e3fxbxpm Got DSN key from database key_0 Found 1 keys to try after 0.6 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.81353e72-4071-46ad-9e46-864eeb8f2d3e.voucher Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 957, in KindleMobiDecrypt book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 261, in GetDecryptedBook mb.processBook(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook self.decrypt_voucher(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") 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 "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher voucher.decryptvoucher() File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher b = pkcs7unpad(b, 16) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 762, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 957, in KindleMobiDecrypt book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 261, in GetDecryptedBook mb.processBook(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook self.decrypt_voucher(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") 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 "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher voucher.decryptvoucher() File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher b = pkcs7unpad(b, 16) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 763, in pkcs7unpad _assert(msg[-paddinglen:] == bchr(paddinglen) * paddinglen, "Incorrect padding - Wrong key") File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 957, in KindleMobiDecrypt book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 261, in GetDecryptedBook mb.processBook(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook self.decrypt_voucher(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") 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 book = k4mobidedrm.GetDecryptedBook(path_to_ebook,newkeys.items(),[],[],[],self.starttime) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 261, in GetDecryptedBook mb.processBook(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook self.decrypt_voucher(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") Exception: Failed to decrypt KFX DRM voucher with any key DeDRM v10.0.3: Ultimately failed to decrypt after 0.6 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 book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 261, in GetDecryptedBook mb.processBook(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook self.decrypt_voucher(totalpids) File "/Users/robertmitilieri/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") 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 187, in _run_filetype_plugins File "calibre_plugins.dedrm.init", line 1056, in run decrypted_ebook = self.KindleMobiDecrypt(path_to_ebook) File "calibre_plugins.dedrm.init", line 1007, in KindleMobiDecrypt raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.6 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md Package KFX (from KFX Input) 1.51.0: Packaging /var/folders/5x/25n_qt1x27s1dzdwfpmp832m0000gn/C/calibre_6.17.0_tmp_69fs9z4b/e3fxbxpm.kfx-zip Processing container: B07VMZYK13_EBOK.azw Running file type plugin Package KFX (from KFX Input) failed with traceback: Traceback (most recent call last): File "calibre/customize/ui.py", line 187, in _run_filetype_plugins File "calibre_plugins.kfx_input.package_filetype", line 21, in run return self.run_kfx(path_to_ebook) File "calibre_plugins.kfx_input.package_filetype", line 32, in run_kfx kfx_data = YJ_Book(path_to_ebook).convert_to_single_kfx() File "calibre_plugins.kfx_input.kfxlib.yj_book", line 83, in convert_to_single_kfx self.decode_book() File "calibre_plugins.kfx_input.kfxlib.yj_book", line 210, in decode_book container = self.get_container(datafile) File "calibre_plugins.kfx_input.kfxlib.yj_book", line 317, in get_container raise KFXDRMError("Book container %s has DRM and cannot be converted" % datafile.name) calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B07VMZYK13_EBOK.azw has DRM and cannot be converted KFX metadata reader (from KFX Input) activated for /var/folders/5x/25n_qt1x27s1dzdwfpmp832m0000gn/C/calibre_6.17.0_tmp_69fs9z4b/ew85e0wz_add_books/0/B07VMZYK13_EBOK.kfx-zip [19.90] splash screen hidden [19.90] Started up in 19.90 seconds with 23 books Added Putin's People to db in: 0.0 Added 1 books in 1.2 seconds

j-howell commented 1 year ago

You need to use the Download & Transfer function of Amazon's website targeting your e-ink Kindle device to download the book. The same book downloaded using the Kindle for Mac app has a different format with different DRM.

rcmit commented 1 year ago

Thanks for the super fast response! Robert

On May 10, 2023, at 10:44 AM, John Howell @.***> wrote:

You need to use the Download & Transfer function of Amazon's website targeting your e-ink Kindle device to download the book. The same book downloaded using the Kindle for Mac app has a different format with different DRM.

— Reply to this email directly, view it on GitHub https://github.com/noDRM/DeDRM_tools/issues/331#issuecomment-1542429559, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKCRYZ2JJ5NPRDPITNJRJ2LXFOZULANCNFSM6AAAAAAX446VLA. You are receiving this because you authored the thread.

ElleKayEm commented 1 year ago

Another tip: copy and paste your Kindle serial number from the website and you won't have to worry about 0/O or 8/B etc.

My1 commented 1 year ago

You need to use the Download & Transfer function of Amazon's website targeting your e-ink Kindle device to download the book. The same book downloaded using the Kindle for Mac app has a different format with different DRM.

so that means this thing cannot be used if you dont have a kindle in the first place but are software only so far?

ElleKayEm commented 1 year ago

No, you don't have to have a Kindle.

My1 commented 1 year ago

okay? then how to actually do it then? because I applied the plugin and the Kindle for windows azw download doesnt open and the replies above mention download & transfer or a kindle serial number, which seems to imply that a kindle is needed.

ElleKayEm commented 1 year ago

That was in response to someone who had a Kindle. See this post: https://www.mobileread.com/forums/showthread.php?t=283371