Skip to content

Commit

Permalink
tools v3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
apprenticealf committed Mar 5, 2015
1 parent ac9cdb1 commit 427137b
Show file tree
Hide file tree
Showing 17 changed files with 296 additions and 185 deletions.
4 changes: 2 additions & 2 deletions DeDRM_Macintosh_Application/DeDRM.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<key>CFBundleExecutable</key>
<string>droplet</string>
<key>CFBundleGetInfoString</key>
<string>DeDRM 2.3, Copyright © 2010–2011 by Apprentice Alf and others.</string>
<string>DeDRM 2.4, Copyright © 2010–2011 by Apprentice Alf and others.</string>
<key>CFBundleIconFile</key>
<string>droplet</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -34,7 +34,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.3</string>
<string>2.4</string>
<key>CFBundleSignature</key>
<string>dplt</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# and import that ZIP into Calibre using its plugin configuration GUI.


__version__ = '2.4'
__version__ = '2.6'

class Unbuffered:
def __init__(self, stream):
Expand Down Expand Up @@ -250,7 +250,7 @@ class K4DeDRM(FileTypePlugin):
Provided by the work of many including DiapDealer, SomeUpdates, IHeartCabbages, CMBDTC, Skindle, DarkReverser, ApprenticeAlf, etc.'
supported_platforms = ['osx', 'windows', 'linux'] # Platforms this plugin will run on
author = 'DiapDealer, SomeUpdates' # The author of this plugin
version = (0, 2, 4) # The version number of this plugin
version = (0, 2, 6) # The version number of this plugin
file_types = set(['prc','mobi','azw','azw1','tpz']) # The file types that this plugin will be applied to
on_import = True # Run this plugin during the import
priority = 210 # run this plugin before mobidedrm, k4pcdedrm, k4dedrm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,11 @@ def pidFromSerial(s, l):

# Parse the EXTH header records and use the Kindle serial number to calculate the book pid.
def getKindlePid(pidlst, rec209, token, serialnum):

if rec209 != None and token != None:
# Compute book PID
pidHash = SHA1(serialnum+rec209+token)
bookPID = encodePID(pidHash)
bookPID = checksumPid(bookPID)
pidlst.append(bookPID)
# Compute book PID
pidHash = SHA1(serialnum+rec209+token)
bookPID = encodePID(pidHash)
bookPID = checksumPid(bookPID)
pidlst.append(bookPID)

# compute fixed pid for old pre 2.5 firmware update pid as well
bookPID = pidFromSerial(serialnum, 7) + "*"
Expand Down Expand Up @@ -276,9 +274,6 @@ def getK4Pids(pidlst, rec209, token, kInfoFile=None):
pidlst.append(devicePID)

# Compute book PID
if rec209 == None or token == None:
print "\nNo EXTH record type 209 or token - Perhaps not a K4 file?"
return pidlst

# Get the kindle account token
kindleAccountToken = getKindleInfoValueForKey("kindle.account.tokens")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
# 0.25 - Fixed support for 'BOOKMOBI' type 1 encryption
# 0.26 - Now enables Text-To-Speech flag and sets clipping limit to 100%
# 0.27 - Correct pid metadata token generation to match that used by skindle (Thank You Bart!)
# 0.28 - slight additional changes to metadata token generation (None -> '')

__version__ = '0.27'
__version__ = '0.28'

import sys

Expand Down Expand Up @@ -237,12 +238,11 @@ def getBookTitle(self):
return title

def getPIDMetaInfo(self):
rec209 = None
token = None
rec209 = ''
token = ''
if 209 in self.meta_array:
rec209 = self.meta_array[209]
data = rec209
token = ''
# The 209 data comes in five byte groups. Interpret the last four bytes
# of each group as a big endian unsigned integer to get a key value
# if that key exists in the meta_array, append its contents to the token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,22 @@ def parseMetadata(self):
raise TpzDRMError("Parse Error : Record Names Don't Match")
flags = ord(self.fo.read(1))
nbRecords = ord(self.fo.read(1))
# print nbRecords
for i in range (0,nbRecords) :
record = [bookReadString(self.fo), bookReadString(self.fo)]
self.bookMetadata[record[0]] = record[1]
keyval = bookReadString(self.fo)
content = bookReadString(self.fo)
# print keyval
# print content
self.bookMetadata[keyval] = content
return self.bookMetadata

def getPIDMetaInfo(self):
keysRecord = None
keysRecordRecord = None
if 'keys' in self.bookMetadata:
keysRecord = self.bookMetadata['keys']
if keysRecord in self.bookMetadata:
keysRecordRecord = self.bookMetadata[keysRecord]
keysRecord = self.bookMetadata.get('keys','')
keysRecordRecord = ''
if keysRecord != '':
keylst = keysRecord.split(',')
for keyval in keylst:
keysRecordRecord += self.bookMetadata.get(keyval,'')
return keysRecord, keysRecordRecord

def getBookTitle(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# and import that ZIP into Calibre using its plugin configuration GUI.


__version__ = '2.4'
__version__ = '2.6'

class Unbuffered:
def __init__(self, stream):
Expand Down Expand Up @@ -250,7 +250,7 @@ class K4DeDRM(FileTypePlugin):
Provided by the work of many including DiapDealer, SomeUpdates, IHeartCabbages, CMBDTC, Skindle, DarkReverser, ApprenticeAlf, etc.'
supported_platforms = ['osx', 'windows', 'linux'] # Platforms this plugin will run on
author = 'DiapDealer, SomeUpdates' # The author of this plugin
version = (0, 2, 4) # The version number of this plugin
version = (0, 2, 6) # The version number of this plugin
file_types = set(['prc','mobi','azw','azw1','tpz']) # The file types that this plugin will be applied to
on_import = True # Run this plugin during the import
priority = 210 # run this plugin before mobidedrm, k4pcdedrm, k4dedrm
Expand Down
15 changes: 5 additions & 10 deletions DeDRM_Windows_Application/DeDRM_WinApp/DeDRM_lib/lib/kgenpids.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,11 @@ def pidFromSerial(s, l):

# Parse the EXTH header records and use the Kindle serial number to calculate the book pid.
def getKindlePid(pidlst, rec209, token, serialnum):

if rec209 != None and token != None:
# Compute book PID
pidHash = SHA1(serialnum+rec209+token)
bookPID = encodePID(pidHash)
bookPID = checksumPid(bookPID)
pidlst.append(bookPID)
# Compute book PID
pidHash = SHA1(serialnum+rec209+token)
bookPID = encodePID(pidHash)
bookPID = checksumPid(bookPID)
pidlst.append(bookPID)

# compute fixed pid for old pre 2.5 firmware update pid as well
bookPID = pidFromSerial(serialnum, 7) + "*"
Expand Down Expand Up @@ -276,9 +274,6 @@ def getK4Pids(pidlst, rec209, token, kInfoFile=None):
pidlst.append(devicePID)

# Compute book PID
if rec209 == None or token == None:
print "\nNo EXTH record type 209 or token - Perhaps not a K4 file?"
return pidlst

# Get the kindle account token
kindleAccountToken = getKindleInfoValueForKey("kindle.account.tokens")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
# 0.25 - Fixed support for 'BOOKMOBI' type 1 encryption
# 0.26 - Now enables Text-To-Speech flag and sets clipping limit to 100%
# 0.27 - Correct pid metadata token generation to match that used by skindle (Thank You Bart!)
# 0.28 - slight additional changes to metadata token generation (None -> '')

__version__ = '0.27'
__version__ = '0.28'

import sys

Expand Down Expand Up @@ -237,12 +238,11 @@ def getBookTitle(self):
return title

def getPIDMetaInfo(self):
rec209 = None
token = None
rec209 = ''
token = ''
if 209 in self.meta_array:
rec209 = self.meta_array[209]
data = rec209
token = ''
# The 209 data comes in five byte groups. Interpret the last four bytes
# of each group as a big endian unsigned integer to get a key value
# if that key exists in the meta_array, append its contents to the token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,22 @@ def parseMetadata(self):
raise TpzDRMError("Parse Error : Record Names Don't Match")
flags = ord(self.fo.read(1))
nbRecords = ord(self.fo.read(1))
# print nbRecords
for i in range (0,nbRecords) :
record = [bookReadString(self.fo), bookReadString(self.fo)]
self.bookMetadata[record[0]] = record[1]
keyval = bookReadString(self.fo)
content = bookReadString(self.fo)
# print keyval
# print content
self.bookMetadata[keyval] = content
return self.bookMetadata

def getPIDMetaInfo(self):
keysRecord = None
keysRecordRecord = None
if 'keys' in self.bookMetadata:
keysRecord = self.bookMetadata['keys']
if keysRecord in self.bookMetadata:
keysRecordRecord = self.bookMetadata[keysRecord]
keysRecord = self.bookMetadata.get('keys','')
keysRecordRecord = ''
if keysRecord != '':
keylst = keysRecord.split(',')
for keyval in keylst:
keysRecordRecord += self.bookMetadata.get(keyval,'')
return keysRecord, keysRecordRecord

def getBookTitle(self):
Expand Down
2 changes: 1 addition & 1 deletion DeDRM_Windows_Application/ReadMe_DeDRM_WinApp.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ReadMe_DeDRM_WinApp_v1.5
ReadMe_DeDRM_WinApp_vX.X
-----------------------

DeDRM_WinApp is a pure python drag and drop application that allows users to drag and drop ebooks or folders of ebooks onto theDeDRM_Drop_Target to have the DRM removed. It repackages the"tools" python software in one easy to use program.
Expand Down
4 changes: 2 additions & 2 deletions KindleBooks_Tools/KindleBooks/lib/k4mobidedrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# and import that ZIP into Calibre using its plugin configuration GUI.


__version__ = '2.4'
__version__ = '2.6'

class Unbuffered:
def __init__(self, stream):
Expand Down Expand Up @@ -250,7 +250,7 @@ class K4DeDRM(FileTypePlugin):
Provided by the work of many including DiapDealer, SomeUpdates, IHeartCabbages, CMBDTC, Skindle, DarkReverser, ApprenticeAlf, etc.'
supported_platforms = ['osx', 'windows', 'linux'] # Platforms this plugin will run on
author = 'DiapDealer, SomeUpdates' # The author of this plugin
version = (0, 2, 4) # The version number of this plugin
version = (0, 2, 6) # The version number of this plugin
file_types = set(['prc','mobi','azw','azw1','tpz']) # The file types that this plugin will be applied to
on_import = True # Run this plugin during the import
priority = 210 # run this plugin before mobidedrm, k4pcdedrm, k4dedrm
Expand Down
15 changes: 5 additions & 10 deletions KindleBooks_Tools/KindleBooks/lib/kgenpids.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,11 @@ def pidFromSerial(s, l):

# Parse the EXTH header records and use the Kindle serial number to calculate the book pid.
def getKindlePid(pidlst, rec209, token, serialnum):

if rec209 != None and token != None:
# Compute book PID
pidHash = SHA1(serialnum+rec209+token)
bookPID = encodePID(pidHash)
bookPID = checksumPid(bookPID)
pidlst.append(bookPID)
# Compute book PID
pidHash = SHA1(serialnum+rec209+token)
bookPID = encodePID(pidHash)
bookPID = checksumPid(bookPID)
pidlst.append(bookPID)

# compute fixed pid for old pre 2.5 firmware update pid as well
bookPID = pidFromSerial(serialnum, 7) + "*"
Expand Down Expand Up @@ -276,9 +274,6 @@ def getK4Pids(pidlst, rec209, token, kInfoFile=None):
pidlst.append(devicePID)

# Compute book PID
if rec209 == None or token == None:
print "\nNo EXTH record type 209 or token - Perhaps not a K4 file?"
return pidlst

# Get the kindle account token
kindleAccountToken = getKindleInfoValueForKey("kindle.account.tokens")
Expand Down
8 changes: 4 additions & 4 deletions KindleBooks_Tools/KindleBooks/lib/mobidedrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
# 0.25 - Fixed support for 'BOOKMOBI' type 1 encryption
# 0.26 - Now enables Text-To-Speech flag and sets clipping limit to 100%
# 0.27 - Correct pid metadata token generation to match that used by skindle (Thank You Bart!)
# 0.28 - slight additional changes to metadata token generation (None -> '')

__version__ = '0.27'
__version__ = '0.28'

import sys

Expand Down Expand Up @@ -237,12 +238,11 @@ def getBookTitle(self):
return title

def getPIDMetaInfo(self):
rec209 = None
token = None
rec209 = ''
token = ''
if 209 in self.meta_array:
rec209 = self.meta_array[209]
data = rec209
token = ''
# The 209 data comes in five byte groups. Interpret the last four bytes
# of each group as a big endian unsigned integer to get a key value
# if that key exists in the meta_array, append its contents to the token
Expand Down
20 changes: 12 additions & 8 deletions KindleBooks_Tools/KindleBooks/lib/topazextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,22 @@ def parseMetadata(self):
raise TpzDRMError("Parse Error : Record Names Don't Match")
flags = ord(self.fo.read(1))
nbRecords = ord(self.fo.read(1))
# print nbRecords
for i in range (0,nbRecords) :
record = [bookReadString(self.fo), bookReadString(self.fo)]
self.bookMetadata[record[0]] = record[1]
keyval = bookReadString(self.fo)
content = bookReadString(self.fo)
# print keyval
# print content
self.bookMetadata[keyval] = content
return self.bookMetadata

def getPIDMetaInfo(self):
keysRecord = None
keysRecordRecord = None
if 'keys' in self.bookMetadata:
keysRecord = self.bookMetadata['keys']
if keysRecord in self.bookMetadata:
keysRecordRecord = self.bookMetadata[keysRecord]
keysRecord = self.bookMetadata.get('keys','')
keysRecordRecord = ''
if keysRecord != '':
keylst = keysRecord.split(',')
for keyval in keylst:
keysRecordRecord += self.bookMetadata.get(keyval,'')
return keysRecord, keysRecordRecord

def getBookTitle(self):
Expand Down
8 changes: 4 additions & 4 deletions KindleBooks_Tools/Kindle_4_Mac_Unswindle/lib/mobidedrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
# 0.25 - Fixed support for 'BOOKMOBI' type 1 encryption
# 0.26 - Now enables Text-To-Speech flag and sets clipping limit to 100%
# 0.27 - Correct pid metadata token generation to match that used by skindle (Thank You Bart!)
# 0.28 - slight additional changes to metadata token generation (None -> '')

__version__ = '0.27'
__version__ = '0.28'

import sys

Expand Down Expand Up @@ -237,12 +238,11 @@ def getBookTitle(self):
return title

def getPIDMetaInfo(self):
rec209 = None
token = None
rec209 = ''
token = ''
if 209 in self.meta_array:
rec209 = self.meta_array[209]
data = rec209
token = ''
# The 209 data comes in five byte groups. Interpret the last four bytes
# of each group as a big endian unsigned integer to get a key value
# if that key exists in the meta_array, append its contents to the token
Expand Down
Loading

0 comments on commit 427137b

Please sign in to comment.