Compare commits

...

39 Commits

Author SHA1 Message Date
Apprentice Harper
45a1a64db5 Update version and FAQs
Version 7.2.0 with all the latest pull requests, including on for the latest KFX encryption.
2021-04-11 15:28:33 +01:00
Apprentice Harper
bc1c3c2197 Merge pull request #1490 from llrosy798/patch-1
update voucher envelope obfuscation table
2021-04-11 15:14:08 +01:00
Apprentice Harper
79cfddfbee Merge pull request #1650 from romanbsd/bugfix
Python 3.x fix
2021-04-11 15:10:32 +01:00
Apprentice Harper
aa41bba68c Merge pull request #1615 from ableeker/python3
Python 3 fix
2021-04-11 15:09:39 +01:00
Apprentice Harper
86a90117e5 Merge pull request #1586 from raiden64/master
Fix in keyfetch for obok on MacOS
2021-04-11 15:07:17 +01:00
Apprentice Harper
874a6b8de9 Merge pull request #1575 from journeyman88/master
Fix in keyfetch for obok on win10
2021-04-11 14:05:09 +01:00
Apprentice Harper
01c654cb68 Merge pull request #1560 from Threak/master
Try new openssl library name
2021-04-11 14:04:04 +01:00
Apprentice Harper
5bc28623cb Merge pull request #1546 from mkb79/master
Enhance parsing DrmIon files
2021-04-11 14:00:21 +01:00
Apprentice Harper
c1d7fcbb7f Merge pull request #1545 from lejando/patch-1
Update FAQs.md. Thanks, lejando.
2021-04-11 13:57:29 +01:00
Apprentice Harper
45eefd6c80 Merge pull request #1539 from josdion/master
Preserve filename encoding flag when fixing epub archive
2021-04-11 13:56:19 +01:00
Roman Shterenzon
33e37eb375 Python 3.x fix 2021-04-08 16:46:14 +03:00
Aldo Bleeker
4229b8ff85 Another Python 3 fix 2021-04-05 17:06:24 +02:00
Aldo Bleeker
91e4645315 Another Python 3 fix 2021-04-05 12:16:02 +02:00
Aldo Bleeker
425d8af73e Python 3 fix 2021-03-22 19:24:34 +01:00
raiden64
0ce86fa8db Fix in keyfetch for obok on MacOS 2021-03-05 22:54:53 +01:00
journeyman88
ecc7db09a9 Fix in keyfetch for obok on win10
According to calibre debug the ipconfig command returned some invalid utf-8 characters (I think is maybe an issue due to the Python2 switch-off as the 4.x version worked fine).
To solve this I've changed the external call and modified the regex to match both the output of "ipconfig" and that of "wmic".
2021-03-01 21:15:20 +01:00
Threak
d7ddc2ab93 Try new openssl library name 2021-02-26 18:50:10 +01:00
mkb79
fd51422a36 Enhance parsing DrmIon files
Adding support for parsing plaintext in DrmIon files.

This is needed by my kindle project. When downloading an ebook with my package it gives me a metadata file wich is DrmIon encoded. This file containes plaintext instead of encrypted pages.
2021-02-22 14:16:15 +01:00
lejando
cb36ca1b0d Update FAQs.md
Removed space from Mac and Win and period from Mac SHA-256 Hashes, which prevent automatic comparison.
2021-02-22 08:51:00 +01:00
Apprentice Harper
76a47e0dd0 Version number update
Update to 7.1.0 for a full release
2021-02-21 14:35:49 +00:00
Apprentice Harper
70a754fb46 Merge pull request #1529 from ableeker/python3
Fix for Python 3
2021-02-21 14:19:59 +00:00
josdion
ffd79d5fe4 Preserve filename encoding flag when fixing epub archive 2021-02-18 12:38:19 +02:00
Aldo Bleeker
21a7b13524 Fix for Python 3 2021-02-14 12:50:55 +01:00
Apprentice Harper
52bdbe95c9 Merge pull request #1522 from lkcv/patch-1
Add detection for Kobo directory location on Linux
2021-02-14 08:56:58 +00:00
Apprentice Harper
495dda3809 Merge pull request #1502 from ableeker/python3
Fix for broken book keys
2021-02-14 08:55:56 +00:00
Apprentice Harper
52e83922c0 Merge pull request #1499 from xxyzz/kfx
encode serialnum before returning it, close #1479
2021-02-14 08:50:26 +00:00
lkcv
6cbc5285cb Update obok.py 2021-02-07 21:21:03 -05:00
Aldo Bleeker
33b9630ca5 Fix for broken book keys 2021-01-28 13:06:59 +01:00
xxyzz
9346f86f73 encode serialnum before returning it, close #1479 2021-01-27 14:31:05 +08:00
Apprentice Harper
8d2d6627cf Merge pull request #1482 from 2weak2live/master
Fix python3 encoding problem in voucher decryption
2021-01-23 14:32:43 +00:00
Apprentice Harper
6f198b247c Merge pull request #1481 from icaroscherma/patch-1
[Tetrachroma FileOpen] Fixes Python 2.7 import issue, not linked to pywin
2021-01-23 14:30:21 +00:00
Apprentice Harper
9fb95eff41 Merge pull request #1491 from jony0008/master
Update sv
2021-01-23 14:29:56 +00:00
llrosy798
0b2b81fd23 fix previous bug 2021-01-21 23:48:04 +09:00
llrosy798
63aecc598f update secret table 2021-01-21 23:46:03 +09:00
llrosy798
51c8be6baf fill unknown symbols in known catalog 2021-01-21 23:41:22 +09:00
Jony
7aab8a3711 Update sv 2021-01-20 12:01:00 +01:00
2Weak2Live
2789cee331 Fix python3 encoding problem in voucher decryption 2021-01-13 22:44:11 -05:00
Ícaro R. Scherma
823704cf36 Fixes Python 2.7 import issue, not linked to pywin 2021-01-13 16:44:16 -08:00
Apprentice Harper
a7974f0f14 Update ineptpdf.py
integer division, and version
2021-01-03 16:11:02 +00:00
18 changed files with 182 additions and 88 deletions

View File

@@ -5,7 +5,7 @@
# Copyright © 2008-2020 Apprentice Harper et al. # Copyright © 2008-2020 Apprentice Harper et al.
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = '7.0.2' __version__ = '7.2.0'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
@@ -73,6 +73,9 @@ __docformat__ = 'restructuredtext en'
# 7.0.0 - Switched to Python 3 for calibre 5.0. Thanks to all who contributed # 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.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.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
# 7.1.0 - Full release for calibre 5.x
# 7.2.0 - Update for latest KFX changes, and Python 3 Obok fixes.
""" """
Decrypt DRMed ebooks. Decrypt DRMed ebooks.

