mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2025-01-24 00:04:32 +06:00
Update kgenpids.py
This commit is contained in:
parent
75cad40804
commit
ffd7d41bcd
@ -12,6 +12,7 @@ __version__ = '2.1'
|
|||||||
# Revision history:
|
# Revision history:
|
||||||
# 2.0 - Fix for non-ascii Windows user names
|
# 2.0 - Fix for non-ascii Windows user names
|
||||||
# 2.1 - Actual fix for non-ascii WIndows user names.
|
# 2.1 - Actual fix for non-ascii WIndows user names.
|
||||||
|
# x.x - Return information needed for KFX decryption
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os, csv
|
import os, csv
|
||||||
@ -172,6 +173,9 @@ 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 rec209 is None:
|
||||||
|
return [serialnum]
|
||||||
|
|
||||||
pids=[]
|
pids=[]
|
||||||
|
|
||||||
if isinstance(serialnum,unicode):
|
if isinstance(serialnum,unicode):
|
||||||
@ -198,7 +202,7 @@ keynames = ['kindle.account.tokens','kindle.cookie.item','eulaVersionAccepted','
|
|||||||
def getK4Pids(rec209, token, kindleDatabase):
|
def getK4Pids(rec209, token, kindleDatabase):
|
||||||
global charMap1
|
global charMap1
|
||||||
pids = []
|
pids = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the kindle account token, if present
|
# Get the kindle account token, if present
|
||||||
kindleAccountToken = (kindleDatabase[1])['kindle.account.tokens'].decode('hex')
|
kindleAccountToken = (kindleDatabase[1])['kindle.account.tokens'].decode('hex')
|
||||||
@ -217,7 +221,7 @@ def getK4Pids(rec209, token, kindleDatabase):
|
|||||||
# Get the Mazama Random number
|
# Get the Mazama Random number
|
||||||
MazamaRandomNumber = (kindleDatabase[1])['MazamaRandomNumber'].decode('hex')
|
MazamaRandomNumber = (kindleDatabase[1])['MazamaRandomNumber'].decode('hex')
|
||||||
#print u"Got MazamaRandomNumber from database {0}".format(kindleDatabase[0])
|
#print u"Got MazamaRandomNumber from database {0}".format(kindleDatabase[0])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the SerialNumber token, if present
|
# Get the SerialNumber token, if present
|
||||||
IDString = (kindleDatabase[1])['SerialNumber'].decode('hex')
|
IDString = (kindleDatabase[1])['SerialNumber'].decode('hex')
|
||||||
@ -249,6 +253,10 @@ def getK4Pids(rec209, token, kindleDatabase):
|
|||||||
#print u"DSN",DSN.encode('hex')
|
#print u"DSN",DSN.encode('hex')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if rec209 is None:
|
||||||
|
pids.append(DSN+kindleAccountToken)
|
||||||
|
return pids
|
||||||
|
|
||||||
# Compute the device PID (for which I can tell, is used for nothing).
|
# Compute the device PID (for which I can tell, is used for nothing).
|
||||||
table = generatePidEncryptionTable()
|
table = generatePidEncryptionTable()
|
||||||
devicePID = generateDevicePID(table,DSN,4)
|
devicePID = generateDevicePID(table,DSN,4)
|
||||||
|
Loading…
Reference in New Issue
Block a user