summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorApprentice Harper <[email protected]>2021-01-03 16:11:02 +0000
committerApprentice Harper <[email protected]>2021-01-03 16:11:02 +0000
commita7974f0f14c5c4558d519234106c194f80a96f16 (patch)
treee27c8d087698742a3593e3bed6616128c623b0eb
parented412bee35c9bac422957dc78c0255bc49d5553e (diff)
Update ineptpdf.py
integer division, and version
-rw-r--r--DeDRM_plugin/__init__.py3
-rwxr-xr-xDeDRM_plugin/ineptpdf.py8
2 files changed, 6 insertions, 5 deletions
diff --git a/DeDRM_plugin/__init__.py b/DeDRM_plugin/__init__.py
index 1e9c2e5..f4be36d 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.0.2'
+__version__ = '7.0.3'
__docformat__ = 'restructuredtext en'
@@ -73,6 +73,7 @@ __docformat__ = 'restructuredtext en'
# 7.0.0 - Switched to Python 3 for calibre 5.0. Thanks to all who contributed
# 7.0.1 - More Python 3 changes. Adobe PDF decryption should now work in some cases
# 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
"""
Decrypt DRMed ebooks.
diff --git a/DeDRM_plugin/ineptpdf.py b/DeDRM_plugin/ineptpdf.py
index f0ebbc8..17ccdcf 100755
--- a/DeDRM_plugin/ineptpdf.py
+++ b/DeDRM_plugin/ineptpdf.py
@@ -1482,7 +1482,7 @@ class PDFDocument(object):
# global static principal key for German Onleihe / Bibliothek Digital
principalkeys = { b'bibliothek-digital.de': codecs.decode(b'rRwGv2tbpKov1krvv7PO0ws9S436/lArPlfipz5Pqhw=','base64')}
self.is_printable = self.is_modifiable = self.is_extractable = True
- length = int_value(param.get('Length', 0)) / 8
+ length = int_value(param.get('Length', 0)) // 8
edcdata = str_value(param.get('EDCData')).decode('base64')
pdrllic = str_value(param.get('PDRLLic')).decode('base64')
pdrlpol = str_value(param.get('PDRLPol')).decode('base64')
@@ -1547,8 +1547,8 @@ class PDFDocument(object):
if 5 <= R:
# 8
for _ in range(50):
- hash = hashlib.md5(hash.digest()[:length/8])
- key = hash.digest()[:length/8]
+ hash = hashlib.md5(hash.digest()[:length//8])
+ key = hash.digest()[:length//8]
if R == 2:
# Algorithm 3.4
u1 = ARC4.new(key).decrypt(password)
@@ -1590,7 +1590,7 @@ class PDFDocument(object):
def initialize_ebx(self, password, docid, param):
self.is_printable = self.is_modifiable = self.is_extractable = True
rsa = RSA(password)
- length = int_value(param.get('Length', 0)) / 8
+ length = int_value(param.get('Length', 0)) // 8
rights = codecs.decode(param.get('ADEPT_LICENSE'), 'base64')
rights = zlib.decompress(rights, -15)
rights = etree.fromstring(rights)