]> xmof Git - DeDRM.git/commitdiff
Update PDF to use Decimal instead of float to handle very precise numbers. Update...
authorApprentice Harper <apprenticeharper@gmail.com>
Tue, 27 Jun 2017 05:50:24 +0000 (06:50 +0100)
committerApprentice Harper <apprenticeharper@gmail.com>
Tue, 27 Jun 2017 06:05:37 +0000 (07:05 +0100)
23 files changed:
DeDRM_Macintosh_Application/DeDRM.app/Contents/Resources/__init__.py
DeDRM_Macintosh_Application/DeDRM.app/Contents/Resources/ignobleepub.py
DeDRM_Macintosh_Application/DeDRM.app/Contents/Resources/ineptepub.py
DeDRM_Macintosh_Application/DeDRM.app/Contents/Resources/ineptpdf.py
DeDRM_Macintosh_Application/DeDRM.app/Contents/Resources/kindlekey.py
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/DeDRM_App.pyw
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/lib/__init__.py
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/lib/ignobleepub.py
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/lib/ineptepub.py
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/lib/ineptpdf.py
DeDRM_Windows_Application/DeDRM_App/DeDRM_lib/lib/kindlekey.py
DeDRM_calibre_plugin/DeDRM_plugin.zip
DeDRM_calibre_plugin/DeDRM_plugin/__init__.py
DeDRM_calibre_plugin/DeDRM_plugin/ignobleepub.py
DeDRM_calibre_plugin/DeDRM_plugin/ineptepub.py
DeDRM_calibre_plugin/DeDRM_plugin/ineptpdf.py
DeDRM_calibre_plugin/DeDRM_plugin/kindlekey.py
FAQs.md
Obok_calibre_plugin/obok_plugin.zip
Obok_calibre_plugin/obok_plugin/__init__.py
Obok_calibre_plugin/obok_plugin/obok/obok.py
Other_Tools/DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw
ReadMe_First.txt

index 6fffb409c6ba3c90b8742d8ecb2d6ae8bdc04ba6..4592aabb06d931b8601258c82db3d20c38c85b64 100644 (file)
@@ -57,6 +57,7 @@ __docformat__ = 'restructuredtext en'
 #   6.5.1 - Updated version number, added PDF check for DRM-free documents
 #   6.5.2 - Another Topaz fix
 #   6.5.3 - Warn about KFX files explicitly
+#   6.5.4 - Mac App Fix, improve PDF decryption, handle latest tcl changes in ActivePython
 
 
 """
@@ -64,7 +65,7 @@ Decrypt DRMed ebooks.
 """
 
 PLUGIN_NAME = u"DeDRM"
-PLUGIN_VERSION_TUPLE = (6, 5, 3)
+PLUGIN_VERSION_TUPLE = (6, 5, 4)
 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 ac73d1ee30f7fa0abe572d59e9e487dae2dc60b1..1dda1168526276ce6b5188a7141b8e6df87e8f10 100644 (file)
@@ -3,13 +3,14 @@
 
 from __future__ import with_statement
 
-# ignobleepub.pyw, version 3.8
+# ignobleepub.pyw, version 4.1
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2013 by some_updates, DiapDealer and Apprentice Alf
+# Modified 2015–2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.6
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -35,13 +36,14 @@ from __future__ import with_statement
 #   3.8 - Fixed to retain zip file metadata (e.g. file modification date)
 #   3.9 - moved unicode_argv call inside main for Windows DeDRM compatibility
 #   4.0 - Work if TkInter is missing
+#   4.1 - Import tkFileDialog, don't assume something else will import it.
 
 """
 Decrypt Barnes & Noble encrypted ePub books.
 """
 
 __license__ = 'GPL v3'
-__version__ = "4.0"
+__version__ = "4.1"
 
 import sys
 import os
@@ -337,6 +339,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index db3e54b11c436908ac145ecb1f82717284e8895c..ae30c04cf96a8fe41fb152774be6f075c6149e37 100644 (file)
@@ -3,14 +3,14 @@
 
 from __future__ import with_statement
 
-# ineptepub.pyw, version 6.5
+# ineptepub.pyw, version 6.6
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2013 by some_updates, DiapDealer and Apprentice Alf
-# Modified 2015–2016 by Apprentice Harper
+# Modified 2015–2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.7
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -42,13 +42,14 @@ from __future__ import with_statement
 #   6.3 - Add additional check on DER file sanity
 #   6.4 - Remove erroneous check on DER file sanity
 #   6.5 - Completely remove erroneous check on DER file sanity
+#   6.6 - Import tkFileDialog, don't assume something else will import it.
 
 """
 Decrypt Adobe Digital Editions encrypted ePub books.
 """
 
 __license__ = 'GPL v3'
-__version__ = "6.5"
+__version__ = "6.6"
 
 import sys
 import os