View File

@@ -115,6 +115,8 @@ if iswindows:
def _load_crypto_libcrypto(): def _load_crypto_libcrypto():
from ctypes.util import find_library from ctypes.util import find_library
libcrypto = find_library('libcrypto-1_1')
if libcrypto is None:
libcrypto = find_library('libeay32') libcrypto = find_library('libeay32')
if libcrypto is None: if libcrypto is None:
raise ADEPTError('libcrypto not found') raise ADEPTError('libcrypto not found')

View File

@@ -559,7 +559,7 @@ class DocParser(object):
if (link > 0): if (link > 0):
linktype = self.link_type[link-1] linktype = self.link_type[link-1]
title = self.link_title[link-1] title = self.link_title[link-1]
title = title.rstrip(b'. ') title = title.rstrip(b'. ').decode('utf-8')
alt_title = parares[lstart:] alt_title = parares[lstart:]
alt_title = alt_title.strip() alt_title = alt_title.strip()
# now strip off the actual printed page number # now strip off the actual printed page number
@@ -770,10 +770,10 @@ class DocParser(object):
first_para_continued = False first_para_continued = False
(pclass, pdesc) = self.getParaDescription(start,end, regtype) (pclass, pdesc) = self.getParaDescription(start,end, regtype)
if not pclass: if not pclass:
if orig_regtype.endswith(b'.right') : pclass = 'cl-right' if orig_regtype.endswith(b'.right') : pclass = b'cl-right'
elif orig_regtype.endswith(b'.center') : pclass = 'cl-center' elif orig_regtype.endswith(b'.center') : pclass = b'cl-center'
elif orig_regtype.endswith(b'.left') : pclass = 'cl-left' elif orig_regtype.endswith(b'.left') : pclass = b'cl-left'
elif orig_regtype.endswith(b'.justify') : pclass = 'cl-justify' elif orig_regtype.endswith(b'.justify') : pclass = b'cl-justify'
if pclass and (ptype == 'full') and (len(pclass) >= 6): if pclass and (ptype == 'full') and (len(pclass) >= 6):
tag = 'p' tag = 'p'
if pclass[3:6] == b'h1-' : tag = 'h4' if pclass[3:6] == b'h1-' : tag = 'h4'

View File

@@ -415,12 +415,12 @@ def decryptBook(userkey, inpath, outpath):
return 1 return 1
bookkey = rsa.decrypt(codecs.decode(bookkey.encode('ascii'), 'base64')) bookkey = rsa.decrypt(codecs.decode(bookkey.encode('ascii'), 'base64'))
# Padded as per RSAES-PKCS1-v1_5 # Padded as per RSAES-PKCS1-v1_5
if len(bookkey) != 16: if len(bookkey) > 16:
if bookkey[-17] != '\x00' and bookkey[-17] != 0: if bookkey[-17] == '\x00' or bookkey[-17] == 0:
bookkey = bookkey[-16:]
else:
print("Could not decrypt {0:s}. Wrong key".format(os.path.basename(inpath))) print("Could not decrypt {0:s}. Wrong key".format(os.path.basename(inpath)))
return 2 return 2
else:
bookkey = bookkey[-16:]
encryption = inf.read('META-INF/encryption.xml') encryption = inf.read('META-INF/encryption.xml')
decryptor = Decryptor(bookkey, encryption) decryptor = Decryptor(bookkey, encryption)
kwds = dict(compression=ZIP_DEFLATED, allowZip64=False) kwds = dict(compression=ZIP_DEFLATED, allowZip64=False)

View File

