Compare commits

..

7 Commits

Author SHA1 Message Date
Apprentice Harper
92ce0396fe Making sure files and versions are consistent 2016-10-07 17:32:13 +01:00
Apprentice Harper
5eb3338423 Update FAQs to point people to new test obok plugin 2016-10-07 07:13:43 +01:00
Apprentice Harper
d65dd1ab87 New obok fix that should work for stand-alone script and non-Windows machines. (Makes a tweaked copy of the database.) 2016-10-07 07:06:22 +01:00
Apprentice Harper
5d75018719 Topaz fix and updated FAQ reference to point to github 2016-09-29 07:01:19 +01:00
Apprentice Harper
1c3a12425e Merge branch 'master' of https://github.com/apprenticeharper/DeDRM_tools 2016-09-28 07:15:06 +01:00
Apprentice Harper
6b4d621159 Fix for Obok Plugin and Obok Desktop v4.0 2016-09-28 07:14:16 +01:00
Apprentice Harper
53c16c916b Note the new Kobo Desktop version
The new Kobo Desktop version breaks the obok plugin.
2016-09-13 06:53:16 +01:00
26 changed files with 124 additions and 57 deletions

View File

@@ -24,7 +24,7 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>droplet</string> <string>droplet</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>DeDRM AppleScript 6.5.1 Written 20102016 by Apprentice Alf et al.</string> <string>DeDRM AppleScript 6.5.2 Written 20102016 by Apprentice Alf et al.</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>DeDRM</string> <string>DeDRM</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@@ -36,7 +36,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>6.5.1</string> <string>6.5.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>dplt</string> <string>dplt</string>
<key>LSRequiresCarbon</key> <key>LSRequiresCarbon</key>

View File

@@ -55,7 +55,7 @@ p {margin-top: 0}
<li>And probably many more.</li> <li>And probably many more.</li>
</ul> </ul>
<h3> For additional help read the <a href="http://apprenticealf.wordpress.com/2011/01/17/frequently-asked-questions-about-the-drm-removal-tools/">FAQs</a> at <a href="http://apprenticealf.wordpress.com">Apprentice Alfs Blog</a> and ask questions in the comments section of the <a href="http://apprenticealf.wordpress.com/2012/09/10/drm-removal-tools-for-ebooks/">first post</a>.</h3> <h3> For additional help read the <a href="https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md">FAQs</a> at <a href="https://github.com/apprenticeharper/DeDRM_tools/">Apprentice Harperss GitHub repository</a>. You can ask questions in the comments section of the <a href="http://apprenticealf.wordpress.com/2012/09/10/drm-removal-tools-for-ebooks/">first post</a> at <a href="http://wordpress.com/apprenticealf/">Apprentice Alf's blog</a> or <a href="https://github.com/apprenticeharper/DeDRM_tools/issues">raise an issue</a>. </h3>
<h2>Linux Systems Only</h2> <h2>Linux Systems Only</h2>
<h3>Generating decryption keys for Adobe Digital Editions and Kindle for PC</h3> <h3>Generating decryption keys for Adobe Digital Editions and Kindle for PC</h3>

View File