@@ -484,6 +485,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index 6de86719cd576227461f56d5f24ec914edf97114..0da29936c522c966884ab9424414ca0f700c4539 100644 (file)
@@ -3,14 +3,14 @@
 
 from __future__ import with_statement
 
-# ineptpdf.pyw, version 8.0.4
+# ineptpdf.pyw, version 8.0.6
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2012 by some_updates, DiapDealer and Apprentice Alf
-# Modified 2015-2016 by Apprentice Harper
+# Modified 2015-2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.7
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -58,6 +58,7 @@ from __future__ import with_statement
 #   8.0.3 - Remove erroneous check on DER file sanity
 #   8.0.4 - Completely remove erroneous check on DER file sanity
 #   8.0.5 - Do not process DRM-free documents
+#   8.0.6 - Replace use of float by Decimal for greater precision, and import tkFileDialog
 
 
 """
@@ -65,7 +66,7 @@ Decrypts Adobe ADEPT-encrypted PDF files.
 """
 
 __license__ = 'GPL v3'
-__version__ = "8.0.5"
+__version__ = "8.0.6"
 
 import sys
 import os
@@ -73,6 +74,7 @@ import re
 import zlib
 import struct
 import hashlib
+from decimal import *
 from itertools import chain, islice
 import xml.etree.ElementTree as etree
 
@@ -653,7 +655,7 @@ class PSBaseParser(object):
             return (self.parse_number, j+1)
         if c == '.':
             self.token = c
-            return (self.parse_float, j+1)
+            return (self.parse_decimal, j+1)
         if c.isalpha():
             self.token = c
             return (self.parse_keyword, j+1)
@@ -718,20 +720,21 @@ class PSBaseParser(object):
         c = s[j]
         if c == '.':
             self.token += c
-            return (self.parse_float, j+1)
+            return (self.parse_decimal, j+1)
         try:
             self.add_token(int(self.token))
         except ValueError:
             pass
         return (self.parse_main, j)
-    def parse_float(self, s, i):
+        
+    def parse_decimal(self, s, i):
         m = END_NUMBER.search(s, i)
         if not m:
             self.token += s[i:]
-            return (self.parse_float, len(s))
+            return (self.parse_decimal, len(s))
         j = m.start(0)
         self.token += s[i:j]
-        self.add_token(float(self.token))
+        self.add_token(Decimal(self.token))
         return (self.parse_main, j)
 
     def parse_keyword(self, s, i):
@@ -933,7 +936,7 @@ class PSStackParser(PSBaseParser):
             (pos, token) = self.nexttoken()
             ##print (pos,token), (self.curtype, self.curstack)
             if (isinstance(token, int) or
-                    isinstance(token, float) or
+                    isinstance(token, Decimal) or
                     isinstance(token, bool) or
                     isinstance(token, str) or
                     isinstance(token, PSLiteral)):
@@ -1062,17 +1065,17 @@ def int_value(x):
         return 0
     return x
 
-def float_value(x):
+def decimal_value(x):
     x = resolve1(x)
-    if not isinstance(x, float):
+    if not isinstance(x, Decimal):
         if STRICT:
-            raise PDFTypeError('Float required: %r' % x)
+            raise PDFTypeError('Decimal required: %r' % x)
         return 0.0
     return x
 
 def num_value(x):
     x = resolve1(x)
-    if not (isinstance(x, int) or isinstance(x, float)):
+    if not (isinstance(x, int) or isinstance(x, Decimal)):
         if STRICT:
             raise PDFTypeError('Int or Float required: %r' % x)
         return 0
@@ -2142,7 +2145,11 @@ class PDFSerializer(object):
             if self.last.isalnum():
                 self.write(' ')
             self.write(str(obj).lower())
-        elif isinstance(obj, (int, long, float)):
+        elif isinstance(obj, (int, long)):
+            if self.last.isalnum():
+                self.write(' ')
+            self.write(str(obj))
+        elif isinstance(obj, Decimal):
             if self.last.isalnum():
                 self.write(' ')
             self.write(str(obj))
@@ -2218,6 +2225,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index 493f950c2a748bfa97b44e97d9c16668bb306448..376dbf5deb07a4e30b71f661ac4ccbf9019bf230 100644 (file)
@@ -4,7 +4,7 @@
 from __future__ import with_statement
 
 # kindlekey.py
-# Copyright © 2010-2016 by some_updates, Apprentice Alf and Apprentice Harper
+# Copyright © 2010-2017 by some_updates, Apprentice Alf and Apprentice Harper
 
 # Revision history:
 #  1.0   - Kindle info file decryption, extracted from k4mobidedrm, etc.
@@ -22,6 +22,7 @@ from __future__ import with_statement
 #  2.1   - Fixed Kindle for PC encryption changes March 2016
 #  2.2   - Fixes for Macs with bonded ethernet ports
 #          Also removed old .kinfo file support (pre-2011)