@@ -442,7 +442,7 @@ def nunpack(s, default=0):
elif l == 2: elif l == 2:
return struct.unpack('>H', s)[0] return struct.unpack('>H', s)[0]
elif l == 3: elif l == 3:
return struct.unpack('>L', '\x00'+s)[0] return struct.unpack('>L', b'\x00'+s)[0]
elif l == 4: elif l == 4:
return struct.unpack('>L', s)[0] return struct.unpack('>L', s)[0]
else: else:
@@ -1482,7 +1482,7 @@ class PDFDocument(object):
# global static principal key for German Onleihe / Bibliothek Digital # global static principal key for German Onleihe / Bibliothek Digital
principalkeys = { b'bibliothek-digital.de': codecs.decode(b'rRwGv2tbpKov1krvv7PO0ws9S436/lArPlfipz5Pqhw=','base64')} principalkeys = { b'bibliothek-digital.de': codecs.decode(b'rRwGv2tbpKov1krvv7PO0ws9S436/lArPlfipz5Pqhw=','base64')}
self.is_printable = self.is_modifiable = self.is_extractable = True 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') edcdata = str_value(param.get('EDCData')).decode('base64')
pdrllic = str_value(param.get('PDRLLic')).decode('base64') pdrllic = str_value(param.get('PDRLLic')).decode('base64')
pdrlpol = str_value(param.get('PDRLPol')).decode('base64') pdrlpol = str_value(param.get('PDRLPol')).decode('base64')
@@ -1547,8 +1547,8 @@ class PDFDocument(object):
if 5 <= R: if 5 <= R:
# 8 # 8
for _ in range(50): for _ in range(50):
hash = hashlib.md5(hash.digest()[:length/8]) hash = hashlib.md5(hash.digest()[:length//8])
key = hash.digest()[:length/8] key = hash.digest()[:length//8]
if R == 2: if R == 2:
# Algorithm 3.4 # Algorithm 3.4
u1 = ARC4.new(key).decrypt(password) u1 = ARC4.new(key).decrypt(password)
@@ -1590,7 +1590,7 @@ class PDFDocument(object):
def initialize_ebx(self, password, docid, param): def initialize_ebx(self, password, docid, param):
self.is_printable = self.is_modifiable = self.is_extractable = True self.is_printable = self.is_modifiable = self.is_extractable = True
rsa = RSA(password) 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 = codecs.decode(param.get('ADEPT_LICENSE'), 'base64')
rights = zlib.decompress(rights, -15) rights = zlib.decompress(rights, -15)
rights = etree.fromstring(rights) rights = etree.fromstring(rights)
@@ -1599,11 +1599,10 @@ class PDFDocument(object):
bookkey = rsa.decrypt(bookkey) bookkey = rsa.decrypt(bookkey)
#if bookkey[0] != 2: #if bookkey[0] != 2:
# raise ADEPTError('error decrypting book session key') # raise ADEPTError('error decrypting book session key')
try: if len(bookkey) > 16:
index = bookkey.index(b'\0') + 1 if bookkey[-17] == '\x00' or bookkey[-17] == 0:
bookkey = bookkey[index:] bookkey = bookkey[-16:]
except ValueError: length = 16
pass
ebx_V = int_value(param.get('V', 4)) ebx_V = int_value(param.get('V', 4))
ebx_type = int_value(param.get('EBX_ENCRYPTIONTYPE', 6)) ebx_type = int_value(param.get('EBX_ENCRYPTIONTYPE', 6))
# added because of improper booktype / decryption book session key errors # added because of improper booktype / decryption book session key errors

View File

@@ -512,6 +512,8 @@ class BinaryIonParser(object):
if table is not None: if table is not None:
self.symbols.import_(table, min(maxid, len(table.symnames))) self.symbols.import_(table, min(maxid, len(table.symnames)))
if len(table.symnames) < maxid:
self.symbols.importunknown(name + "-unknown", maxid - len(table.symnames))
else: else:
self.symbols.importunknown(name, maxid) self.symbols.importunknown(name, maxid)
@@ -733,7 +735,10 @@ SYM_NAMES = [ 'com.amazon.drm.Envelope@1.0',
'com.amazon.drm.EncryptedPage@2.0', 'com.amazon.drm.EncryptedPage@2.0',
'com.amazon.drm.PlainText@2.0', 'compression_algorithm', 'com.amazon.drm.PlainText@2.0', 'compression_algorithm',
'com.amazon.drm.Compressed@1.0', 'page_index_table', 'com.amazon.drm.Compressed@1.0', 'page_index_table',
'com.amazon.drm.VoucherEnvelope@2.0', 'com.amazon.drm.VoucherEnvelope@3.0' ] ] + ['com.amazon.drm.VoucherEnvelope@%d.0' % n
for n in list(range(2, 29)) + [
9708, 1031, 2069, 9041, 3646,
6052, 9479, 9888, 4648, 5683]]
def addprottable(ion): def addprottable(ion):
ion.addtocatalog("ProtectedData", 1, SYM_NAMES) ion.addtocatalog("ProtectedData", 1, SYM_NAMES)
@@ -757,9 +762,45 @@ def pkcs7unpad(msg, blocklen):
# every VoucherEnvelope version has a corresponding "word" and magic number, used in obfuscating the shared secret # every VoucherEnvelope version has a corresponding "word" and magic number, used in obfuscating the shared secret
VOUCHER_VERSION_INFOS = { OBFUSCATION_TABLE = {
2: [b'Antidisestablishmentarianism', 5], "V1": (0x00, None),
3: [b'Floccinaucinihilipilification', 8] "V2": (0x05, b'Antidisestablishmentarianism'),
"V3": (0x08, b'Floccinaucinihilipilification'),
"V4": (0x07, b'>\x14\x0c\x12\x10-\x13&\x18U\x1d\x05Rlt\x03!\x19\x1b\x13\x04]Y\x19,\t\x1b'),
"V5": (0x06, b'~\x18~\x16J\\\x18\x10\x05\x0b\x07\t\x0cZ\r|\x1c\x15\x1d\x11>,\x1b\x0e\x03"4\x1b\x01'),
"V6": (0x09, b'3h\x055\x03[^>\x19\x1c\x08\x1b\rtm4\x02Rp\x0c\x16B\n'),
"V7": (0x05, b'\x10\x1bJ\x18\nh!\x10"\x03>Z\'\r\x01]W\x06\x1c\x1e?\x0f\x13'),
"V8": (0x09, b"K\x0c6\x1d\x1a\x17pO}Rk\x1d'w1^\x1f$\x1c{C\x02Q\x06\x1d`"),
"V9": (0x05, b'X.\x0eW\x1c*K\x12\x12\t\n\n\x17Wx\x01\x02Yf\x0f\x18\x1bVXPi\x01'),
"V10": (0x07, b'z3\n\x039\x12\x13`\x06=v,\x02MTK\x1e%}L\x1c\x1f\x15\x0c\x11\x02\x0c\n8\x17p'),
"V11": (0x05, b'L=\nhVm\x07go\n6\x14\x06\x16L\r\x02\x0b\x0c\x1b\x04#p\t'),
"V12": (0x06, b',n\x1d\rl\x13\x1c\x13\x16p\x14\x07U\x0c\x1f\x19w\x16\x16\x1d5T'),
"V13": (0x07, b'I\x05\t\x08\x03r)\x01$N\x0fr3n\x0b062D\x0f\x13'),
"V14": (0x05, b"\x03\x02\x1c9\x19\x15\x15q\x1057\x08\x16\x0cF\x1b.Fw\x01\x12\x03\x13\x02\x17S'hk6"),
"V15": (0x0A, b'&,4B\x1dcI\x0bU\x03I\x07\x04\x1c\t\x05c\x07%ws\x0cj\t\x1a\x08\x0f'),
"V16": (0x0A, b'\x06\x18`h,b><\x06PqR\x02Zc\x034\n\x16\x1e\x18\x06#e'),
"V17": (0x07, b'y\r\x12\x08fw.[\x02\t\n\x13\x11\x0c\x11b\x1e8L\x10(\x13<Jx6c\x0f'),
"V18": (0x07, b'I\x0b\x0e,\x19\x1aIa\x10s\x19g\\\x1b\x11!\x18yf\x0f\t\x1d7[bSp\x03'),
"V19": (0x05, b'\n6>)N\x02\x188\x016s\x13\x14\x1b\x16jeN\n\x146\x04\x18\x1c\x0c\x19\x1f,\x02]'),
"V20": (0x08, b'_\r\x01\x12]\\\x14*\x17i\x14\r\t!\x1e,~hZ\x12jK\x17\x1e*1'),
"V21": (0x07, b'e\x1d\x19|\ty\x1di|N\x13\x0e\x04\x1bj<h\x13\x15k\x12\x08=\x1f\x16~\x13l'),
"V22": (0x08, b'?\x17yi$k7Pc\tEo\x0c\x07\x07\t\x1f,*i\x12\x0cI0\x10I\x1a?2\x04'),
"V23": (0x08, b'\x16+db\x13\x04\x18\rc%\x14\x17\x0f\x13F\x0c[\t9\x1ay\x01\x1eH'),
"V24": (0x06, b'|6\\\x1a\r\x10\nP\x07\x0fu\x1f\t,\rr`uv\\~55\x11]N'),
"V25": (0x09, b'\x07\x14w\x1e,^y\x01:\x08\x07\x1fr\tU#j\x16\x12\x1eB\x04\x16=\x06fZ\x07\x02\x06'),
"V26": (0x06, b'\x03IL\x1e"K\x1f\x0f\x1fp0\x01`X\x02z0`\x03\x0eN\x07'),
"V27": (0x07, b'Xk\x10y\x02\x18\x10\x17\x1d,\x0e\x05e\x10\x15"e\x0fh(\x06s\x1c\x08I\x0c\x1b\x0e'),
"V28": (0x0A, b'6P\x1bs\x0f\x06V.\x1cM\x14\x02\n\x1b\x07{P0:\x18zaU\x05'),
"V9708": (0x05, b'\x1diIm\x08a\x17\x1e!am\x1d\x1aQ.\x16!\x06*\}x04\x11\t\x06\x04?'),
"V1031": (0x08, b'Antidisestablishmentarianism'),
"V2069": (0x07, b'Floccinaucinihilipilification'),
"V9041": (0x06, b'>\x14\x0c\x12\x10-\x13&\x18U\x1d\x05Rlt\x03!\x19\x1b\x13\x04]Y\x19,\t\x1b'),
"V3646": (0x09, b'~\x18~\x16J\\\x18\x10\x05\x0b\x07\t\x0cZ\r|\x1c\x15\x1d\x11>,\x1b\x0e\x03"4\x1b\x01'),
"V6052": (0x05, b'3h\x055\x03[^>\x19\x1c\x08\x1b\rtm4\x02Rp\x0c\x16B\n'),
"V9479": (0x09, b'\x10\x1bJ\x18\nh!\x10"\x03>Z\'\r\x01]W\x06\x1c\x1e?\x0f\x13'),
"V9888": (0x05, b"K\x0c6\x1d\x1a\x17pO}Rk\x1d'w1^\x1f$\x1c{C\x02Q\x06\x1d`"),
"V4648": (0x07, b'X.\x0eW\x1c*K\x12\x12\t\n\n\x17Wx\x01\x02Yf\x0f\x18\x1bVXPi\x01'),
"V5683": (0x05, b'z3\n\x039\x12\x13`\x06=v,\x02MTK\x1e%}L\x1c\x1f\x15\x0c\x11\x02\x0c\n8\x17p'),
} }
@@ -768,9 +809,7 @@ def obfuscate(secret, version):
if version == 1: # v1 does not use obfuscation if version == 1: # v1 does not use obfuscation
return secret return secret
params = VOUCHER_VERSION_INFOS[version] magic, word = OBFUSCATION_TABLE["V%d" % version]
word = params[0]
magic = params[1]
# extend secret so that its length is divisible by the magic number # extend secret so that its length is divisible by the magic number
if len(secret) % magic != 0: if len(secret) % magic != 0:
@@ -815,18 +854,18 @@ class DrmIonVoucher(object):
addprottable(self.envelope) addprottable(self.envelope)
def decryptvoucher(self): def decryptvoucher(self):
shared = "PIDv3" + self.encalgorithm + self.enctransformation + self.hashalgorithm shared = ("PIDv3" + self.encalgorithm + self.enctransformation + self.hashalgorithm).encode('ASCII')
self.lockparams.sort() self.lockparams.sort()
for param in self.lockparams: for param in self.lockparams:
if param == "ACCOUNT_SECRET": if param == "ACCOUNT_SECRET":
shared += param + self.secret shared += param.encode('ASCII') + self.secret
elif param == "CLIENT_ID": elif param == "CLIENT_ID":
shared += param + self.dsn shared += param.encode('ASCII') + self.dsn
else: else:
_assert(False, "Unknown lock parameter: %s" % param) _assert(False, "Unknown lock parameter: %s" % param)
sharedsecret = obfuscate(shared.encode('ASCII'), self.version) sharedsecret = obfuscate(shared, self.version)
key = hmac.new(sharedsecret, b"PIDv3", digestmod=hashlib.sha256).digest() key = hmac.new(sharedsecret, b"PIDv3", digestmod=hashlib.sha256).digest()
aes = AES.new(key[:32], AES.MODE_CBC, self.cipheriv[:16]) aes = AES.new(key[:32], AES.MODE_CBC, self.cipheriv[:16])
@@ -993,6 +1032,7 @@ class DrmIon(object):
elif self.ion.gettypename() in ["com.amazon.drm.EncryptedPage@1.0", "com.amazon.drm.EncryptedPage@2.0"]: elif self.ion.gettypename() in ["com.amazon.drm.EncryptedPage@1.0", "com.amazon.drm.EncryptedPage@2.0"]:
decompress = False decompress = False
decrypt = True
ct = None ct = None
civ = None civ = None
self.ion.stepin() self.ion.stepin()
@@ -1006,7 +1046,23 @@ class DrmIon(object):
civ = self.ion.lobvalue() civ = self.ion.lobvalue()
if ct is not None and civ is not None: if ct is not None and civ is not None:
self.processpage(ct, civ, outpages, decompress) self.processpage(ct, civ, outpages, decompress, decrypt)
self.ion.stepout()
elif self.ion.gettypename() in ["com.amazon.drm.PlainText@1.0", "com.amazon.drm.PlainText@2.0"]:
decompress = False
decrypt = False
plaintext = None
self.ion.stepin()
while self.ion.hasnext():
self.ion.next()
if self.ion.gettypename() == "com.amazon.drm.Compressed@1.0":
decompress = True
if self.ion.getfieldname() == "data":
plaintext = self.ion.lobvalue()
if plaintext is not None:
self.processpage(plaintext, None, outpages, decompress, decrypt)
self.ion.stepout() self.ion.stepout()
self.ion.stepout() self.ion.stepout()
@@ -1017,9 +1073,12 @@ class DrmIon(object):
def print_(self, lst): def print_(self, lst):
self.ion.print_(lst) self.ion.print_(lst)
def processpage(self, ct, civ, outpages, decompress): def processpage(self, ct, civ, outpages, decompress, decrypt):
if decrypt:
aes = AES.new(self.key[:16], AES.MODE_CBC, civ[:16]) aes = AES.new(self.key[:16], AES.MODE_CBC, civ[:16])
msg = pkcs7unpad(aes.decrypt(ct), 16) msg = pkcs7unpad(aes.decrypt(ct), 16)
else:
msg = ct
if not decompress: if not decompress:
outpages.write(msg) outpages.write(msg)

View File

@@ -191,7 +191,7 @@ def unescape(text):
else: else:
# named entity # named entity
try: try:
text = chr(htmlentitydefs.name2codepoint[text[1:-1]]) text = chr(html.entities.name2codepoint[text[1:-1]])
except KeyError: except KeyError:
pass pass
return text # leave as is return text # leave as is

View File

@@ -4,10 +4,12 @@
# Engine to remove drm from Kindle KFX ebooks # Engine to remove drm from Kindle KFX ebooks
# 2.0 - Python 3 for calibre 5.0 # 2.0 - Python 3 for calibre 5.0
# 2.1 - Some fixes for debugging
import os import os
import shutil import shutil
import traceback
import zipfile import zipfile
from io import BytesIO from io import BytesIO
@@ -65,6 +67,9 @@ class KFXZipBook:
print("Decrypting KFX DRM voucher: {0}".format(info.filename)) print("Decrypting KFX DRM voucher: {0}".format(info.filename))
for pid in [''] + totalpids: 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)]: 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: if len(pid) == dsn_len + secret_len:
break # split pid into DSN and account secret break # split pid into DSN and account secret
@@ -77,6 +82,7 @@ class KFXZipBook:
voucher.decryptvoucher() voucher.decryptvoucher()
break break
except: except:
traceback.print_exc()
pass pass
else: else:
raise Exception("Failed to decrypt KFX DRM voucher with any key") raise Exception("Failed to decrypt KFX DRM voucher with any key")