@@ -54,6 +54,8 @@ __docformat__ = 'restructuredtext en'
# 6.5.0 - Big update to Macintosh app # 6.5.0 - Big update to Macintosh app
# Fix for some more 'new' tags in Topaz ebooks. # Fix for some more 'new' tags in Topaz ebooks.
# Fix an error in wineutils.py # Fix an error in wineutils.py
# 6.5.1 - Updated version number, added PDF check for DRM-free documents
# 6.5.2 - Another Topaz fix
""" """
@@ -61,7 +63,7 @@ Decrypt DRMed ebooks.
""" """
PLUGIN_NAME = u"DeDRM" PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 5, 0) PLUGIN_VERSION_TUPLE = (6, 5, 2)
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE]) 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. # Include an html helpfile in the plugin's zipfile with the following name.
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm' RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
@@ -285,7 +287,7 @@ class DeDRM(FileTypePlugin):
except Exception, e: except Exception, e:
pass pass
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))
# import the Adobe Adept ePub handler # import the Adobe Adept ePub handler
@@ -385,7 +387,7 @@ class DeDRM(FileTypePlugin):
pass pass
# Something went wrong with decryption. # Something went wrong with decryption.
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
# Not a Barnes & Noble nor an Adobe Adept # Not a Barnes & Noble nor an Adobe Adept
@@ -485,7 +487,7 @@ class DeDRM(FileTypePlugin):
pass pass
# Something went wrong with decryption. # Something went wrong with decryption.
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))
@@ -553,7 +555,7 @@ class DeDRM(FileTypePlugin):
pass pass
if not decoded: if not decoded:
#if you reached here then no luck raise and exception #if you reached here then no luck raise and exception
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
of = self.temporary_file(book.getBookExtension()) of = self.temporary_file(book.getBookExtension())
@@ -588,7 +590,7 @@ class DeDRM(FileTypePlugin):
print u"{0} v{1}: Failed to decrypt with key {2:s} after {3:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,keyname_masked,time.time()-self.starttime) print u"{0} v{1}: Failed to decrypt with key {2:s} after {3:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,keyname_masked,time.time()-self.starttime)
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))

View File

@@ -3,13 +3,13 @@
from __future__ import with_statement from __future__ import with_statement
# adobekey.pyw, version 5.7 # adobekey.pyw, version 6.0
# Copyright © 2009-2010 i♥cabbages # Copyright © 2009-2010 i♥cabbages
# Released under the terms of the GNU General Public Licence, version 3 # Released under the terms of the GNU General Public Licence, version 3
# <http://www.gnu.org/licenses/> # <http://www.gnu.org/licenses/>
# Modified 20102013 by some_updates, DiapDealer and Apprentice Alf # Modified 20102016 by several people
# Windows users: Before running this program, you must first install Python. # Windows users: Before running this program, you must first install Python.
# We recommend ActiveState Python 2.7.X for Windows (x86) from # We recommend ActiveState Python 2.7.X for Windows (x86) from

View File

@@ -403,6 +403,7 @@ class PageParser(object):
'num_headers_yes' : (1, 'number', 0, 0), 'num_headers_yes' : (1, 'number', 0, 0),
'tracking' : (1, 'number', 0, 0), 'tracking' : (1, 'number', 0, 0),
'src' : (1, 'text', 0, 0),
} }

View File

@@ -57,6 +57,7 @@ from __future__ import with_statement
# 8.0.2 - Add additional check on DER file sanity # 8.0.2 - Add additional check on DER file sanity
# 8.0.3 - Remove erroneous check on DER file sanity # 8.0.3 - Remove erroneous check on DER file sanity
# 8.0.4 - Completely 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
""" """
@@ -64,7 +65,7 @@ Decrypts Adobe ADEPT-encrypted PDF files.
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "8.0.4" __version__ = "8.0.5"
import sys import sys
import os import os
@@ -1468,6 +1469,7 @@ class PDFDocument(object):
if not self.encryption: if not self.encryption:
self.is_printable = self.is_modifiable = self.is_extractable = True self.is_printable = self.is_modifiable = self.is_extractable = True
self.ready = True self.ready = True
raise PDFEncryptionError('Document is not encrypted.')
return return
(docid, param) = self.encryption (docid, param) = self.encryption
type = literal_name(param['Filter']) type = literal_name(param['Filter'])
@@ -2180,11 +2182,11 @@ def decryptBook(userkey, inpath, outpath):
if RSA is None: if RSA is None:
raise ADEPTError(u"PyCrypto or OpenSSL must be installed.") raise ADEPTError(u"PyCrypto or OpenSSL must be installed.")
with open(inpath, 'rb') as inf: with open(inpath, 'rb') as inf:
try: #try:
serializer = PDFSerializer(inf, userkey) serializer = PDFSerializer(inf, userkey)
except: #except:
print u"Error serializing pdf {0}. Probably wrong key.".format(os.path.basename(inpath)) # print u"Error serializing pdf {0}. Probably wrong key.".format(os.path.basename(inpath))
return 2 # return 2
# hope this will fix the 'bad file descriptor' problem # hope this will fix the 'bad file descriptor' problem
with open(outpath, 'wb') as outf: with open(outpath, 'wb') as outf:
# help construct to make sure the method runs to the end # help construct to make sure the method runs to the end