+#  2.3   - Added more field names thanks to concavegit's KFX code.
 
 
 """
@@ -29,7 +30,7 @@ Retrieve Kindle for PC/Mac user key.
 """
 
 __license__ = 'GPL v3'
-__version__ = '2.2'
+__version__ = '2.3'
 
 import sys, os, re
 from struct import pack, unpack, unpack_from
@@ -1010,8 +1011,11 @@ if iswindows:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
-
         DB = {}
         with open(kInfoFile, 'rb') as infoReader:
             data = infoReader.read()
@@ -1447,6 +1451,10 @@ elif isosx:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
         with open(kInfoFile, 'rb') as infoReader:
             filedata = infoReader.read()
index f4864f8e51bda88c275766cf083f5df7972a4997..22e20e658129d4d02244e70cac4bf0130431b459 100644 (file)
@@ -29,8 +29,9 @@
 #   6.5.1 - Version bump to match plugin & Mac app
 #   6.5.2 - Fix for a new tag in Topaz ebooks
 #   6.5.3 - Explicitly warn about KFX files
+#   6.5.4 - PDF float fix.
 
-__version__ = '6.5.3'
+__version__ = '6.5.4'
 
 import sys
 import os, os.path
index 6fffb409c6ba3c90b8742d8ecb2d6ae8bdc04ba6..4592aabb06d931b8601258c82db3d20c38c85b64 100644 (file)
@@ -57,6 +57,7 @@ __docformat__ = 'restructuredtext en'
 #   6.5.1 - Updated version number, added PDF check for DRM-free documents
 #   6.5.2 - Another Topaz fix
 #   6.5.3 - Warn about KFX files explicitly
+#   6.5.4 - Mac App Fix, improve PDF decryption, handle latest tcl changes in ActivePython
 
 
 """
@@ -64,7 +65,7 @@ Decrypt DRMed ebooks.
 """
 
 PLUGIN_NAME = u"DeDRM"
-PLUGIN_VERSION_TUPLE = (6, 5, 3)
+PLUGIN_VERSION_TUPLE = (6, 5, 4)
 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 ac73d1ee30f7fa0abe572d59e9e487dae2dc60b1..1dda1168526276ce6b5188a7141b8e6df87e8f10 100644 (file)
@@ -3,13 +3,14 @@
 
 from __future__ import with_statement
 
-# ignobleepub.pyw, version 3.8
+# ignobleepub.pyw, version 4.1
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2013 by some_updates, DiapDealer and Apprentice Alf
+# Modified 2015–2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.6
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -35,13 +36,14 @@ from __future__ import with_statement
 #   3.8 - Fixed to retain zip file metadata (e.g. file modification date)
 #   3.9 - moved unicode_argv call inside main for Windows DeDRM compatibility
 #   4.0 - Work if TkInter is missing
+#   4.1 - Import tkFileDialog, don't assume something else will import it.
 
 """
 Decrypt Barnes & Noble encrypted ePub books.
 """
 
 __license__ = 'GPL v3'
-__version__ = "4.0"
+__version__ = "4.1"
 
 import sys
 import os
@@ -337,6 +339,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index db3e54b11c436908ac145ecb1f82717284e8895c..ae30c04cf96a8fe41fb152774be6f075c6149e37 100644 (file)
@@ -3,14 +3,14 @@
 
 from __future__ import with_statement
 
-# ineptepub.pyw, version 6.5
+# ineptepub.pyw, version 6.6
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2013 by some_updates, DiapDealer and Apprentice Alf
-# Modified 2015–2016 by Apprentice Harper
+# Modified 2015–2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.7
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -42,13 +42,14 @@ from __future__ import with_statement
 #   6.3 - Add additional check on DER file sanity
 #   6.4 - Remove erroneous check on DER file sanity
 #   6.5 - Completely remove erroneous check on DER file sanity
+#   6.6 - Import tkFileDialog, don't assume something else will import it.
 
 """
 Decrypt Adobe Digital Editions encrypted ePub books.
 """
 
 __license__ = 'GPL v3'
-__version__ = "6.5"
+__version__ = "6.6"
 
 import sys
 import os
@@ -484,6 +485,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index 6de86719cd576227461f56d5f24ec914edf97114..0da29936c522c966884ab9424414ca0f700c4539 100644 (file)
@@ -3,14 +3,14 @@
 
 from __future__ import with_statement
 
-# ineptpdf.pyw, version 8.0.4
+# ineptpdf.pyw, version 8.0.6
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2012 by some_updates, DiapDealer and Apprentice Alf
-# Modified 2015-2016 by Apprentice Harper
+# Modified 2015-2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.7
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -58,6 +58,7 @@ from __future__ import with_statement
 #   8.0.3 - Remove erroneous check on DER file sanity
 #   8.0.4 - Completely remove erroneous check on DER file sanity
 #   8.0.5 - Do not process DRM-free documents