View File

@@ -174,14 +174,14 @@ def pidFromSerial(s, l):
# Parse the EXTH header records and use the Kindle serial number to calculate the book pid. # Parse the EXTH header records and use the Kindle serial number to calculate the book pid.
def getKindlePids(rec209, token, serialnum): def getKindlePids(rec209, token, serialnum):
if isinstance(serialnum,str):
serialnum = serialnum.encode('utf-8')
if rec209 is None: if rec209 is None:
return [serialnum] return [serialnum]
pids=[] pids=[]
if isinstance(serialnum,str):
serialnum = serialnum.encode('utf-8')
# Compute book PID # Compute book PID
pidHash = SHA1(serialnum+rec209+token) pidHash = SHA1(serialnum+rec209+token)
bookPID = encodePID(pidHash) bookPID = encodePID(pidHash)
@@ -209,7 +209,7 @@ def getK4Pids(rec209, token, kindleDatabase):
kindleAccountToken = bytearray.fromhex((kindleDatabase[1])['kindle.account.tokens']) kindleAccountToken = bytearray.fromhex((kindleDatabase[1])['kindle.account.tokens'])
except KeyError: except KeyError:
kindleAccountToken="" kindleAccountToken = b''
pass pass
try: try:

View File

@@ -153,6 +153,7 @@ class fixZip:
nzinfo.internal_attr=zinfo.internal_attr nzinfo.internal_attr=zinfo.internal_attr
nzinfo.external_attr=zinfo.external_attr nzinfo.external_attr=zinfo.external_attr
nzinfo.create_system=zinfo.create_system nzinfo.create_system=zinfo.create_system
nzinfo.flag_bits = zinfo.flag_bits & 0x800 # preserve UTF-8 flag
self.outzip.writestr(nzinfo,data) self.outzip.writestr(nzinfo,data)
self.bzf.close() self.bzf.close()

View File

@@ -27,12 +27,12 @@ Verify the one of the following cryptographic hash values, using software of you
#### Kindle for PC `KindleForPC-installer-1.17.44170.exe`: #### Kindle for PC `KindleForPC-installer-1.17.44170.exe`:
* MD-5: 53F793B562F4823721AA47D7DE099869 * MD-5: 53F793B562F4823721AA47D7DE099869
* SHA-1: 73C404D719F0DD8D4AE1C2C96612B095D6C86255 * SHA-1: 73C404D719F0DD8D4AE1C2C96612B095D6C86255
* SHA-256: 14E0F0053F1276C0C7C446892DC170344F707FBFE99B695176 2C120144163200 * SHA-256: 14E0F0053F1276C0C7C446892DC170344F707FBFE99B6951762C120144163200
#### Kindle for Mac `KindleForMac-44182.dmg`: #### Kindle for Mac `KindleForMac-44182.dmg`:
* MD-5: E7E36D5369E1F3CF1D28E5D9115DF15F * MD-5: E7E36D5369E1F3CF1D28E5D9115DF15F
* SHA-1: 7AB9A86B954CB23D622BD79E3257F8E2182D791C * SHA-1: 7AB9A86B954CB23D622BD79E3257F8E2182D791C
* SHA-256: 28DC21246A9C7CDEDD2D6F0F4082E6BF7EF9DB9CE9D485548E 8A9E1D19EAE2AC. * SHA-256: 28DC21246A9C7CDEDD2D6F0F4082E6BF7EF9DB9CE9D485548E8A9E1D19EAE2AC
You will need to go to the preferences and uncheck the auto update checkbox. Then download and install 1.17 over the top of the newer installation. You'll also need to delete the KFX folders from your My Kindle Content folder. You may also need to take further action to prevent an auto update. The simplest wayis to find the 'updates' folder and replace it with a file. See [this thread] (http://www.mobileread.com/forums/showthread.php?t=283371) at MobileRead for a Script to do this on a PC. On a Mac you can find the folder at ~/Library/Application Support/Kindle/ just delete the folder 'updates' and save a blank text file called 'updates' in its place. You will need to go to the preferences and uncheck the auto update checkbox. Then download and install 1.17 over the top of the newer installation. You'll also need to delete the KFX folders from your My Kindle Content folder. You may also need to take further action to prevent an auto update. The simplest wayis to find the 'updates' folder and replace it with a file. See [this thread] (http://www.mobileread.com/forums/showthread.php?t=283371) at MobileRead for a Script to do this on a PC. On a Mac you can find the folder at ~/Library/Application Support/Kindle/ just delete the folder 'updates' and save a blank text file called 'updates' in its place.
@@ -51,7 +51,9 @@ Mac Note: If the chmod command fails with a permission error try again using `su
After restarting the Kindle program any books previously downloaded in KFX format will no longer open. You will need to remove them from your device and re-download them. All future downloads will use the older Kindle formats instead of KFX although they will continue to be placed in one individual subdirectory per book. Note that books soudl be downoad by right-click and 'Download', not by just opening the book. Recent (1.25+) versions of Kindle for Mac/PC may convert KF8 files to a new format that is not supported by these tools when the book is opened for reading. After restarting the Kindle program any books previously downloaded in KFX format will no longer open. You will need to remove them from your device and re-download them. All future downloads will use the older Kindle formats instead of KFX although they will continue to be placed in one individual subdirectory per book. Note that books soudl be downoad by right-click and 'Download', not by just opening the book. Recent (1.25+) versions of Kindle for Mac/PC may convert KF8 files to a new format that is not supported by these tools when the book is opened for reading.
#### Decrypting KFX #### Decrypting KFX
Thanks to work by several people, the tools can now decrypt KFX format ebooks from Kindle for Mac/PC version 1.26 or earlier (version later than 1.26 use a new encryption scheme for KFX files). In addition to the DeDRM plugin, calibre users will also need to install jhowell's KFX Input plugin which is available through the standard plugin menu in calibre, or directly from [his plugin thread](https://www.mobileread.com/forums/showthread.php?t=291290) on Mobileread. Thanks to work by several people, the tools can now decrypt KFX format ebooks from Kindle for Mac/PC. In addition to the DeDRM plugin, calibre users will also need to install jhowell's KFX Input plugin which is available through the standard plugin menu in calibre, or directly from [his plugin thread](https://www.mobileread.com/forums/showthread.php?t=291290) on Mobileread.
It's quite possible that Amazon will update their KFX DeDRM to prevent DRM removal from KFX books again. So Remove DRM as soon as possible!
#### Thanks #### Thanks
Thanks to jhowell for his investigations into KFX format and the KFX Input plugin. Some of these instructions are from [his thread on the subject](https://www.mobileread.com/forums/showthread.php?t=283371) at MobileRead. Thanks to jhowell for his investigations into KFX format and the KFX Input plugin. Some of these instructions are from [his thread on the subject](https://www.mobileread.com/forums/showthread.php?t=283371) at MobileRead.

View File

@@ -3,7 +3,7 @@ from __future__ import (unicode_literals, division, absolute_import,
print_function) print_function)
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = '6.7.0' __version__ = '7.2.0'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
##################################################################### #####################################################################
@@ -20,7 +20,7 @@ except NameError:
PLUGIN_NAME = 'Obok DeDRM' PLUGIN_NAME = 'Obok DeDRM'
PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_') PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_')
PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.') PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.')
PLUGIN_VERSION_TUPLE = (6, 7, 0) PLUGIN_VERSION_TUPLE = (7, 2, 0)
PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE]) PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE])
HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm' HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm'
PLUGIN_AUTHORS = 'Anon' PLUGIN_AUTHORS = 'Anon'

View File

@@ -1,6 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Version 4.1.0 February 2021
# Add detection for Kobo directory location on Linux
# Version 4.0.0 September 2020 # Version 4.0.0 September 2020
# Python 3.0 # Python 3.0
# #
@@ -365,9 +368,33 @@ class KoboLibrary(object):
self.kobodir = os.path.join(self.kobodir, "Kobo", "Kobo Desktop Edition") self.kobodir = os.path.join(self.kobodir, "Kobo", "Kobo Desktop Edition")
elif sys.platform.startswith('darwin'): elif sys.platform.startswith('darwin'):
self.kobodir = os.path.join(os.environ['HOME'], "Library", "Application Support", "Kobo", "Kobo Desktop Edition") self.kobodir = os.path.join(os.environ['HOME'], "Library", "Application Support", "Kobo", "Kobo Desktop Edition")
#elif linux_path != None: elif sys.platform.startswith('linux'):
# Probably Linux, let's get the wine prefix and path to Kobo.
# self.kobodir = os.path.join(linux_path, "Local Settings", "Application Data", "Kobo", "Kobo Desktop Edition") #sets ~/.config/calibre as the location to store the kobodir location info file and creates this directory if necessary
kobodir_cache_dir = os.path.join(os.environ['HOME'], ".config", "calibre")
if not os.path.isdir(kobodir_cache_dir):
os.mkdir(kobodir_cache_dir)
#appends the name of the file we're storing the kobodir location info to the above path
kobodir_cache_file = str(kobodir_cache_dir) + "/" + "kobo location"
"""if the above file does not exist, recursively searches from the root
of the filesystem until kobodir is found and stores the location of kobodir
in that file so this loop can be skipped in the future"""
original_stdout = sys.stdout
if not os.path.isfile(kobodir_cache_file):
for root, dirs, files in os.walk('/'):
for file in files:
if file == 'Kobo.sqlite':
kobo_linux_path = str(root)
with open(kobodir_cache_file, 'w') as f:
sys.stdout = f
print(kobo_linux_path, end='')
sys.stdout = original_stdout
f = open(kobodir_cache_file, 'r' )
self.kobodir = f.read()
# desktop versions use Kobo.sqlite # desktop versions use Kobo.sqlite
kobodb = os.path.join(self.kobodir, "Kobo.sqlite") kobodb = os.path.join(self.kobodir, "Kobo.sqlite")
# check for existence of file # check for existence of file
@@ -443,15 +470,15 @@ class KoboLibrary(object):
"""The list of all MAC addresses on this machine.""" """The list of all MAC addresses on this machine."""
macaddrs = [] macaddrs = []
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
c = re.compile('\s(' + '[0-9a-f]{2}-' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE) c = re.compile('\s?(' + '[0-9a-f]{2}[:\-]' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
output = subprocess.Popen('ipconfig /all', shell=True, stdout=subprocess.PIPE, text=True).stdout output = subprocess.Popen('wmic nic where PhysicalAdapter=True get MACAddress', shell=True, stdout=subprocess.PIPE, text=True).stdout
for line in output: for line in output:
m = c.search(line) m = c.search(line)
if m: if m:
macaddrs.append(re.sub("-", ":", m.group(1)).upper()) macaddrs.append(re.sub("-", ":", m.group(1)).upper())
elif sys.platform.startswith('darwin'): elif sys.platform.startswith('darwin'):
c = re.compile('\s(' + '[0-9a-f]{2}:' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE) c = re.compile('\s(' + '[0-9a-f]{2}:' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
output = subprocess.check_output('/sbin/ifconfig -a', shell=True) output = subprocess.check_output('/sbin/ifconfig -a', shell=True, encoding='utf-8')
matches = c.findall(output) matches = c.findall(output)
for m in matches: for m in matches:
# print "m:{0}".format(m[0]) # print "m:{0}".format(m[0])

Binary file not shown.

View File

@@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-17 12:51+0100\n" "POT-Creation-Date: 2014-11-17 12:51+0100\n"
"PO-Revision-Date: 2020-12-25 13:38+0100\n" "PO-Revision-Date: 2021-01-19 12:20+0100\n"
"Language: sv\n" "Language: sv\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@@ -41,8 +41,8 @@ msgstr "Hittade {0} möjliga nycklar att försöka med."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:99 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:99
msgid "<p>No userkeys found to decrypt books with. No point in proceeding." msgid "<p>No userkeys found to decrypt books with. No point in proceeding."
msgstr "" msgstr ""
"<p>Inga användarnycklar hittades för att dekryptera böcker med. Ingen idé " "<p>Inga användarnycklar hittades för att dekryptera böcker med. Det är ingen "
"att fortsätta." "idé att fortsätta."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:115 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:115
msgid "{} - Decryption canceled by user." msgid "{} - Decryption canceled by user."
@@ -87,13 +87,13 @@ msgstr "dubblett upptäcktes"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:233 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:233
msgid "{0} - Successfully added EPUB format to existing {1}" msgid "{0} - Successfully added EPUB format to existing {1}"
msgstr "{0} - EPUB-format har lagts till i befintliga {1}" msgstr "{0} - EPUB-formatet har lagts till i befintliga {1}"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:236 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:236
msgid "" msgid ""
"{0} - Error adding EPUB format to existing {1}. This really shouldn't happen." "{0} - Error adding EPUB format to existing {1}. This really shouldn't happen."
msgstr "" msgstr ""
"{0} - Fel vid tilläggning av EPUB-format till befintligt {1}. Detta borde " "{0} - Fel vid tilläggning av EPUB-formatet till befintliga {1}. Detta borde "
"verkligen inte hända." "verkligen inte hända."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:259 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:259
@@ -118,8 +118,8 @@ msgid ""
" to those existing entries?<br /><br />NOTE: no pre-existing EPUBs will be " " to those existing entries?<br /><br />NOTE: no pre-existing EPUBs will be "
"overwritten." "overwritten."
msgstr "" msgstr ""
" till dessa befintliga poster?<br /><br />OBS: inga befintliga EPUB:er " " till dessa befintliga poster?<br /><br />OBS: inga befintliga EPUB:er kommer "
"kommer att skrivas över." "att skrivas över."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:295 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:295
msgid "" msgid ""
@@ -132,20 +132,19 @@ msgstr ""
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:297 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:297
msgid "<p><b>{0}</b> -- not added because of {1} in your library.<br /><br />" msgid "<p><b>{0}</b> -- not added because of {1} in your library.<br /><br />"
msgstr "" msgstr ""
"<p><b>{0}</b> -- lades inte till på grund av {1} i ditt bibliotek.<br /><br /" "<p><b>{0}</b> -- lades inte till på grund av {1} i ditt bibliotek.<br /><br />"
">"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:298 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:298
msgid "" msgid ""
"Would you like to try and add the EPUB format to an available calibre " "Would you like to try and add the EPUB format to an available calibre "
"duplicate?<br /><br />" "duplicate?<br /><br />"
msgstr "" msgstr ""
"Vill du försöka lägga till EPUB-format till en tillgänglig calibre-dubblett?" "Vill du försöka lägga till EPUB-formatet till en tillgänglig calibre-dubblett?"
"<br /><br />" "<br /><br />"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:299 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:299
msgid "NOTE: no pre-existing EPUB will be overwritten." msgid "NOTE: no pre-existing EPUB will be overwritten."
msgstr "OBS: inga befintliga EPUB:er kommer att skrivas över." msgstr "OBS: ingen befintlig EPUB kommer att skrivas över."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:346 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:346
msgid "Trying key: " msgid "Trying key: "
@@ -153,7 +152,7 @@ msgstr "Försöker med nyckel: "
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:378 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:378
msgid "Decryption failed, trying next key." msgid "Decryption failed, trying next key."
msgstr "Det gick inte att dekryptera, försöker med nästa nyckel." msgstr "Dekryptering misslyckades, försöker med nästa nyckel."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:382 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:382
msgid "Unknown Error decrypting, trying next key.." msgid "Unknown Error decrypting, trying next key.."
@@ -164,8 +163,8 @@ msgid ""
"<p>All selected Kobo books added as new calibre books or inserted into " "<p>All selected Kobo books added as new calibre books or inserted into "
"existing calibre ebooks.<br /><br />No issues." "existing calibre ebooks.<br /><br />No issues."
msgstr "" msgstr ""
"<p>Alla valda Kobo-böcker har lagts till som nya calibre-böcker eller " "<p>Alla valda Kobo-böcker har lagts till som nya calibre-böcker eller infogats "
"infogats i befintliga calibre-e-böcker.<br /><br />Inga problem." "i befintliga calibre-e-böcker.<br /><br />Inga problem."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:399 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:399
msgid "<p>{0} successfully added." msgid "<p>{0} successfully added."
@@ -200,8 +199,7 @@ msgid "<p><b>Book imports cancelled by user:</b> {}</p>\n"
msgstr "<p><b>Bokimport avbröts av användaren:</b> {}</p>\n" msgstr "<p><b>Bokimport avbröts av användaren:</b> {}</p>\n"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:428 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:428
msgid "" msgid "<p><b>New EPUB formats inserted in existing calibre books:</b> {0}</p>\n"
"<p><b>New EPUB formats inserted in existing calibre books:</b> {0}</p>\n"
msgstr "" msgstr ""
"<p><b>Nya EPUB-format infogade i befintliga calibre-böcker:</b> {0}</p>\n" "<p><b>Nya EPUB-format infogade i befintliga calibre-böcker:</b> {0}</p>\n"
@@ -209,8 +207,7 @@ msgstr ""
msgid "" msgid ""
"<p><b>EPUB formats NOT inserted into existing calibre books:</b> {}<br />\n" "<p><b>EPUB formats NOT inserted into existing calibre books:</b> {}<br />\n"
msgstr "" msgstr ""
"<p><b>EPUB-format som INTE infogats i befintliga calibre-böcker:</b> {}<br /" "<p><b>EPUB-format som INTE infogats i befintliga calibre-böcker:</b> {}<br />\n"
">\n"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:435 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:435
msgid "" msgid ""
@@ -222,7 +219,7 @@ msgstr ""
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:444 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:444
msgid "<p><b>Format imports cancelled by user:</b> {}</p>\n" msgid "<p><b>Format imports cancelled by user:</b> {}</p>\n"
msgstr "<p><b>Formatimporten avbröts av användaren:</b> {}</p>\n" msgstr "<p><b>Format-importen avbröts av användaren:</b> {}</p>\n"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:458 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:458
msgid "Unknown Book Title" msgid "Unknown Book Title"
@@ -234,14 +231,11 @@ msgstr "den kunde inte dekrypteras."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:462 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:462
msgid "" msgid ""
"user CHOSE not to insert the new EPUB format, or all existing calibre " "user CHOSE not to insert the new EPUB format, or all existing calibre entries "
"entries HAD an EPUB format already." "HAD an EPUB format already."
msgstr "" msgstr ""
"användaren VALDE att inte infoga det nya EPUB-formatet, eller alla " "användaren VALDE att inte infoga det nya EPUB-formatet, eller alla befintliga "
"befintliga calibre-poster hade redan ett EPUB-format.\n" "calibre-poster hade redan ett EPUB-format."
"\n"
"användaren valde att inte infoga det nya EPUB-formatet, eller alla "
"befintliga kaliberposter hade redan ett EPUB-format."
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:464 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\action.py:464
msgid "of unknown reasons. Gosh I'm embarrassed!" msgid "of unknown reasons. Gosh I'm embarrassed!"
@@ -282,7 +276,7 @@ msgid ""
"cause calibre ebooks to be overwritten" "cause calibre ebooks to be overwritten"
msgstr "" msgstr ""
"<p>Standardbeteende när dubbletter upptäcks. Inget av alternativen kommer att " "<p>Standardbeteende när dubbletter upptäcks. Inget av alternativen kommer att "
"göra att calibre-e-böcker skrivs över" "orsaka att calibre-e-böcker skrivs över"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\config.py:35 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\config.py:35
msgid "Ask" msgid "Ask"
@@ -363,7 +357,7 @@ msgstr "Felaktig AES-nyckel används"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\obok\obok.py:167 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\obok\obok.py:167
msgid "Failed to initialize AES key" msgid "Failed to initialize AES key"
msgstr "Misslyckades att initiera AES-nyckel" msgstr "Misslyckades med att initiera AES-nyckel"
#: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\obok\obok.py:175 #: I:\Herramientas\PoeditPortable\App\Poedit\bin\obok_plugin-3.1.0_trad\obok\obok.py:175
msgid "AES decryption failed" msgid "AES decryption failed"

View File

@@ -2290,10 +2290,13 @@ class PDFDocument(object):
import win32api import win32api
import win32security import win32security
import win32file import win32file
import winreg
except: except:
raise ADEPTError('PyWin Extension (Win32API module) needed.\n'+\ raise ADEPTError('PyWin Extension (Win32API module) needed.\n'+\
'Download from http://sourceforge.net/projects/pywin32/files/ ') 'Download from http://sourceforge.net/projects/pywin32/files/ ')
try:
import winreg
except ImportError:
import _winreg as winreg
try: try:
v0 = win32api.GetVolumeInformation('C:\\') v0 = win32api.GetVolumeInformation('C:\\')
v1 = win32api.GetSystemInfo()[6] v1 = win32api.GetSystemInfo()[6]

View File

@@ -10,14 +10,12 @@ The individual scripts are now released as two plugins for calibre: DeDRM and Ob
The DeDRM plugin handles books that use Amazon DRM, Adobe Digital Editions DRM (version 1), Barnes & Noble DRM, and some historical formats. The DeDRM plugin handles books that use Amazon DRM, Adobe Digital Editions DRM (version 1), Barnes & Noble DRM, and some historical formats.
The Obok plugin handles Kobo DRM. The Obok plugin handles Kobo DRM.
Users with calibre 5.x or later should use release 7.0.0b2 or later of the tools. Users with calibre 5.x or later should use release 7.2.0 or later of the tools.
Users with calibe 4.x or earlier should use release 6.8.0 of the tools. Users with calibe 4.x or earlier should use release 6.8.x of the tools.
Developers might be interested in forking the repository, as it contains unzipped versions of those tools that are zipped to make the changes over time easier to follow.
For the latest Amazon KFX format, users of the calibre plugin should also install the KFX Input plugin from the standard calibre plugin menu. It's also available from the MobileRead thread here: https://www.mobileread.com/forums/showthread.php?t=291290 For the latest Amazon KFX format, users of the calibre plugin should also install the KFX Input plugin from the standard calibre plugin menu. It's also available from the MobileRead thread here: https://www.mobileread.com/forums/showthread.php?t=291290
Note that DRM can only be removed from KFX format files downloaded with Kindle for PC/Mac 1.26 or earlier. Amazon changes the DRM for KFX files in Kindle for PC/Mac 1.27 and later. Note that Amazon changes the DRM for KFX files frequently. What works for KFX today might not work tomorrow.
I welcome contributions from others to improve these tools, from expanding the range of books handled, improving key retrieval, to just general bug fixes, speed improvements and UI enhancements. I welcome contributions from others to improve these tools, from expanding the range of books handled, improving key retrieval, to just general bug fixes, speed improvements and UI enhancements.

View File

@@ -26,7 +26,7 @@ The tools are provided in the form of plugins for calibre. Calibre is an open so
DeDRM plugin for calibre (Mac OS X, Windows) DeDRM plugin for calibre (Mac OS X, Windows)
------------------------------------------------------- -------------------------------------------------------
calibe 5.x and later are now written in Python 3, and plugins must also use Python 3. If you have calibre 5, you must use version 7.x or later of the plugins. For calibre 4.x and earlier, use version 6.8.0 of the plugins. calibe 5.x and later are now written in Python 3, and plugins must also use Python 3. If you have calibre 5, you must use version 7.x or later of the plugins. For calibre 4.x and earlier, use version 6.8.x of the plugins.
The DeDRM plugin for calibre removes DRM from your Kindle and Adobe DRM ebooks when they are imported to calibre. Just install the DeDRM plugin (DeDRM_plugin.zip), following the instructions and configuration directions provided in the ReadMe file and the help links in the plugin's configuration dialogs. The DeDRM plugin for calibre removes DRM from your Kindle and Adobe DRM ebooks when they are imported to calibre. Just install the DeDRM plugin (DeDRM_plugin.zip), following the instructions and configuration directions provided in the ReadMe file and the help links in the plugin's configuration dialogs.