]> xmof Git - DeDRM.git/commitdiff
Topaz fixes to Mac & Windows apps, and version number update
authorApprentice Harper <apprenticeharper@gmail.com>
Mon, 18 Apr 2016 16:39:17 +0000 (17:39 +0100)
committerApprentice Harper <apprenticeharper@gmail.com>
Mon, 18 Apr 2016 16:39:17 +0000 (17:39 +0100)
DeDRM_Macintosh_Application/DeDRM.app/Contents/Info.plist
DeDRM_Macintosh_Application/DeDRM.app/Contents/Resources/convert2xml.py
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/DeDRM_App.pyw
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/lib/convert2xml.py
DeDRM_calibre_plugin/DeDRM_plugin.zip
DeDRM_calibre_plugin/DeDRM_plugin/__init__.py
Other_Tools/DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw

index 0edfc819c802f081b05bbc121b7f21da86f5170e..a5791fe4b503db34460de01af03846e1266e2d0b 100644 (file)
@@ -24,7 +24,7 @@
        <key>CFBundleExecutable</key>
        <string>droplet</string>
        <key>CFBundleGetInfoString</key>
-       <string>DeDRM AppleScript 6.4.1 Written 2010–2016 by Apprentice Alf et al.</string>
+       <string>DeDRM AppleScript 6.4.2 Written 2010–2016 by Apprentice Alf et al.</string>
        <key>CFBundleIconFile</key>
        <string>DeDRM</string>
        <key>CFBundleIdentifier</key>
@@ -36,7 +36,7 @@
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
-       <string>6.4.1</string>
+       <string>6.4.2</string>
        <key>CFBundleSignature</key>
        <string>dplt</string>
        <key>LSRequiresCarbon</key>
index bbb7b045239b1e98577fd97cffa4fe3af711e79e..443dd82f4e7ff5fbe9c3dc4d3ed86e6596f44fb6 100644 (file)
@@ -317,11 +317,16 @@ class PageParser(object):
         'span.gridBeginCenter' : (1, 'scalar_number', 0, 0),
         'span.gridEndCenter' : (1, 'scalar_number', 0, 0),
 
-        'extratokens'            : (1, 'snippets', 1, 0),
-        'extratokens.class'      : (1, 'scalar_text', 0, 0),
-        'extratokens.type'       : (1, 'scalar_text', 0, 0),
-        'extratokens.firstGlyph' : (1, 'scalar_number', 0, 0),
-        'extratokens.lastGlyph'  : (1, 'scalar_number', 0, 0),
+        'extratokens'                   : (1, 'snippets', 1, 0),
+        'extratokens.class'             : (1, 'scalar_text', 0, 0),
+        'extratokens.type'              : (1, 'scalar_text', 0, 0),
+        'extratokens.firstGlyph'        : (1, 'scalar_number', 0, 0),
+        'extratokens.lastGlyph'         : (1, 'scalar_number', 0, 0),
+        'extratokens.gridSize'          : (1, 'scalar_number', 0, 0),
+        'extratokens.gridBottomCenter'  : (1, 'scalar_number', 0, 0),
+        'extratokens.gridTopCenter'     : (1, 'scalar_number', 0, 0),
+        'extratokens.gridBeginCenter'   : (1, 'scalar_number', 0, 0),
+        'extratokens.gridEndCenter'     : (1, 'scalar_number', 0, 0),
 
         'glyph.h'      : (1, 'number', 0, 0),
         'glyph.w'      : (1, 'number', 0, 0),
index 6a2e6c8919264f485cfb3ad9dd74e9d8e050c4d9..6ce141170b4c0968212b0fc237ea1d5205c21b15 100644 (file)
@@ -23,8 +23,9 @@
 #   6.3.6 - Version bump to match plugin
 #   6.4.0 - Fix for Kindle for PC encryption change
 #   6.4.1 - Fix for new tags in Topaz ebooks
+#   6.4.2 - Fix for new tags in Topaz ebooks, and very small Topaz ebooks
 
-__version__ = '6.4.1'
+__version__ = '6.4.2'
 
 import sys
 import os, os.path
index bbb7b045239b1e98577fd97cffa4fe3af711e79e..443dd82f4e7ff5fbe9c3dc4d3ed86e6596f44fb6 100644 (file)
@@ -317,11 +317,16 @@ class PageParser(object):
         'span.gridBeginCenter' : (1, 'scalar_number', 0, 0),
         'span.gridEndCenter' : (1, 'scalar_number', 0, 0),
 
-        'extratokens'            : (1, 'snippets', 1, 0),
-        'extratokens.class'      : (1, 'scalar_text', 0, 0),
-        'extratokens.type'       : (1, 'scalar_text', 0, 0),
-        'extratokens.firstGlyph' : (1, 'scalar_number', 0, 0),
-        'extratokens.lastGlyph'  : (1, 'scalar_number', 0, 0),
+        'extratokens'                   : (1, 'snippets', 1, 0),
+        'extratokens.class'             : (1, 'scalar_text', 0, 0),
+        'extratokens.type'              : (1, 'scalar_text', 0, 0),
+        'extratokens.firstGlyph'        : (1, 'scalar_number', 0, 0),
+        'extratokens.lastGlyph'         : (1, 'scalar_number', 0, 0),
+        'extratokens.gridSize'          : (1, 'scalar_number', 0, 0),
+        'extratokens.gridBottomCenter'  : (1, 'scalar_number', 0, 0),
+        'extratokens.gridTopCenter'     : (1, 'scalar_number', 0, 0),
+        'extratokens.gridBeginCenter'   : (1, 'scalar_number', 0, 0),
+        'extratokens.gridEndCenter'     : (1, 'scalar_number', 0, 0),
 
         'glyph.h'      : (1, 'number', 0, 0),
         'glyph.w'      : (1, 'number', 0, 0),