View File

@@ -352,7 +352,7 @@ class TopazBook:
break break
if not bookKey: if not bookKey:
raise DrmException(u"No key found in {0:d} keys tried. Read the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(len(pidlst))) raise DrmException(u"No key found in {0:d} keys tried. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(len(pidlst)))
self.setBookKey(bookKey) self.setBookKey(bookKey)
self.createBookDirectory() self.createBookDirectory()

View File

@@ -27,8 +27,9 @@
# 6.4.3 - Version bump to match plugin & Mac app # 6.4.3 - Version bump to match plugin & Mac app
# 6.5.0 - Fix for some new tags in Topaz ebooks # 6.5.0 - Fix for some new tags in Topaz ebooks
# 6.5.1 - Version bump to match plugin & Mac app # 6.5.1 - Version bump to match plugin & Mac app
# 6.5.2 - Fix for a new tag in Topaz ebooks
__version__ = '6.5.1' __version__ = '6.5.2'
import sys import sys
import os, os.path import os, os.path

View File

@@ -55,7 +55,7 @@ p {margin-top: 0}
<li>And probably many more.</li> <li>And probably many more.</li>
</ul> </ul>
<h3> For additional help read the <a href="http://apprenticealf.wordpress.com/2011/01/17/frequently-asked-questions-about-the-drm-removal-tools/">FAQs</a> at <a href="http://apprenticealf.wordpress.com">Apprentice Alfs Blog</a> and ask questions in the comments section of the <a href="http://apprenticealf.wordpress.com/2012/09/10/drm-removal-tools-for-ebooks/">first post</a>.</h3> <h3> For additional help read the <a href="https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md">FAQs</a> at <a href="https://github.com/apprenticeharper/DeDRM_tools/">Apprentice Harperss GitHub repository</a>. You can ask questions in the comments section of the <a href="http://apprenticealf.wordpress.com/2012/09/10/drm-removal-tools-for-ebooks/">first post</a> at <a href="http://wordpress.com/apprenticealf/">Apprentice Alf's blog</a> or <a href="https://github.com/apprenticeharper/DeDRM_tools/issues">raise an issue</a>. </h3>
<h2>Linux Systems Only</h2> <h2>Linux Systems Only</h2>
<h3>Generating decryption keys for Adobe Digital Editions and Kindle for PC</h3> <h3>Generating decryption keys for Adobe Digital Editions and Kindle for PC</h3>

View File

@@ -55,6 +55,7 @@ __docformat__ = 'restructuredtext en'
# Fix for some more 'new' tags in Topaz ebooks. # Fix for some more 'new' tags in Topaz ebooks.
# Fix an error in wineutils.py # Fix an error in wineutils.py
# 6.5.1 - Updated version number, added PDF check for DRM-free documents # 6.5.1 - Updated version number, added PDF check for DRM-free documents
# 6.5.2 - Another Topaz fix
""" """
@@ -62,7 +63,7 @@ Decrypt DRMed ebooks.
""" """
PLUGIN_NAME = u"DeDRM" PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 5, 1) PLUGIN_VERSION_TUPLE = (6, 5, 2)
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE]) 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. # Include an html helpfile in the plugin's zipfile with the following name.
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm' RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
@@ -286,7 +287,7 @@ class DeDRM(FileTypePlugin):
except Exception, e: except Exception, e:
pass pass
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))
# import the Adobe Adept ePub handler # import the Adobe Adept ePub handler
@@ -386,7 +387,7 @@ class DeDRM(FileTypePlugin):
pass pass
# Something went wrong with decryption. # Something went wrong with decryption.
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
# Not a Barnes & Noble nor an Adobe Adept # Not a Barnes & Noble nor an Adobe Adept
@@ -486,7 +487,7 @@ class DeDRM(FileTypePlugin):
pass pass
# Something went wrong with decryption. # Something went wrong with decryption.
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))
@@ -554,7 +555,7 @@ class DeDRM(FileTypePlugin):
pass pass
if not decoded: if not decoded:
#if you reached here then no luck raise and exception #if you reached here then no luck raise and exception
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
of = self.temporary_file(book.getBookExtension()) of = self.temporary_file(book.getBookExtension())
@@ -589,7 +590,7 @@ class DeDRM(FileTypePlugin):
print u"{0} v{1}: Failed to decrypt with key {2:s} after {3:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,keyname_masked,time.time()-self.starttime) print u"{0} v{1}: Failed to decrypt with key {2:s} after {3:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,keyname_masked,time.time()-self.starttime)
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))

View File

@@ -3,13 +3,13 @@
from __future__ import with_statement from __future__ import with_statement
# adobekey.pyw, version 5.7 # adobekey.pyw, version 6.0
# Copyright © 2009-2010 i♥cabbages # Copyright © 2009-2010 i♥cabbages
# Released under the terms of the GNU General Public Licence, version 3 # Released under the terms of the GNU General Public Licence, version 3
# <http://www.gnu.org/licenses/> # <http://www.gnu.org/licenses/>
# Modified 20102013 by some_updates, DiapDealer and Apprentice Alf # Modified 20102016 by several people
# Windows users: Before running this program, you must first install Python. # Windows users: Before running this program, you must first install Python.
# We recommend ActiveState Python 2.7.X for Windows (x86) from # We recommend ActiveState Python 2.7.X for Windows (x86) from

View File

@@ -403,6 +403,7 @@ class PageParser(object):
'num_headers_yes' : (1, 'number', 0, 0), 'num_headers_yes' : (1, 'number', 0, 0),
'tracking' : (1, 'number', 0, 0), 'tracking' : (1, 'number', 0, 0),
'src' : (1, 'text', 0, 0),
} }

View File

@@ -352,7 +352,7 @@ class TopazBook:
break break
if not bookKey: if not bookKey:
raise DrmException(u"No key found in {0:d} keys tried. Read the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(len(pidlst))) raise DrmException(u"No key found in {0:d} keys tried. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(len(pidlst)))
self.setBookKey(bookKey) self.setBookKey(bookKey)
self.createBookDirectory() self.createBookDirectory()

View File

@@ -55,7 +55,7 @@ p {margin-top: 0}
<li>And probably many more.</li> <li>And probably many more.</li>
</ul> </ul>
<h3> For additional help read the <a href="http://apprenticealf.wordpress.com/2011/01/17/frequently-asked-questions-about-the-drm-removal-tools/">FAQs</a> at <a href="http://apprenticealf.wordpress.com">Apprentice Alfs Blog</a> and ask questions in the comments section of the <a href="http://apprenticealf.wordpress.com/2012/09/10/drm-removal-tools-for-ebooks/">first post</a>.</h3> <h3> For additional help read the <a href="https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md">FAQs</a> at <a href="https://github.com/apprenticeharper/DeDRM_tools/">Apprentice Harperss GitHub repository</a>. You can ask questions in the comments section of the <a href="http://apprenticealf.wordpress.com/2012/09/10/drm-removal-tools-for-ebooks/">first post</a> at <a href="http://wordpress.com/apprenticealf/">Apprentice Alf's blog</a> or <a href="https://github.com/apprenticeharper/DeDRM_tools/issues">raise an issue</a>. </h3>
<h2>Linux Systems Only</h2> <h2>Linux Systems Only</h2>
<h3>Generating decryption keys for Adobe Digital Editions and Kindle for PC</h3> <h3>Generating decryption keys for Adobe Digital Editions and Kindle for PC</h3>

View File

