summaryrefslogtreecommitdiffstats
path: root/DeDRM_plugin/kfxdedrm.py
diff options
context:
space:
mode:
authorApprentice Harper <[email protected]>2021-04-11 15:28:33 +0100
committerApprentice Harper <[email protected]>2021-04-11 15:28:33 +0100
commit45a1a64db59911c133b48a1425eee2ad6e7a5f2b (patch)
treeca0c417f6912f9bdf07f255983fec3cf851cfcda /DeDRM_plugin/kfxdedrm.py
parentbc1c3c21978e86dca3d7f383211b83e29b8c9098 (diff)
Update version and FAQs
Version 7.2.0 with all the latest pull requests, including on for the latest KFX encryption.
Diffstat (limited to 'DeDRM_plugin/kfxdedrm.py')
-rw-r--r--DeDRM_plugin/kfxdedrm.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/DeDRM_plugin/kfxdedrm.py b/DeDRM_plugin/kfxdedrm.py
index 29dc60d..d6b0e1f 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 @@ class KFXZipBook:
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 @@ class KFXZipBook:
voucher.decryptvoucher()
break
except:
- pass
+ traceback.print_exc()
+ pass
else:
raise Exception("Failed to decrypt KFX DRM voucher with any key")