From 60ee0dd47981cc00a48332f529923a536fc7adcd Mon Sep 17 00:00:00 2001 From: LugubriousProphecy <252222624+LugubriousProphecy@users.noreply.github.com> Date: Tue, 30 Dec 2025 17:40:42 -0600 Subject: [PATCH 1/3] modified PDFStream object to decrypt included dictionary --- DeDRM_plugin/ineptpdf.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/DeDRM_plugin/ineptpdf.py b/DeDRM_plugin/ineptpdf.py index 100dff7e..1eba5010 100755 --- a/DeDRM_plugin/ineptpdf.py +++ b/DeDRM_plugin/ineptpdf.py @@ -931,13 +931,15 @@ def __repr__(self): (self.objid, len(self.data), self.dic) def decode(self): - assert self.data is None and self.rawdata is not None + assert self.data is None and self.rawdata is not None and self.dic is not None data = self.rawdata if self.decipher: # Handle encryption data = self.decipher(self.objid, self.genno, data) + dic = decipher_all(self.decipher, self.objid, self.genno, self.dic) if gen_xref_stm: self.decdata = data # keep decrypted data + self.decdic = dic # keep decrypted dic if 'Filter' not in self.dic: self.data = data self.rawdata = None @@ -1008,7 +1010,15 @@ def get_decdata(self): # Handle encryption data = self.decipher(self.objid, self.genno, data) return data - + + def get_decdic(self): + if self.decdic is not None: + return self.decdic + dic = self.dic + if self.decipher and dic: + # Handle encryption + dic = decipher_all(self.decipher, self.objid, self.genno, dic) + return dic ## PDF Exceptions ## @@ -2304,6 +2314,7 @@ def serialize_object(self, obj): self.write(b'(deleted)') else: data = obj.get_decdata() + dic = obj.get_decdic() # Fix length: # We've decompressed and then recompressed the PDF stream. @@ -2314,11 +2325,11 @@ def serialize_object(self, obj): # Without this change, all PDFs exported by this plugin are slightly corrupted - # even though most if not all PDF readers can correct that on-the-fly. - if 'Length' in obj.dic: - obj.dic['Length'] = len(data) + if 'Length' in dic: + dic['Length'] = len(data) - self.serialize_object(obj.dic) + self.serialize_object(dic) self.write(b'stream\n') self.write(data) self.write(b'\nendstream') From e43ee8b966502847b5445275b00ffc5847b750ad Mon Sep 17 00:00:00 2001 From: LugubriousProphecy <252222624+LugubriousProphecy@users.noreply.github.com> Date: Tue, 30 Dec 2025 17:49:32 -0600 Subject: [PATCH 2/3] update version number --- DeDRM_plugin/ineptpdf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DeDRM_plugin/ineptpdf.py b/DeDRM_plugin/ineptpdf.py index 1eba5010..1b18619a 100755 --- a/DeDRM_plugin/ineptpdf.py +++ b/DeDRM_plugin/ineptpdf.py @@ -52,13 +52,14 @@ # 10.0.0 - Add support for "hardened" Adobe DRM (RMSDK >= 10) # 10.0.2 - Fix some Python2 stuff # 10.0.4 - Fix more Python2 stuff +# 10.0.5 - modified PDFStream object to decrypt included dictionary """ Decrypts Adobe ADEPT-encrypted PDF files. """ __license__ = 'GPL v3' -__version__ = "10.0.4" +__version__ = "10.0.5" import codecs import hashlib From 8b19d104f6b5e197a2a5928fd1e9a94b44e72a6b Mon Sep 17 00:00:00 2001 From: LugubriousProphecy <252222624+LugubriousProphecy@users.noreply.github.com> Date: Wed, 31 Dec 2025 19:20:49 -0600 Subject: [PATCH 3/3] fix missing variable definition --- DeDRM_plugin/ineptpdf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/DeDRM_plugin/ineptpdf.py b/DeDRM_plugin/ineptpdf.py index 1b18619a..67133a96 100755 --- a/DeDRM_plugin/ineptpdf.py +++ b/DeDRM_plugin/ineptpdf.py @@ -914,6 +914,7 @@ def __init__(self, dic, rawdata, decipher=None): self.decipher = decipher self.data = None self.decdata = None + self.decdic = None self.objid = None self.genno = None return