|
|
@ -1,6 +1,9 @@
|
|
|
|
#!/usr/bin/env python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Version 3.1.9 December 2015
|
|
|
|
|
|
|
|
# Update for latest version of Windows Desktop app.
|
|
|
|
|
|
|
|
#
|
|
|
|
# Version 3.1.8 November 2015
|
|
|
|
# Version 3.1.8 November 2015
|
|
|
|
# Handle the case of Kobo Arc or Vox device (i.e. don't crash).
|
|
|
|
# Handle the case of Kobo Arc or Vox device (i.e. don't crash).
|
|
|
|
#
|
|
|
|
#
|
|
|
@ -144,6 +147,9 @@ import xml.etree.ElementTree as ET
|
|
|
|
import string
|
|
|
|
import string
|
|
|
|
import shutil
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# List of all known hash keys
|
|
|
|
|
|
|
|
KOBO_HASH_KEYS = ['88b3a2e13', 'XzUhGYdFp', 'NoCanLook']
|
|
|
|
|
|
|
|
|
|
|
|
class ENCRYPTIONError(Exception):
|
|
|
|
class ENCRYPTIONError(Exception):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
@ -384,16 +390,11 @@ class KoboLibrary(object):
|
|
|
|
def __getuserkeys (self, macaddr):
|
|
|
|
def __getuserkeys (self, macaddr):
|
|
|
|
userids = self.__getuserids()
|
|
|
|
userids = self.__getuserids()
|
|
|
|
userkeys = []
|
|
|
|
userkeys = []
|
|
|
|
# This version is used for versions before 3.17.0.
|
|
|
|
for hash in KOBO_HASH_KEYS:
|
|
|
|
deviceid = hashlib.sha256('NoCanLook' + macaddr).hexdigest()
|
|
|
|
deviceid = hashlib.sha256(hash + macaddr).hexdigest()
|
|
|
|
for userid in userids:
|
|
|
|
for userid in userids:
|
|
|
|
userkey = hashlib.sha256(deviceid + userid).hexdigest()
|
|
|
|
userkey = hashlib.sha256(deviceid + userid).hexdigest()
|
|
|
|
userkeys.append(binascii.a2b_hex(userkey[32:]))
|
|
|
|
userkeys.append(binascii.a2b_hex(userkey[32:]))
|
|
|
|
# This version is used for 3.17.0 and later.
|
|
|
|
|
|
|
|
deviceid = hashlib.sha256('XzUhGYdFp' + macaddr).hexdigest()
|
|
|
|
|
|
|
|
for userid in userids:
|
|
|
|
|
|
|
|
userkey = hashlib.sha256(deviceid + userid).hexdigest()
|
|
|
|
|
|
|
|
userkeys.append(binascii.a2b_hex(userkey[32:]))
|
|
|
|
|
|
|
|
return userkeys
|
|
|
|
return userkeys
|
|
|
|
|
|
|
|
|
|
|
|
class KoboBook(object):
|
|
|
|
class KoboBook(object):
|
|
|
|