+#   8.0.6 - Replace use of float by Decimal for greater precision, and import tkFileDialog
 
 
 """
@@ -65,7 +66,7 @@ Decrypts Adobe ADEPT-encrypted PDF files.
 """
 
 __license__ = 'GPL v3'
-__version__ = "8.0.5"
+__version__ = "8.0.6"
 
 import sys
 import os
@@ -73,6 +74,7 @@ import re
 import zlib
 import struct
 import hashlib
+from decimal import *
 from itertools import chain, islice
 import xml.etree.ElementTree as etree
 
@@ -653,7 +655,7 @@ class PSBaseParser(object):
             return (self.parse_number, j+1)
         if c == '.':
             self.token = c
-            return (self.parse_float, j+1)
+            return (self.parse_decimal, j+1)
         if c.isalpha():
             self.token = c
             return (self.parse_keyword, j+1)
@@ -718,20 +720,21 @@ class PSBaseParser(object):
         c = s[j]
         if c == '.':
             self.token += c
-            return (self.parse_float, j+1)
+            return (self.parse_decimal, j+1)
         try:
             self.add_token(int(self.token))
         except ValueError:
             pass
         return (self.parse_main, j)
-    def parse_float(self, s, i):
+        
+    def parse_decimal(self, s, i):
         m = END_NUMBER.search(s, i)
         if not m:
             self.token += s[i:]
-            return (self.parse_float, len(s))
+            return (self.parse_decimal, len(s))
         j = m.start(0)
         self.token += s[i:j]
-        self.add_token(float(self.token))
+        self.add_token(Decimal(self.token))
         return (self.parse_main, j)
 
     def parse_keyword(self, s, i):
@@ -933,7 +936,7 @@ class PSStackParser(PSBaseParser):
             (pos, token) = self.nexttoken()
             ##print (pos,token), (self.curtype, self.curstack)
             if (isinstance(token, int) or
-                    isinstance(token, float) or
+                    isinstance(token, Decimal) or
                     isinstance(token, bool) or
                     isinstance(token, str) or
                     isinstance(token, PSLiteral)):
@@ -1062,17 +1065,17 @@ def int_value(x):
         return 0
     return x
 
-def float_value(x):
+def decimal_value(x):
     x = resolve1(x)
-    if not isinstance(x, float):
+    if not isinstance(x, Decimal):
         if STRICT:
-            raise PDFTypeError('Float required: %r' % x)
+            raise PDFTypeError('Decimal required: %r' % x)
         return 0.0
     return x
 
 def num_value(x):
     x = resolve1(x)
-    if not (isinstance(x, int) or isinstance(x, float)):
+    if not (isinstance(x, int) or isinstance(x, Decimal)):
         if STRICT:
             raise PDFTypeError('Int or Float required: %r' % x)
         return 0
@@ -2142,7 +2145,11 @@ class PDFSerializer(object):
             if self.last.isalnum():
                 self.write(' ')
             self.write(str(obj).lower())
-        elif isinstance(obj, (int, long, float)):
+        elif isinstance(obj, (int, long)):
+            if self.last.isalnum():
+                self.write(' ')
+            self.write(str(obj))
+        elif isinstance(obj, Decimal):
             if self.last.isalnum():
                 self.write(' ')
             self.write(str(obj))
@@ -2218,6 +2225,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index 493f950c2a748bfa97b44e97d9c16668bb306448..376dbf5deb07a4e30b71f661ac4ccbf9019bf230 100644 (file)
@@ -4,7 +4,7 @@
 from __future__ import with_statement
 
 # kindlekey.py
-# Copyright © 2010-2016 by some_updates, Apprentice Alf and Apprentice Harper
+# Copyright © 2010-2017 by some_updates, Apprentice Alf and Apprentice Harper
 
 # Revision history:
 #  1.0   - Kindle info file decryption, extracted from k4mobidedrm, etc.
@@ -22,6 +22,7 @@ from __future__ import with_statement
 #  2.1   - Fixed Kindle for PC encryption changes March 2016
 #  2.2   - Fixes for Macs with bonded ethernet ports
 #          Also removed old .kinfo file support (pre-2011)
+#  2.3   - Added more field names thanks to concavegit's KFX code.
 
 
 """
@@ -29,7 +30,7 @@ Retrieve Kindle for PC/Mac user key.
 """
 
 __license__ = 'GPL v3'
-__version__ = '2.2'
+__version__ = '2.3'
 
 import sys, os, re
 from struct import pack, unpack, unpack_from
@@ -1010,8 +1011,11 @@ if iswindows:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
-
         DB = {}
         with open(kInfoFile, 'rb') as infoReader:
             data = infoReader.read()
