Nov 8th, 2014
Never
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
- +++ __init__.py Sat Nov 08 00:59:56 2014
- pids = dedrmprefs['pids']
- kindleDatabases = dedrmprefs['kindlekeys'].items()
- - book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,serials,pids,self.starttime)
- + book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,serials,fireKeys,pids,self.starttime)
- decoded = False
- # perhaps we need to get a new default Kindle for Mac/PC key
- if len(newkeys) > 0:
- print u'{0} v{1}: Found {2} new {3}'.format(PLUGIN_NAME, PLUGIN_VERSION, len(newkeys), u'key' if len(newkeys)1 else u'keys')
- - book = k4mobidedrm.GetDecryptedBook(path_to_ebook,newkeys.items(),[],[],self.starttime)
- + book = k4mobidedrm.GetDecryptedBook(path_to_ebook,newkeys.items(),[],[],[],self.starttime)
- # store the new successful keys in the defaults
- print u'{0} v{1}: Saving {2} new {3}'.format(PLUGIN_NAME, PLUGIN_VERSION, len(newkeys), u'key' if len(newkeys)1 else u'keys')
- +++ config.py Sat Nov 08 00:59:56 2014
- self.tempdedrmprefs['adeptkeys'] = self.dedrmprefs['adeptkeys'].copy()
- self.tempdedrmprefs['ereaderkeys'] = self.dedrmprefs['ereaderkeys'].copy()
- self.tempdedrmprefs['kindlekeys'] = self.dedrmprefs['kindlekeys'].copy()
- + self.tempdedrmprefs['firekeys'] = self.dedrmprefs['firekeys'].copy()
- self.tempdedrmprefs['pids'] = list(self.dedrmprefs['pids'])
- self.tempdedrmprefs['serials'] = list(self.dedrmprefs['serials'])
- self.tempdedrmprefs['adobewineprefix'] = self.dedrmprefs['adobewineprefix']
- self.tempdedrmprefs['kindlewineprefix'] = self.dedrmprefs['kindlewineprefix']
- + self.tempdedrmprefs['firewineprefix'] = self.dedrmprefs['firewineprefix']
- # Start Qt Gui dialog layout
- @@ -91,6 +93,10 @@
- self.kindle_key_button.setToolTip(_(u'Click to manage keys for Kindle for Mac/PC ebooks'))
- self.kindle_key_button.setText(u'Kindle for Mac/PC ebooks')
- self.kindle_key_button.clicked.connect(self.kindle_keys)
- + self.fire_key_button.setToolTip(_(u'Click to manage keys for Kindle Fire ebooks'))
- + self.fire_key_button.setText(u'Kindle Fire ebooks')
- + self.fire_key_button.clicked.connect(self.fire_keys)
- self.adept_button.setToolTip(_(u'Click to manage keys for Adobe Digital Editions ebooks'))
- self.adept_button.setText(u'Adobe Digital Editions ebooks')
- button_layout.addWidget(self.ereader_button)
- button_layout.addWidget(self.kindle_key_button)
- d = ManageKeysDialog(self,u'EInk Kindle Serial Number',self.tempdedrmprefs['serials'], AddSerialDialog)
- + if isosx or iswindows:
- + d = ManageKeysDialog(self,u'Kindle Fire Key',self.tempdedrmprefs['firekeys'], AddFireDialog, 'fire')
- + # linux
- + d = ManageKeysDialog(self,u'Kindle Fire Key',self.tempdedrmprefs['firekeys'], AddFireDialog, 'fire', self.tempdedrmprefs['firewineprefix'])
- + self.tempdedrmprefs['firewineprefix'] = d.getwineprefix()
- def kindle_keys(self):
- d = ManageKeysDialog(self,u'Kindle for Mac and PC Key',self.tempdedrmprefs['kindlekeys'], AddKindleDialog, 'k4i')
- self.dedrmprefs.set('adeptkeys', self.tempdedrmprefs['adeptkeys'])
- self.dedrmprefs.set('ereaderkeys', self.tempdedrmprefs['ereaderkeys'])
- self.dedrmprefs.set('kindlekeys', self.tempdedrmprefs['kindlekeys'])
- + self.dedrmprefs.set('firekeys', self.tempdedrmprefs['firekeys'])
- self.dedrmprefs.set('pids', self.tempdedrmprefs['pids'])
- self.dedrmprefs.set('serials', self.tempdedrmprefs['serials'])
- self.dedrmprefs.set('adobewineprefix', self.tempdedrmprefs['adobewineprefix'])
- self.dedrmprefs.set('kindlewineprefix', self.tempdedrmprefs['kindlewineprefix'])
- + self.dedrmprefs.set('firewineprefix', self.tempdedrmprefs['firewineprefix'])
- self.dedrmprefs.writeprefs()
- @@ -812,6 +830,68 @@
- errmsg = u'Key name must be at <i>least</i> 4 characters long!'
- return error_dialog(None, '{0}{1}'.format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
- +
- +class AddFireDialog(QDialog):
- + QDialog.__init__(self, parent)
- + self.setWindowTitle(u'{0}{1}: Add New Kindle Fire Keys'.format(PLUGIN_NAME, PLUGIN_VERSION))
- + self.setLayout(layout)
- + data_group_box = QGroupBox(u', self)
- + data_group_box_layout = QVBoxLayout()
- +
- + data_group_box_layout.addLayout(key_group)
- + key_group.addWidget(QLabel(u'Kindle Fire Serial Number:', self))
- + self.key_ledit.setToolTip(u'Enter a Kindle Fire serial number.')
- +
- + value_group = QHBoxLayout()
- + value_group.addWidget(QLabel(u'Account Secrets:', self))
- + self.value_ledit.setToolTip(u'Enter Account Secrets.')
- +
- + key_label.setAlignment(Qt.AlignHCenter)
- +
- + self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
- + self.button_box.rejected.connect(self.reject)
- +
- +
- + def key_name(self):
- +
- + def key_value(self):
- + value['deviceserialnumber'] = unicode(self.key_ledit.text()).strip()
- + value['account_secrets'] = unicode(self.value_ledit.text()).strip()
- +
- + if len(self.key_name) 0 or self.key_name.isspace():
- + return error_dialog(None, '{0}{1}'.format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
- + for i in value:
- + errmsg = u'All fields are required!'
- + return error_dialog(None, '{0}{1}'.format(PLUGIN_NAME, PLUGIN_VERSION), errmsg, show=True, show_copy_button=False)
- --- k4mobidedrm.py Wed Oct 02 03:41:10 2013
- @@ -187,7 +187,7 @@
- return re.sub(u'&#?w+;', fixup, text)
- -def GetDecryptedBook(infile, kDatabases, serials, pids, starttime = time.time()):
- +def GetDecryptedBook(infile, kDatabases, serials, fireKeys, pids, starttime = time.time()):
- if not os.path.isfile(infile):
- raise DrmException(u'Input file does not exist.')
- totalpids = list(pids)
- md1, md2 = mb.getPIDMetaInfo()
- - totalpids.extend(kgenpids.getPidList(md1, md2, serials, kDatabases))
- + totalpids.extend(kgenpids.getPidList(md1, md2, serials, kDatabases, fireKeys))
- print u'Found {1:d} keys to try after {0:.1f} seconds'.format(time.time()-starttime, len(totalpids))
- try:
- # kDatabaseFiles is a list of files created by kindlekey
- -def decryptBook(infile, outdir, kDatabaseFiles, serials, pids):
- +def decryptBook(infile, outdir, kDatabaseFiles, serials, fireKeys, pids):
- kDatabases = []
- @@ -239,7 +239,7 @@
- - book = GetDecryptedBook(infile, kDatabases, serials, pids, starttime)
- + book = GetDecryptedBook(infile, kDatabases, serials, fireKeys, pids, starttime)
- print u'Error decrypting book after {1:.1f} seconds: {0}'.format(e.args[0],time.time()-starttime)
- @@ -298,6 +298,7 @@
- outdir = args[1]
- + fireKeys = []
- pids = []
- @@ -306,6 +307,14 @@
- raise DrmException('Invalid parameter for -k')
- + if o '-f':
- + raise DrmException('Invalid parameter for -f')
- + fireKey = {}
- + fireKey['account_secrets'] = param[1]
- if o '-p':
- raise DrmException('Invalid parameter for -p')
- # try with built in Kindle Info files if not on Linux
- - return decryptBook(infile, outdir, kDatabaseFiles, serials, pids)
- + return decryptBook(infile, outdir, kDatabaseFiles, serials, fireKeys, pids)
- --- kgenpids.py Sun Apr 21 07:18:02 2013
- @@ -35,6 +35,11 @@
- return ctx.digest()
- +def SHA256Hex(message):
- + ctx.update(message)
- +
- # Encode the bytes in data with the characters in map
- @@ -159,6 +164,55 @@
- +# Parse the EXTH header records and use the Kindle Fire serial number and account secrets to calculate the book pid.
- + pids=[]
- + # Pulled from KindleForOtter.apk
- + CUSTOM_PID_FOR_BUNDLED_DICTIONARY_DRM = '-3891337692'
- + try:
- + # Get the device serial number
- + serial = (fireKeys[1])['deviceserialnumber'].encode('ascii')
- + # Get the account secrets
- + secrets = (fireKeys[1])['account_secrets'].encode('ascii')
- + # Split account secrets if there are more than one
- +
- + print u'Keys not found in the database {0}.'.format(kindleDatabase[0])
- +
- + pidHash = SHA256Hex(serial)
- +
- + for i in xrange(len(secrets)):
- + bookPID = encodePID(pidHash)
- +
- + pidHash = SHA1(serial+secrets[i]+rec209+token)
- + pids.append(bookPID)
- + # variant 2
- + pidHash = SHA1(secrets[i]+rec209+token)
- + pids.append(bookPID)
- + # Get bundled PID
- + pids.append(CUSTOM_PID_FOR_BUNDLED_DICTIONARY_DRM)
- + return pids
- +
- # Parse the EXTH header records and use the Kindle serial number to calculate the book pid.
- pids=[]
- -def getPidList(md1, md2, serials=[], kDatabases=[]):
- +def getPidList(md1, md2, serials=[], kDatabases=[], fireKeys=[]):
- kDatabases = []
- serials = []
- + fireKeys = []
- for kDatabase in kDatabases:
- @@ -262,6 +318,13 @@
- pidlst.extend(getKindlePids(md1, md2, serialnum))
- print u'Error getting PIDs from serial number {0}: {1}'.format(serialnum ,e.args[0])
- +
- + try:
- + except Exception, e:
- + print u'Error getting PIDs from Kindle Fire Key {0}: {1}'.format(kDatabase[0],e.args[0])
- --- prefs.py Mon Apr 22 02:44:05 2013
- @@ -23,10 +23,12 @@
- self.dedrmprefs.defaults['ereaderkeys'] = {}
- + self.dedrmprefs.defaults['firekeys'] = {}
- self.dedrmprefs.defaults['serials'] = []
- self.dedrmprefs.defaults['kindlewineprefix'] = '
- # we must actually set the prefs that are dictionaries and lists
- self.dedrmprefs['ereaderkeys'] = {}
- self.dedrmprefs['kindlekeys'] = {}
- + self.dedrmprefs['firekeys'] = {}
- self.dedrmprefs['pids'] = []
- @@ -282,6 +286,7 @@
- if 'wineprefix' in kindleprefs and kindleprefs['wineprefix'] != ':
- dedrmprefs.set('adobewineprefix',kindleprefs['wineprefix'])
- dedrmprefs.set('kindlewineprefix',kindleprefs['wineprefix'])
- + dedrmprefs.set('firewineprefix',kindleprefs['wineprefix'])
- print u'{0} v{1}: WINEPREFIX ‘(2)’ imported from Kindle plugin preferences'.format(PLUGIN_NAME, PLUGIN_VERSION, kindleprefs['wineprefix'])
- traceback.print_exc()
Tools v6.0.7 (74a4c894) Commits Alf / DeDRM. These plugins work for Windows, Mac OS X and Linux. For ebooks from Kindle 4 PC and Adobe Digital Editions, Linux users should read the section at the end the DeDRMpluginReadMe.txt file. DeDRM application for Mac OS X users: (Mac OS X 10.4 and above) This application is a stand-alone application for Mac OS X users. Head to this blog post by Apprentice Harper for More Info What's New: This release adds full support for the new.kinf2018 key files and the nw KFX encryption. Many thanks to Apprentice Sakuya for their work on this. This means that this release now works with the latest (2.8) version of Kindle for PC and Kindle for Mac. The short-short version is that you need to get the DeDRM plugin from Apprentice Alf and install it in calibre (and reboot calibre). Once you’ve installed the plugin, all you have to do is find where NookStudy or Nook4PC put the ebooks on your computer and drag each ebook into calibre (everything else is automatic). Version 6.8.0 released on 18 June, 2020 Welcome to Apprentice Alf’s blog. This blog is intended to help anyone looking for free and simple software for removing DRM from their Kindle ebooks, stripping DRM from their Adobe Digital Editions ebooks, getting rid of DRM from their Barnes and Noble ebooks, freeing their Kobo ebooks of DRM, or decrypting their Fictionwise eReader ebooks.
Post updated on 10 August, 2015
About calibre
Calibre is a free, open source, ebook management and conversion utility created and maintained by Kovid Goyal. It is available for Windows, Mac OS X and Linux.
Calibre cannot, on its own, remove DRM from ebooks. However, it is possible to added third-party software (‘plugins’) to enhance calibre.
To be able to use the DeDRM plugin for calibre, it is necessary to install calibre first. The latest version can be downloaded from http://calibre-ebook.com/download.
The DeDRM plugin for calibre
The DRM removal plugin (DeDRM_plugin.zip) can be found in the tools archive linked from the most recent post in this blog. The DeDRM plugin can remove DRM from Kindle eBooks (but not rented Kindle ebooks, books downloaded to a Kindle Fire, Kindle for iOS or the Windows Store Kindle App), Barnes & Noble ePub ebooks (but not books downloaded to the Windows Store Nook App) , any ebooks using Adobe Digital Editions DRM (this includes ePubs from Kobo and Sony that are downloaded for Adobe Digital Editions), and the older Mobipocket and eReader ebooks. Siegler wall furnace manual. For other kinds of ebooks see the other posts in this blog.
Installing the DeDRM plugin for calibre
- Download the latest tools package, and unzip it.
(On Windows, right-click and “Extract All…”; After extracting all, rename the tools_vX.X.X.zip file to tools_zipped_vX.X.X.zip to prevent later confusion) - Run calibre. From the Preferences menu select “Change calibre behavior”.
(Do not click “Get plugins to enhance calibre”, that option is reserved for ‘official’ calibre plugins.) - Click on Plugins (under “Advanced”) — it looks like a jigsaw puzzle piece.
- Click on the large “Load plugin from file” button
- Navigate to the tools folder unzipped in step 2
- Open the “DeDRM_calibre_plugin” folder
- Select the DeDRM_plugin.zip file in that folder
- Click on the “Add” (sometimes “Open”) button.
- Click on the “Yes” button in the “Are you sure?” warning dialog that appears. A “Success” dialog will appear, saying that the plug-in has been installed. Click on “OK”.
Apprentice Alf Kindle For Mac Keyboard
Customising the plugin with encryption keys
Apprentice Alf Blog
On Macintosh and Windows systems no customisation is required for ebooks from Kindle for Mac/PC, Nook Study, or Adobe Digital Editions (ADE), provided that calibre is run on the same computer and user account as the installation of Kindle for Mac/PC, Nook Study, or ADE to which the books were downloaded. The default key is found and stored in the preferences automatically. Anyone using Linux should read the ReadMe file for details of how to obtain the keys manually.
For other sources of ebooks, or on Linux systems, you must configure the plugin. To configure the plugin, you must find it in the list of plugins. Usually calibre will have automatically selected the DeDRM plugin after you add it. If not, the DeDRM plugin can be found under “File Type plugins”. Thinking fellers union local 282 strangers from the universe blogspot. It might easier to find if you check the “Show only user installed plugins” checkbox. You might need to click on the triangle next to the “File Type plugins” label to show the list of File Type plugins.
If it’s not already selected, click on the DeDRM plugin in the list to select it, and then click on the Customize plugin button. This will open that main “Customise DeDRM” dialog which contains a set of buttons describing different type and sources of ebooks. If you have DRMed ebooks that match the description on any of the buttons, you will need to click on the button and enter the required information in the sub-dialog that will pop up. Format factory old version.
All the dialogs have a help link in the top right of the dialog, that gives further information about the required information.
When all the configuration for your DRMed ebooks has been entered, click “OK” in the main dialog to save all the information you’ve entered. You’re now ready to remove the DRM from your ebooks.
Using the DeDRM calibre plugin
The DeDRM calibre plugin removes DRM from ebooks as they are imported into calibre. Clash of clans lvl 10 clan. So to use the plugin, just import your DRMed ebooks into calibre, and the DRM will be removed. If you have already imported your ebooks into calibre, you will need to remove the DRMed ebooks and import them again.
Apprentice Alf Kindle
You can check that the DRM has been removed from an imported ebook by trying to view it using calibre’s built-in viewer. Note that for .azw3 Kindle ebooks you might need to check a checkbox in calibre’s preferences to say that .azw3 ebooks should be viewed using calibre’s internal viewer.
If things go wrong
Apprentice Alf Dedrm
The calibre developers are not involved in the development of the DRM removal plugin, and are not able to help with any DRM removal questions. If you have any difficulties following the instructions in this post, the calibre developers will not be able to help.
Neverwinter mac download. You must ask any questions about installing or using the DeDRM calibre plugin in a comment to most recent post on this blog.
Credits
Most of the work on converting the DRM removal scripts to a calibre plugin has been done by DiapDealer and Apprentice Alf.