index de165c15ff8f3067226172a9a725f02de028edfc..ef69a25ba44e816618ab0dc7077f0f5919970096 100644 (file)
Binary files a/DeDRM_calibre_plugin/DeDRM_plugin.zip and b/DeDRM_calibre_plugin/DeDRM_plugin.zip differ
index ddba7a421ff4257a08ffa4263dee08fb8bde5aea..080c19478eafb5523ba08755c190316186fd50a3 100644 (file)
@@ -48,6 +48,7 @@ __docformat__ = 'restructuredtext en'
 #   6.3.6 - Fixes for ADE ePub and PDF introduced in 6.3.5
 #   6.4.0 - Updated for new Kindle for PC encryption
 #   6.4.1 - Fix for some new tags in Topaz ebooks.
+#   6.4.2 - Fix for more new tags in Topaz ebooks and very small Topaz ebooks
 
 
 """
@@ -55,7 +56,7 @@ Decrypt DRMed ebooks.
 """
 
 PLUGIN_NAME = u"DeDRM"
-PLUGIN_VERSION_TUPLE = (6, 4, 1)
+PLUGIN_VERSION_TUPLE = (6, 4, 2)
 PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE])
 # Include an html helpfile in the plugin's zipfile with the following name.
 RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
index a597a26f92aa79e0d6f8ab2d8c16aee7f6f2f415..c5159ccb9404da64c214681500c895afb78c981f 100644 (file)
@@ -993,7 +993,22 @@ if iswindows:
     # determine type of kindle info provided and return a
     # database of keynames and values
     def getDBfromFile(kInfoFile):
-        names = ['kindle.account.tokens','kindle.cookie.item','eulaVersionAccepted','login_date','kindle.token.item','login','kindle.key.item','kindle.name.info','kindle.device.info', 'MazamaRandomNumber', 'max_date', 'SIGVERIF']
+        names = [\
+                       'kindle.account.tokens',\
+                       'kindle.cookie.item',\
+                       'eulaVersionAccepted',\
+                       'login_date',\
+                       'kindle.token.item',\
+                       'login',\
+                       'kindle.key.item',\
+                       'kindle.name.info',\
+                       'kindle.device.info',\
+                       'MazamaRandomNumber',\
+                       'max_date',\
+                       'SIGVERIF',\
+                       'build_version',\
+                       ]
+
         DB = {}
         with open(kInfoFile, 'rb') as infoReader:
             hdr = infoReader.read(1)
@@ -1134,6 +1149,8 @@ if iswindows:
                     if encodeHash(name,testMap8) == keyhash:
                         keyname = name
                         break
+                if keyname == "unknown":
+                    keyname = keyhash
 
                 # the testMap8 encoded contents data has had a length
                 # of chars (always odd) cut off of the front and moved
@@ -1158,14 +1175,17 @@ if iswindows:
                 # decode using new testMap8 to get the original CryptProtect Data
                 encryptedValue = decode(encdata,testMap8)
                 cleartext = CryptUnprotectData(encryptedValue, entropy, 1)
-                DB[keyname] = cleartext
+                if len(cleartext)>0:
+                    DB[keyname] = cleartext
+                #print keyname, cleartext
 
-        if 'kindle.account.tokens' in DB:
+        if len(DB)>4:
             # store values used in decryption
             DB['IDString'] = GetIDString()
             DB['UserName'] = GetUserName()
             print u"Decrypted key file using IDString '{0:s}' and UserName '{1:s}'".format(GetIDString(), GetUserName().encode('hex'))
         else:
+            print u"Couldn't decrypt file."
             DB = {}
         return DB
 elif isosx:
@@ -1577,7 +1597,21 @@ elif isosx:
     # determine type of kindle info provided and return a
     # database of keynames and values
     def getDBfromFile(kInfoFile):
-        names = ['kindle.account.tokens','kindle.cookie.item','eulaVersionAccepted','login_date','kindle.token.item','login','kindle.key.item','kindle.name.info','kindle.device.info', 'MazamaRandomNumber', 'max_date', 'SIGVERIF']
+        names = [\
+                       'kindle.account.tokens',\
+                       'kindle.cookie.item',\
+                       'eulaVersionAccepted',\
+                       'login_date',\
+                       'kindle.token.item',\
+                       'login',\
+                       'kindle.key.item',\
+                       'kindle.name.info',\
+                       'kindle.device.info',\
+                       'MazamaRandomNumber',\
+                       'max_date',\
+                       'SIGVERIF',\
+                       'build_version',\
+                       ]
         with open(kInfoFile, 'rb') as infoReader:
             filehdr = infoReader.read(1)
             filedata = infoReader.read()
@@ -1683,7 +1717,7 @@ elif isosx:
                         if len(cleartext) > 0:
                             DB[keyname] = cleartext
 
-                    if 'MazamaRandomNumber' in DB and 'kindle.account.tokens' in DB:
+                    if len(DB)>4:
                         break
                 else:
                     # the latest .kinf2011 version for K4M 1.9.1
@@ -1772,11 +1806,11 @@ elif isosx:
                         if len(cleartext) > 0:
                             DB[keyname] = cleartext
 
-                    if 'MazamaRandomNumber' in DB and 'kindle.account.tokens' in DB:
+                    if len(DB)>4:
                         break
             except:
                 pass
-        if 'kindle.account.tokens' in DB:
+        if len(DB)>4:
             # store values used in decryption
             print u"Decrypted key file using IDString '{0:s}' and UserName '{1:s}'".format(IDString, GetUserName())
             DB['IDString'] = IDString