@@ -1447,6 +1451,10 @@ elif isosx:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
         with open(kInfoFile, 'rb') as infoReader:
             filedata = infoReader.read()
index 16233372f66c20325dacb1ce8c55131fecbdbc49..b1388dacbf6e2436ab342f95457f11917493b772 100644 (file)
Binary files a/DeDRM_calibre_plugin/DeDRM_plugin.zip and b/DeDRM_calibre_plugin/DeDRM_plugin.zip differ
index 6fffb409c6ba3c90b8742d8ecb2d6ae8bdc04ba6..4592aabb06d931b8601258c82db3d20c38c85b64 100644 (file)
@@ -57,6 +57,7 @@ __docformat__ = 'restructuredtext en'
 #   6.5.1 - Updated version number, added PDF check for DRM-free documents
 #   6.5.2 - Another Topaz fix
 #   6.5.3 - Warn about KFX files explicitly
+#   6.5.4 - Mac App Fix, improve PDF decryption, handle latest tcl changes in ActivePython
 
 
 """
@@ -64,7 +65,7 @@ Decrypt DRMed ebooks.
 """
 
 PLUGIN_NAME = u"DeDRM"
-PLUGIN_VERSION_TUPLE = (6, 5, 3)
+PLUGIN_VERSION_TUPLE = (6, 5, 4)
 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 ac73d1ee30f7fa0abe572d59e9e487dae2dc60b1..1dda1168526276ce6b5188a7141b8e6df87e8f10 100644 (file)
@@ -3,13 +3,14 @@
 
 from __future__ import with_statement
 
-# ignobleepub.pyw, version 3.8
+# ignobleepub.pyw, version 4.1
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2013 by some_updates, DiapDealer and Apprentice Alf
+# Modified 2015–2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.6
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -35,13 +36,14 @@ from __future__ import with_statement
 #   3.8 - Fixed to retain zip file metadata (e.g. file modification date)
 #   3.9 - moved unicode_argv call inside main for Windows DeDRM compatibility
 #   4.0 - Work if TkInter is missing
+#   4.1 - Import tkFileDialog, don't assume something else will import it.
 
 """
 Decrypt Barnes & Noble encrypted ePub books.
 """
 
 __license__ = 'GPL v3'
-__version__ = "4.0"
+__version__ = "4.1"
 
 import sys
 import os
@@ -337,6 +339,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index db3e54b11c436908ac145ecb1f82717284e8895c..ae30c04cf96a8fe41fb152774be6f075c6149e37 100644 (file)
@@ -3,14 +3,14 @@
 
 from __future__ import with_statement
 
-# ineptepub.pyw, version 6.5
+# ineptepub.pyw, version 6.6
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2013 by some_updates, DiapDealer and Apprentice Alf
-# Modified 2015–2016 by Apprentice Harper
+# Modified 2015–2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.7
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -42,13 +42,14 @@ from __future__ import with_statement
 #   6.3 - Add additional check on DER file sanity
 #   6.4 - Remove erroneous check on DER file sanity
 #   6.5 - Completely remove erroneous check on DER file sanity
+#   6.6 - Import tkFileDialog, don't assume something else will import it.
 
 """
 Decrypt Adobe Digital Editions encrypted ePub books.
 """
 
 __license__ = 'GPL v3'
-__version__ = "6.5"
+__version__ = "6.6"
 
 import sys
 import os
@@ -484,6 +485,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index 6de86719cd576227461f56d5f24ec914edf97114..0da29936c522c966884ab9424414ca0f700c4539 100644 (file)
@@ -3,14 +3,14 @@
 
 from __future__ import with_statement
 
-# ineptpdf.pyw, version 8.0.4
+# ineptpdf.pyw, version 8.0.6
 # Copyright © 2009-2010 by i♥cabbages
 
 # Released under the terms of the GNU General Public Licence, version 3
 # <http://www.gnu.org/licenses/>
 
 # Modified 2010–2012 by some_updates, DiapDealer and Apprentice Alf
-# Modified 2015-2016 by Apprentice Harper
+# Modified 2015-2017 by Apprentice Harper
 
 # Windows users: Before running this program, you must first install Python 2.7
 #   from <http://www.python.org/download/> and PyCrypto from
@@ -58,6 +58,7 @@ from __future__ import with_statement
 #   8.0.3 - Remove erroneous check on DER file sanity
 #   8.0.4 - Completely remove erroneous check on DER file sanity
 #   8.0.5 - Do not process DRM-free documents
+#   8.0.6 - Replace use of float by Decimal for greater precision, and import tkFileDialog
 
 
 """
@@ -65,7 +66,7 @@ Decrypts Adobe ADEPT-encrypted PDF files.
 """
 
 __license__ = 'GPL v3'
-__version__ = "8.0.5"
+__version__ = "8.0.6"
 
 import sys
 import os
@@ -73,6 +74,7 @@ import re
 import zlib
 import struct
 import hashlib
+from decimal import *
 from itertools import chain, islice
 import xml.etree.ElementTree as etree
 
@@ -653,7 +655,7 @@ class PSBaseParser(object):
             return (self.parse_number, j+1)
         if c == '.':
             self.token = c
-            return (self.parse_float, j+1)
+            return (self.parse_decimal, j+1)
         if c.isalpha():
             self.token = c
             return (self.parse_keyword, j+1)
@@ -718,20 +720,21 @@ class PSBaseParser(object):
         c = s[j]
         if c == '.':
             self.token += c
-            return (self.parse_float, j+1)
+            return (self.parse_decimal, j+1)
         try:
             self.add_token(int(self.token))
         except ValueError:
             pass
         return (self.parse_main, j)
-    def parse_float(self, s, i):
+        
+    def parse_decimal(self, s, i):
         m = END_NUMBER.search(s, i)
         if not m:
             self.token += s[i:]
-            return (self.parse_float, len(s))
+            return (self.parse_decimal, len(s))
         j = m.start(0)
         self.token += s[i:j]
-        self.add_token(float(self.token))
+        self.add_token(Decimal(self.token))
         return (self.parse_main, j)
 
     def parse_keyword(self, s, i):
@@ -933,7 +936,7 @@ class PSStackParser(PSBaseParser):
             (pos, token) = self.nexttoken()
             ##print (pos,token), (self.curtype, self.curstack)
             if (isinstance(token, int) or
-                    isinstance(token, float) or
+                    isinstance(token, Decimal) or
                     isinstance(token, bool) or
                     isinstance(token, str) or
                     isinstance(token, PSLiteral)):
@@ -1062,17 +1065,17 @@ def int_value(x):
         return 0
     return x
 
-def float_value(x):
+def decimal_value(x):
     x = resolve1(x)
-    if not isinstance(x, float):
+    if not isinstance(x, Decimal):
         if STRICT:
-            raise PDFTypeError('Float required: %r' % x)
+            raise PDFTypeError('Decimal required: %r' % x)
         return 0.0
     return x
 
 def num_value(x):
     x = resolve1(x)
-    if not (isinstance(x, int) or isinstance(x, float)):
+    if not (isinstance(x, int) or isinstance(x, Decimal)):
         if STRICT:
             raise PDFTypeError('Int or Float required: %r' % x)
         return 0
@@ -2142,7 +2145,11 @@ class PDFSerializer(object):
             if self.last.isalnum():
                 self.write(' ')
             self.write(str(obj).lower())
-        elif isinstance(obj, (int, long, float)):
+        elif isinstance(obj, (int, long)):
+            if self.last.isalnum():
+                self.write(' ')
+            self.write(str(obj))
+        elif isinstance(obj, Decimal):
             if self.last.isalnum():
                 self.write(' ')
             self.write(str(obj))
@@ -2218,6 +2225,7 @@ def gui_main():
     try:
         import Tkinter
         import Tkconstants
+        import tkFileDialog
         import tkMessageBox
         import traceback
     except:
index 493f950c2a748bfa97b44e97d9c16668bb306448..376dbf5deb07a4e30b71f661ac4ccbf9019bf230 100644 (file)
@@ -4,7 +4,7 @@
 from __future__ import with_statement
 
 # kindlekey.py
-# Copyright © 2010-2016 by some_updates, Apprentice Alf and Apprentice Harper
+# Copyright © 2010-2017 by some_updates, Apprentice Alf and Apprentice Harper
 
 # Revision history:
 #  1.0   - Kindle info file decryption, extracted from k4mobidedrm, etc.
@@ -22,6 +22,7 @@ from __future__ import with_statement
 #  2.1   - Fixed Kindle for PC encryption changes March 2016
 #  2.2   - Fixes for Macs with bonded ethernet ports
 #          Also removed old .kinfo file support (pre-2011)
+#  2.3   - Added more field names thanks to concavegit's KFX code.
 
 
 """
@@ -29,7 +30,7 @@ Retrieve Kindle for PC/Mac user key.
 """
 
 __license__ = 'GPL v3'
-__version__ = '2.2'
+__version__ = '2.3'
 
 import sys, os, re
 from struct import pack, unpack, unpack_from
@@ -1010,8 +1011,11 @@ if iswindows:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
-
         DB = {}
         with open(kInfoFile, 'rb') as infoReader:
             data = infoReader.read()
@@ -1447,6 +1451,10 @@ elif isosx:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
         with open(kInfoFile, 'rb') as infoReader:
             filedata = infoReader.read()
diff --git a/FAQs.md b/FAQs.md
index dcfba7f5afbb522806e9c14b827873fa23166218..46b280c325cb240532b48564b7b83db0586b84a2 100644 (file)
--- a/FAQs.md
+++ b/FAQs.md
@@ -56,7 +56,7 @@ We strongly recommend renaming the DeDRM\_tools\_X.X.X.zip archive (after extrac
 
 ## The Windows Application
 ### I've installed ActiveState Python and PyCrypto, but the Windows application won't run. What have I done wrong?
-Nothing. There's a bug in the current ActiveState Python Windows installer that puts the Tcl code in the wrong place. See [this comment of mine at ActiveState community](https://community.activestate.com/node/19090). Just move the Tcl code to the correct place manually and the Windows app should run.
+Nothing. There's a bug in the some older ActiveState Python Windows installers that puts the Tcl code in the wrong place. See [this comment of mine at ActiveState community](https://community.activestate.com/node/19090). Just move the Tcl code to the correct place manually and the Windows app should run.
 
 ## The Macintosh Application
 ### I can't open the Macintosh Application. Some message about it not being signed or something.
index 9cb32b18facb77a5ef39a0a8d2a466dae7f4616e..0c7e19ee8d95d5242cfe6c8310d120a08d975f8b 100644 (file)
Binary files a/Obok_calibre_plugin/obok_plugin.zip and b/Obok_calibre_plugin/obok_plugin.zip differ
index d652af57a78a5ea23e098ea9c08129a01f56db24..b678f06cea64ceb08f154f954ba6ea9622b10d6c 100644 (file)
@@ -19,7 +19,7 @@ except NameError:
 PLUGIN_NAME = 'Obok DeDRM'
 PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_')
 PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.')
-PLUGIN_VERSION_TUPLE = (6, 5, 3)
+PLUGIN_VERSION_TUPLE = (6, 5, 4)
 PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE])
 HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm'
 PLUGIN_AUTHORS = 'Anon'
index d2188e36e0859b853ce10a0a1a1a43171c344037..033c67a3f018de0ff1a869c8314cd37a826633f1 100644 (file)
@@ -665,41 +665,16 @@ class KoboFile(object):
             contents = contents[:-padding]
         return contents
 
-def cli_main():
-    description = __about__
-    epilog = u"Parsing of arguments failed."
-    parser = argparse.ArgumentParser(prog=sys.argv[0], description=description, epilog=epilog)
-    parser.add_argument('--devicedir', default='/media/KOBOeReader', help="directory of connected Kobo device")
-    args = vars(parser.parse_args())
-    serials = []
-    devicedir = u""
-    if args['devicedir']:
-        devicedir = args['devicedir']
-
-    lib = KoboLibrary(serials, devicedir)
-
-    for i, book in enumerate(lib.books):
-        print u"{0}: {1}".format(i + 1, book.title)
-
-    num_string = raw_input(u"Convert book number... ")
-    try:
-        num = int(num_string)
-        book = lib.books[num - 1]
-    except (ValueError, IndexError):
-        exit()
-
+def decrypt_book(book, lib):
     print u"Converting {0}".format(book.title)
-
     zin = zipfile.ZipFile(book.filename, "r")
     # make filename out of Unicode alphanumeric and whitespace equivalents from title
     outname = u"{0}.epub".format(re.sub('[^\s\w]', '_', book.title, 0, re.UNICODE))
-
     if (book.type == 'drm-free'):
         print u"DRM-free book, conversion is not needed"
         shutil.copyfile(book.filename, outname)
         print u"Book saved as {0}".format(os.path.join(os.getcwd(), outname))
-        exit(0)
-
+        return 0
     result = 1
     for userkey in lib.userkeys:
         print u"Trying key: {0}".format(userkey.encode('hex_codec'))
@@ -722,12 +697,49 @@ def cli_main():
             print u"Decryption failed."
             zout.close()
             os.remove(outname)
-
     zin.close()
+    return result
+
+
+def cli_main():
+    description = __about__
+    epilog = u"Parsing of arguments failed."
+    parser = argparse.ArgumentParser(prog=sys.argv[0], description=description, epilog=epilog)
+    parser.add_argument('--devicedir', default='/media/KOBOeReader', help="directory of connected Kobo device")
+    parser.add_argument('--all', action='store_true', help="flag for converting all books on device")
+    args = vars(parser.parse_args())
+    serials = []
+    devicedir = u""
+    if args['devicedir']:
+        devicedir = args['devicedir']
+
+    lib = KoboLibrary(serials, devicedir)
+
+    if args['all']:
+        books = lib.books
+    else:
+        for i, book in enumerate(lib.books):
+            print u"{0}: {1}".format(i + 1, book.title)
+        print u"Or 'all'"
+
+        choice = raw_input(u"Convert book number... ")
+        if choice == u'all':
+            books = list(lib.books)
+        else:
+            try:
+                num = int(choice)
+                books = [lib.books[num - 1]]
+            except (ValueError, IndexError):
+                print u"Invalid choice. Exiting..."
+                exit()
+
+    results = [decrypt_book(book, lib) for book in books]
     lib.close()
-    if result != 0:
+    overall_result = all(result != 0 for result in results)
+    if overall_result != 0:
         print u"Could not decrypt book with any of the keys found."
-    return result
+    return overall_result
+
 
 if __name__ == '__main__':
     sys.stdout=SafeUnbuffered(sys.stdout)
index 493f950c2a748bfa97b44e97d9c16668bb306448..376dbf5deb07a4e30b71f661ac4ccbf9019bf230 100644 (file)
@@ -4,7 +4,7 @@
 from __future__ import with_statement
 
 # kindlekey.py
-# Copyright © 2010-2016 by some_updates, Apprentice Alf and Apprentice Harper
+# Copyright © 2010-2017 by some_updates, Apprentice Alf and Apprentice Harper
 
 # Revision history:
 #  1.0   - Kindle info file decryption, extracted from k4mobidedrm, etc.
@@ -22,6 +22,7 @@ from __future__ import with_statement
 #  2.1   - Fixed Kindle for PC encryption changes March 2016
 #  2.2   - Fixes for Macs with bonded ethernet ports
 #          Also removed old .kinfo file support (pre-2011)
+#  2.3   - Added more field names thanks to concavegit's KFX code.
 
 
 """
@@ -29,7 +30,7 @@ Retrieve Kindle for PC/Mac user key.
 """
 
 __license__ = 'GPL v3'
-__version__ = '2.2'
+__version__ = '2.3'
 
 import sys, os, re
 from struct import pack, unpack, unpack_from
@@ -1010,8 +1011,11 @@ if iswindows:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
-
         DB = {}
         with open(kInfoFile, 'rb') as infoReader:
             data = infoReader.read()
@@ -1447,6 +1451,10 @@ elif isosx:
             'max_date',\
             'SIGVERIF',\
             'build_version',\
+            'SerialNumber',\
+            'UsernameHash',\
+            'kindle.directedid.info',\
+            'DSN'
             ]
         with open(kInfoFile, 'rb') as infoReader:
             filedata = infoReader.read()
index 15ab3502d09efc0e8f7180ff8d1044f3c4d6cc21..f2dbd8ae1051f5bf02a85a3942f957e19a6cc138 100644 (file)
@@ -19,9 +19,9 @@ These tools do NOT work with Apple's iBooks FairPlay DRM (see end of this file.)
 
 * With Kindle for PC/Mac 1.19 and later, Amazon included support for their new KFX format which uses a new DRM scheme that these tools cannot remove. Using 1.17 or earlier prevents downloads of the new format.
 
-** Some later Kindles support Amazon's new KFX format which uses a new DRM scheme that these tools cannot remove. To avoid this problem, instead of using files downloaded directly to your Kindle, download from Amazon's web site 'for transfer via USB'. This will give you an older format file that the tools can decrypt.
+** Some later Kindles support Amazon's new KFX format which uses a new DRM scheme that these tools cannot remove. To avoid this problem, instead of using files downloaded directly to your Kindle, download from Amazon's web site 'for transfer via USB'. This will give you an older format file that the tools can decrypt. See also the FAQ entry about this.
 
-*** With Adobe Digital Editions 3.0 and later, Adobe have introduced a new, optional, DRM scheme. To avoid this new scheme, you should use Adobe Digital Editions 2.0.1. Some books are required to use the new DRM scheme and so will not download with ADE 2.0.1. If you still want such a book, you will need to use ADE 3.0 or later to download it, but you should remember that no tools to remove Adobe's new DRM scheme exist as of April 2017.
+*** With Adobe Digital Editions 3.0 and later, Adobe have introduced a new, optional, DRM scheme. To avoid this new scheme, you should use Adobe Digital Editions 2.0.1. Some books are required to use the new DRM scheme and so will not download with ADE 2.0.1. If you still want such a book, you will need to use ADE 3.0 or later to download it, but you should remember that no tools to remove Adobe's new DRM scheme exist as of June 2017.
 
 About the tools
 ---------------
@@ -96,8 +96,6 @@ http://www.activestate.com/activepython/downloads
 
 We do **NOT** recommend the version of Python from python.org as it is missing various Windows specific libraries, does not install the Tk Widget kit (for graphical user interfaces) by default, and does not properly update the system PATH environment variable. Therefore using the default python.org build on Windows is simply an exercise in frustration for most Windows users.
 
-Note that currently (October 2016) ActiveState Python puts the tcl library in the wrong place, and it needs to be manually moved. See this thread at activestate.com for the latest information: https://community.activestate.com/node/19090
-
 In addition, Windows Users need PyCrypto:
 
     There are many places to get PyCrypto installers for Windows. One such place is: