mirror of
https://github.com/apprenticeharper/DeDRM_tools
synced 2024-12-26 09:58:55 +01:00
Update ineptepub.py
Handle uncompressed elements (if any) in the zip file.
This commit is contained in:
parent
bf6170e613
commit
f6a568bcc1
1 changed files with 10 additions and 6 deletions
|
@ -353,12 +353,16 @@ class Decryptor(object):
|
||||||
|
|
||||||
def decompress(self, bytes):
|
def decompress(self, bytes):
|
||||||
dc = zlib.decompressobj(-15)
|
dc = zlib.decompressobj(-15)
|
||||||
bytes = dc.decompress(bytes)
|
try:
|
||||||
ex = dc.decompress(b'Z') + dc.flush()
|
decompressed_bytes = dc.decompress(bytes)
|
||||||
if ex:
|
ex = dc.decompress(b'Z') + dc.flush()
|
||||||
bytes = bytes + ex
|
if ex:
|
||||||
return bytes
|
decompressed_bytes = decompressed_bytes + ex
|
||||||
|
except:
|
||||||
|
# possibly not compressed by zip - just return bytes
|
||||||
|
return bytes
|
||||||
|
return decompressed_bytes
|
||||||
|
|
||||||
def decrypt(self, path, data):
|
def decrypt(self, path, data):
|
||||||
if path.encode('utf-8') in self._encrypted:
|
if path.encode('utf-8') in self._encrypted:
|
||||||
data = self._aes.decrypt(data)[16:]
|
data = self._aes.decrypt(data)[16:]
|
||||||
|
|
Loading…
Reference in a new issue