@@ -55,6 +55,7 @@ __docformat__ = 'restructuredtext en'
# Fix for some more 'new' tags in Topaz ebooks. # Fix for some more 'new' tags in Topaz ebooks.
# Fix an error in wineutils.py # Fix an error in wineutils.py
# 6.5.1 - Updated version number, added PDF check for DRM-free documents # 6.5.1 - Updated version number, added PDF check for DRM-free documents
# 6.5.2 - Another Topaz fix
""" """
@@ -62,7 +63,7 @@ Decrypt DRMed ebooks.
""" """
PLUGIN_NAME = u"DeDRM" PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 5, 1) PLUGIN_VERSION_TUPLE = (6, 5, 2)
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE]) 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. # Include an html helpfile in the plugin's zipfile with the following name.
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm' RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
@@ -286,7 +287,7 @@ class DeDRM(FileTypePlugin):
except Exception, e: except Exception, e:
pass pass
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))
# import the Adobe Adept ePub handler # import the Adobe Adept ePub handler
@@ -386,7 +387,7 @@ class DeDRM(FileTypePlugin):
pass pass
# Something went wrong with decryption. # Something went wrong with decryption.
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
# Not a Barnes & Noble nor an Adobe Adept # Not a Barnes & Noble nor an Adobe Adept
@@ -486,7 +487,7 @@ class DeDRM(FileTypePlugin):
pass pass
# Something went wrong with decryption. # Something went wrong with decryption.
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))
@@ -554,7 +555,7 @@ class DeDRM(FileTypePlugin):
pass pass
if not decoded: if not decoded:
#if you reached here then no luck raise and exception #if you reached here then no luck raise and exception
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
of = self.temporary_file(book.getBookExtension()) of = self.temporary_file(book.getBookExtension())
@@ -589,7 +590,7 @@ class DeDRM(FileTypePlugin):
print u"{0} v{1}: Failed to decrypt with key {2:s} after {3:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,keyname_masked,time.time()-self.starttime) print u"{0} v{1}: Failed to decrypt with key {2:s} after {3:.1f} seconds".format(PLUGIN_NAME, PLUGIN_VERSION,keyname_masked,time.time()-self.starttime)
print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime) print u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.\nRead the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)
raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime)) raise DeDRMError(u"{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds.".format(PLUGIN_NAME, PLUGIN_VERSION, time.time()-self.starttime))

View File

@@ -3,13 +3,13 @@
from __future__ import with_statement from __future__ import with_statement
# adobekey.pyw, version 5.7 # adobekey.pyw, version 6.0
# Copyright © 2009-2010 i♥cabbages # Copyright © 2009-2010 i♥cabbages
# Released under the terms of the GNU General Public Licence, version 3 # Released under the terms of the GNU General Public Licence, version 3
# <http://www.gnu.org/licenses/> # <http://www.gnu.org/licenses/>
# Modified 20102013 by some_updates, DiapDealer and Apprentice Alf # Modified 20102016 by several people
# Windows users: Before running this program, you must first install Python. # Windows users: Before running this program, you must first install Python.
# We recommend ActiveState Python 2.7.X for Windows (x86) from # We recommend ActiveState Python 2.7.X for Windows (x86) from

View File

@@ -403,6 +403,7 @@ class PageParser(object):
'num_headers_yes' : (1, 'number', 0, 0), 'num_headers_yes' : (1, 'number', 0, 0),
'tracking' : (1, 'number', 0, 0), 'tracking' : (1, 'number', 0, 0),
'src' : (1, 'text', 0, 0),
} }

View File

@@ -352,7 +352,7 @@ class TopazBook:
break break
if not bookKey: if not bookKey:
raise DrmException(u"No key found in {0:d} keys tried. Read the FAQs at Alf's blog: http://apprenticealf.wordpress.com/".format(len(pidlst))) raise DrmException(u"No key found in {0:d} keys tried. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(len(pidlst)))
self.setBookKey(bookKey) self.setBookKey(bookKey)
self.createBookDirectory() self.createBookDirectory()

View File

@@ -53,7 +53,7 @@ If you find that the DeDRM plugin is not working for you (imported ebooks still
- Once calibre has re-started, import the problem ebook. - Once calibre has re-started, import the problem ebook.
- Now close calibre. - Now close calibre.
A log will appear that you can copy and paste into a comment at Apprentice Alf's blog, http://apprenticealf.wordpress.com/ . You should also give details of your computer, and how you obtained the ebook file. A log will appear that you can copy and paste into a comment at Apprentice Alf's blog, http://apprenticealf.wordpress.com/ or an issue at Apprentice Harper's repository, https://github.com/apprenticeharper/DeDRM_tools/issues . You should also give details of your computer, and how you obtained the ebook file.
Credits Credits

View File

@@ -26,6 +26,9 @@ First, unzip the archive. You should now have a DeDRM folder containing several
## That's a big complicated ReadMe file! Isn't there a quick guide? ## That's a big complicated ReadMe file! Isn't there a quick guide?
Install calibre. Install the DeDRM\_plugin in calibre. Install the Obok\_plugin in calibre. Restart calibre. In the DeDRM_plugin customisation dialog add in any E-Ink Kindle serial numbers and your B&N account email address and password. Remember that the plugin only tries to remove DRM when ebooks are imported, not at any other time. Install calibre. Install the DeDRM\_plugin in calibre. Install the Obok\_plugin in calibre. Restart calibre. In the DeDRM_plugin customisation dialog add in any E-Ink Kindle serial numbers and your B&N account email address and password. Remember that the plugin only tries to remove DRM when ebooks are imported, not at any other time.
# Breaking News
### The recent (September 2016) Kobo Desktop update to version 4.0.x has added encryption to the database of ebooks. A test version of the obok plugin can be downloaded directly from the repository here: https://github.com/apprenticeharper/DeDRM_tools/tree/master/Obok_calibre_plugin
# Installing the Tools # Installing the Tools
## The calibre plugin ## The calibre plugin
### I am trying to install the calibre plugin, but calibre says "ERROR: Unhandled exception: InvalidPlugin: The plugin in u[path]DeDRM\_tools\_6.4.3.zip is invalid. It does not contain a top-level \_\_init\_\_.py file" ### I am trying to install the calibre plugin, but calibre says "ERROR: Unhandled exception: InvalidPlugin: The plugin in u[path]DeDRM\_tools\_6.4.3.zip is invalid. It does not contain a top-level \_\_init\_\_.py file"

Binary file not shown.

View File

@@ -19,7 +19,7 @@ except NameError:
PLUGIN_NAME = 'Obok DeDRM' PLUGIN_NAME = 'Obok DeDRM'
PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_') PLUGIN_SAFE_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_')
PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.') PLUGIN_DESCRIPTION = _('Removes DRM from Kobo kepubs and adds them to the library.')
PLUGIN_VERSION_TUPLE = (6, 3, 6) PLUGIN_VERSION_TUPLE = (6, 5, 2)
PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE]) PLUGIN_VERSION = '.'.join([str(x) for x in PLUGIN_VERSION_TUPLE])
HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm' HELPFILE_NAME = PLUGIN_SAFE_NAME + '_Help.htm'
PLUGIN_AUTHORS = 'Anon' PLUGIN_AUTHORS = 'Anon'

View File

@@ -1,6 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Version 3.2.2 October 2016
# Change to the way the new database version is handled.
#
# Version 3.2.1 September 2016
# Update for v4.0 of Windows Desktop app.
#
# Version 3.2.0 January 2016 # Version 3.2.0 January 2016
# Update for latest version of Windows Desktop app. # Update for latest version of Windows Desktop app.
# Support Kobo devices in the command line version. # Support Kobo devices in the command line version.
@@ -136,8 +142,8 @@
# #
"""Manage all Kobo books, either encrypted or DRM-free.""" """Manage all Kobo books, either encrypted or DRM-free."""
__version__ = '3.1.9' __version__ = '3.2.2'
__about__ = u"Obok v{0}\nCopyright © 2012-2015 Physisticated et al.".format(__version__) __about__ = u"Obok v{0}\nCopyright © 2012-2016 Physisticated et al.".format(__version__)
import sys import sys
import os import os
@@ -152,6 +158,7 @@ import xml.etree.ElementTree as ET
import string import string
import shutil import shutil
import argparse import argparse
import tempfile
can_parse_xml = True can_parse_xml = True
try: try:
@@ -162,7 +169,7 @@ except ImportError:
# print u"Cannot find xml.etree, disabling extraction of serial numbers" # print u"Cannot find xml.etree, disabling extraction of serial numbers"
# List of all known hash keys # List of all known hash keys
KOBO_HASH_KEYS = ['88b3a2e13', 'XzUhGYdFp', 'NoCanLook'] KOBO_HASH_KEYS = ['88b3a2e13', 'XzUhGYdFp', 'NoCanLook','QJhwzAtXL']
class ENCRYPTIONError(Exception): class ENCRYPTIONError(Exception):
pass pass
@@ -355,7 +362,18 @@ class KoboLibrary(object):
if (self.kobodir != u""): if (self.kobodir != u""):
self.bookdir = os.path.join(self.kobodir, u"kepub") self.bookdir = os.path.join(self.kobodir, u"kepub")
self.__sqlite = sqlite3.connect(kobodb) # make a copy of the database in a temporary file
# so we can ensure it's not using WAL logging which sqlite3 can't do.
self.newdb = tempfile.NamedTemporaryFile(mode='wb', delete=False)
print self.newdb.name
olddb = open(kobodb, 'rb')
self.newdb.write(olddb.read(18))
self.newdb.write('\x01\x01')
olddb.read(2)
self.newdb.write(olddb.read())
olddb.close()
self.newdb.close()
self.__sqlite = sqlite3.connect(self.newdb.name)
self.__cursor = self.__sqlite.cursor() self.__cursor = self.__sqlite.cursor()
self._userkeys = [] self._userkeys = []
self._books = [] self._books = []
@@ -366,6 +384,8 @@ class KoboLibrary(object):
"""Closes the database used by the library.""" """Closes the database used by the library."""
self.__cursor.close() self.__cursor.close()
self.__sqlite.close() self.__sqlite.close()
# delete the temporary copy of the database
os.remove(self.newdb.name)
@property @property
def userkeys (self): def userkeys (self):
@@ -558,12 +578,19 @@ class KoboFile(object):
Returns True if the content was checked, False if it was not Returns True if the content was checked, False if it was not
checked.""" checked."""
if self.mimetype == 'application/xhtml+xml': if self.mimetype == 'application/xhtml+xml':
if contents[:5]=="<?xml": if contents[:5]=="<?xml" or contents[:8]=="\xef\xbb\xbf<?xml":
# utf-8
return True
elif contents[:14]=="\xfe\xff\x00<\x00?\x00x\x00m\x00l":
# utf-16BE
return True
elif contents[:14]=="\xff\xfe<\x00?\x00x\x00m\x00l\x00":
# utf-16LE
return True return True
else: else:
print u"Bad XML: {0}".format(contents[:5]) print u"Bad XML: {0}".format(contents[:8])
raise ValueError raise ValueError
if self.mimetype == 'image/jpeg': elif self.mimetype == 'image/jpeg':
if contents[:3] == '\xff\xd8\xff': if contents[:3] == '\xff\xd8\xff':
return True return True
else: else:

View File

@@ -3,13 +3,13 @@
from __future__ import with_statement from __future__ import with_statement
# adobekey.pyw, version 5.7 # adobekey.pyw, version 6.0
# Copyright © 2009-2010 i♥cabbages # Copyright © 2009-2010 i♥cabbages
# Released under the terms of the GNU General Public Licence, version 3 # Released under the terms of the GNU General Public Licence, version 3
# <http://www.gnu.org/licenses/> # <http://www.gnu.org/licenses/>
# Modified 20102013 by some_updates, DiapDealer and Apprentice Alf # Modified 20102016 by several people
# Windows users: Before running this program, you must first install Python. # Windows users: Before running this program, you must first install Python.
# We recommend ActiveState Python 2.7.X for Windows (x86) from # We recommend ActiveState Python 2.7.X for Windows (x86) from

View File

@@ -1,6 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Version 3.2.2 October 2016
# Change to the way the new database version is handled.
#
# Version 3.2.1 September 2016
# Update for v4.0 of Windows Desktop app.
#
# Version 3.2.0 January 2016 # Version 3.2.0 January 2016
# Update for latest version of Windows Desktop app. # Update for latest version of Windows Desktop app.
# Support Kobo devices in the command line version. # Support Kobo devices in the command line version.
@@ -136,8 +142,8 @@
# #
"""Manage all Kobo books, either encrypted or DRM-free.""" """Manage all Kobo books, either encrypted or DRM-free."""
__version__ = '3.1.9' __version__ = '3.2.2'
__about__ = u"Obok v{0}\nCopyright © 2012-2015 Physisticated et al.".format(__version__) __about__ = u"Obok v{0}\nCopyright © 2012-2016 Physisticated et al.".format(__version__)
import sys import sys
import os import os
@@ -152,6 +158,7 @@ import xml.etree.ElementTree as ET
import string import string
import shutil import shutil
import argparse import argparse
import tempfile
can_parse_xml = True can_parse_xml = True
try: try:
@@ -162,7 +169,7 @@ except ImportError:
# print u"Cannot find xml.etree, disabling extraction of serial numbers" # print u"Cannot find xml.etree, disabling extraction of serial numbers"
# List of all known hash keys # List of all known hash keys
KOBO_HASH_KEYS = ['88b3a2e13', 'XzUhGYdFp', 'NoCanLook'] KOBO_HASH_KEYS = ['88b3a2e13', 'XzUhGYdFp', 'NoCanLook','QJhwzAtXL']
class ENCRYPTIONError(Exception): class ENCRYPTIONError(Exception):
pass pass
@@ -355,7 +362,18 @@ class KoboLibrary(object):
if (self.kobodir != u""): if (self.kobodir != u""):
self.bookdir = os.path.join(self.kobodir, u"kepub") self.bookdir = os.path.join(self.kobodir, u"kepub")
self.__sqlite = sqlite3.connect(kobodb) # make a copy of the database in a temporary file
# so we can ensure it's not using WAL logging which sqlite3 can't do.
self.newdb = tempfile.NamedTemporaryFile(mode='wb', delete=False)
print self.newdb.name
olddb = open(kobodb, 'rb')
self.newdb.write(olddb.read(18))
self.newdb.write('\x01\x01')
olddb.read(2)
self.newdb.write(olddb.read())
olddb.close()
self.newdb.close()
self.__sqlite = sqlite3.connect(self.newdb.name)
self.__cursor = self.__sqlite.cursor() self.__cursor = self.__sqlite.cursor()
self._userkeys = [] self._userkeys = []
self._books = [] self._books = []
@@ -366,6 +384,8 @@ class KoboLibrary(object):
"""Closes the database used by the library.""" """Closes the database used by the library."""
self.__cursor.close() self.__cursor.close()
self.__sqlite.close() self.__sqlite.close()
# delete the temporary copy of the database
os.remove(self.newdb.name)
@property @property
def userkeys (self): def userkeys (self):
@@ -558,12 +578,19 @@ class KoboFile(object):
Returns True if the content was checked, False if it was not Returns True if the content was checked, False if it was not
checked.""" checked."""
if self.mimetype == 'application/xhtml+xml': if self.mimetype == 'application/xhtml+xml':
if contents[:5]=="<?xml": if contents[:5]=="<?xml" or contents[:8]=="\xef\xbb\xbf<?xml":
# utf-8
return True
elif contents[:14]=="\xfe\xff\x00<\x00?\x00x\x00m\x00l":
# utf-16BE
return True
elif contents[:14]=="\xff\xfe<\x00?\x00x\x00m\x00l\x00":
# utf-16LE
return True return True
else: else:
print u"Bad XML: {0}".format(contents[:5]) print u"Bad XML: {0}".format(contents[:8])
raise ValueError raise ValueError
if self.mimetype == 'image/jpeg': elif self.mimetype == 'image/jpeg':
if contents[:3] == '\xff\xd8\xff': if contents[:3] == '\xff\xd8\xff':
return True return True
else: else: