tools v6.0.1
This commit is contained in:
Binary file not shown.
@@ -26,13 +26,14 @@ __docformat__ = 'restructuredtext en'
|
||||
#
|
||||
# Revision history:
|
||||
# 6.0.0 - Initial release
|
||||
# 6.0.1 - Bug Fixes for Windows App, Kindle for Mac and Windows Adobe Digital Editions
|
||||
|
||||
"""
|
||||
Decrypt DRMed ebooks.
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = u"DeDRM"
|
||||
PLUGIN_VERSION_TUPLE = (6, 0, 0)
|
||||
PLUGIN_VERSION_TUPLE = (6, 0, 1)
|
||||
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'
|
||||
|
||||
@@ -46,13 +46,14 @@ from __future__ import with_statement
|
||||
# 5.6 - Revised to allow use in Plugins to eliminate need for duplicate code
|
||||
# 5.7 - Unicode support added, renamed adobekey from ineptkey
|
||||
# 5.8 - Added getkey interface for Windows DeDRM application
|
||||
# 5.9 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
"""
|
||||
Retrieve Adobe ADEPT user key.
|
||||
"""
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = '5.8'
|
||||
__version__ = '5.9'
|
||||
|
||||
import sys, os, struct, getopt
|
||||
|
||||
@@ -401,9 +402,11 @@ if iswindows:
|
||||
aes = AES(keykey)
|
||||
userkey = aes.decrypt(userkey)
|
||||
userkey = userkey[26:-ord(userkey[-1])]
|
||||
#print "found key:",userkey.encode('hex')
|
||||
keys.append(userkey)
|
||||
if len(keys) == 0:
|
||||
raise ADEPTError('Could not locate privateLicenseKey')
|
||||
print u"Found {0:d} keys".format(len(keys))
|
||||
return keys
|
||||
|
||||
|
||||
@@ -483,7 +486,8 @@ def usage(progname):
|
||||
print u"Usage:"
|
||||
print u" {0:s} [-h] [<outpath>]".format(progname)
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
print u"{0} v{1}\nCopyright © 2009-2013 i♥cabbages and Apprentice Alf".format(progname,__version__)
|
||||
|
||||
@@ -538,7 +542,7 @@ def cli_main(argv=unicode_argv()):
|
||||
return 0
|
||||
|
||||
|
||||
def gui_main(argv=unicode_argv()):
|
||||
def gui_main():
|
||||
import Tkinter
|
||||
import Tkconstants
|
||||
import tkMessageBox
|
||||
@@ -556,6 +560,7 @@ def gui_main(argv=unicode_argv()):
|
||||
self.text.insert(Tkconstants.END, text)
|
||||
|
||||
|
||||
argv=unicode_argv()
|
||||
root = Tkinter.Tk()
|
||||
root.withdraw()
|
||||
progpath, progname = os.path.split(argv[0])
|
||||
@@ -574,7 +579,7 @@ def gui_main(argv=unicode_argv()):
|
||||
keyfileout.write(key)
|
||||
success = True
|
||||
tkMessageBox.showinfo(progname, u"Key successfully retrieved to {0}".format(outfile))
|
||||
except DrmException, e:
|
||||
except ADEPTError, e:
|
||||
tkMessageBox.showerror(progname, u"Error: {0}".format(str(e)))
|
||||
except Exception:
|
||||
root.wm_state('normal')
|
||||
|
||||
@@ -29,10 +29,6 @@ from calibre_plugins.dedrm.__init__ import RESOURCE_NAME as help_file_name
|
||||
from calibre_plugins.dedrm.utilities import (uStrCmp, DETAILED_MESSAGE)
|
||||
|
||||
import calibre_plugins.dedrm.dialogs as dialogs
|
||||
import calibre_plugins.dedrm.ignoblekeygen as bandn
|
||||
import calibre_plugins.dedrm.erdr2pml as ereader
|
||||
import calibre_plugins.dedrm.adobekey as adobe
|
||||
import calibre_plugins.dedrm.kindlekey as amazon
|
||||
|
||||
JSON_NAME = PLUGIN_NAME.strip().lower().replace(' ', '_')
|
||||
JSON_PATH = os.path.join(u"plugins", JSON_NAME + '.json')
|
||||
@@ -212,6 +208,7 @@ def addvaluetoprefs(prefkind, prefsvalue):
|
||||
def convertprefs(always = False):
|
||||
|
||||
def parseIgnobleString(keystuff):
|
||||
import calibre_plugins.dedrm.ignoblekeygen as bandn
|
||||
userkeys = {}
|
||||
ar = keystuff.split(':')
|
||||
for i, keystring in enumerate(ar):
|
||||
@@ -230,6 +227,7 @@ def convertprefs(always = False):
|
||||
return userkeys
|
||||
|
||||
def parseeReaderString(keystuff):
|
||||
import calibre_plugins.dedrm.erdr2pml as ereader
|
||||
userkeys = {}
|
||||
ar = keystuff.split(':')
|
||||
for i, keystring in enumerate(ar):
|
||||
@@ -302,10 +300,13 @@ def convertprefs(always = False):
|
||||
dedrmprefs['serials'] = []
|
||||
|
||||
# get default adobe adept key(s)
|
||||
import calibre_plugins.dedrm.adobekey as adobe
|
||||
priorkeycount = len(dedrmprefs['adeptkeys'])
|
||||
try:
|
||||
defaultkeys = adobe.adeptkeys()
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
defaultkeys = []
|
||||
defaultcount = 1
|
||||
for keyvalue in defaultkeys:
|
||||
@@ -323,7 +324,8 @@ def convertprefs(always = False):
|
||||
writeprefs(False)
|
||||
|
||||
|
||||
# get default kindle key(s)
|
||||
# get default kindle key(s)
|
||||
import calibre_plugins.dedrm.kindlekey as amazon
|
||||
priorkeycount = len(dedrmprefs['kindlekeys'])
|
||||
try:
|
||||
defaultkeys = amazon.kindlekeys()
|
||||
|
||||
@@ -7,6 +7,7 @@ __license__ = 'GPL v3'
|
||||
# Standard Python modules.
|
||||
import os, sys, re, hashlib
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from PyQt4.Qt import (Qt, QWidget, QHBoxLayout, QVBoxLayout, QLabel, QListWidget, QListWidgetItem, QAbstractItemView, QLineEdit, QPushButton, QIcon, QGroupBox, QDialog, QDialogButtonBox, QUrl, QString)
|
||||
from PyQt4 import QtGui
|
||||
@@ -18,10 +19,6 @@ from calibre.utils.config import dynamic, config_dir, JSONConfig
|
||||
|
||||
from calibre_plugins.dedrm.__init__ import PLUGIN_NAME, PLUGIN_VERSION
|
||||
from calibre_plugins.dedrm.utilities import (uStrCmp, DETAILED_MESSAGE, parseCustString)
|
||||
from calibre_plugins.dedrm.ignoblekeygen import generate_key as generate_bandn_key
|
||||
from calibre_plugins.dedrm.erdr2pml import getuser_key as generate_ereader_key
|
||||
from calibre_plugins.dedrm.adobekey import adeptkeys as retrieve_adept_keys
|
||||
from calibre_plugins.dedrm.kindlekey import kindlekeys as retrieve_kindle_keys
|
||||
|
||||
class ManageKeysDialog(QDialog):
|
||||
def __init__(self, parent, key_type_name, plugin_keys, create_key, keyfile_ext = u""):
|
||||
@@ -393,6 +390,7 @@ class AddBandNKeyDialog(QDialog):
|
||||
|
||||
@property
|
||||
def key_value(self):
|
||||
from calibre_plugins.dedrm.ignoblekeygen import generate_key as generate_bandn_key
|
||||
return generate_bandn_key(self.user_name,self.cc_number)
|
||||
|
||||
@property
|
||||
@@ -473,6 +471,7 @@ class AddEReaderDialog(QDialog):
|
||||
|
||||
@property
|
||||
def key_value(self):
|
||||
from calibre_plugins.dedrm.erdr2pml import getuser_key as generate_ereader_key
|
||||
return generate_ereader_key(self.user_name,self.cc_number).encode('hex')
|
||||
|
||||
@property
|
||||
@@ -505,9 +504,12 @@ class AddAdeptDialog(QDialog):
|
||||
layout = QVBoxLayout(self)
|
||||
self.setLayout(layout)
|
||||
|
||||
from calibre_plugins.dedrm.adobekey import adeptkeys as retrieve_adept_keys
|
||||
try:
|
||||
self.default_key = retrieve_adept_keys()[0]
|
||||
default_keys = retrieve_adept_keys()
|
||||
self.default_key = default_keys[0]
|
||||
except:
|
||||
traceback.print_exc()
|
||||
self.default_key = u""
|
||||
|
||||
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
@@ -567,6 +569,7 @@ class AddKindleDialog(QDialog):
|
||||
layout = QVBoxLayout(self)
|
||||
self.setLayout(layout)
|
||||
|
||||
from calibre_plugins.dedrm.kindlekey import kindlekeys as retrieve_kindle_keys
|
||||
try:
|
||||
self.default_key = retrieve_kindle_keys()[0]
|
||||
except:
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#
|
||||
# Changelog epubtest
|
||||
# 1.00 - Cut to epubtest.py, testing ePub files only by Apprentice Alf
|
||||
# 1.01 - Added routine for use by Windows DeDRM
|
||||
#
|
||||
# Written in 2011 by Paul Durrant
|
||||
# Released with unlicense. See http://unlicense.org/
|
||||
@@ -45,7 +46,7 @@
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
__version__ = '1.00'
|
||||
__version__ = '1.01'
|
||||
|
||||
import sys, struct, os
|
||||
import zlib
|
||||
@@ -72,11 +73,49 @@ class SafeUnbuffered:
|
||||
def __getattr__(self, attr):
|
||||
return getattr(self.stream, attr)
|
||||
|
||||
try:
|
||||
from calibre.constants import iswindows, isosx
|
||||
except:
|
||||
iswindows = sys.platform.startswith('win')
|
||||
isosx = sys.platform.startswith('darwin')
|
||||
|
||||
def unicode_argv():
|
||||
argvencoding = sys.stdin.encoding
|
||||
if argvencoding == None:
|
||||
argvencoding = "utf-8"
|
||||
return [arg if (type(arg) == unicode) else unicode(arg,argvencoding) for arg in sys.argv]
|
||||
if iswindows:
|
||||
# Uses shell32.GetCommandLineArgvW to get sys.argv as a list of Unicode
|
||||
# strings.
|
||||
|
||||
# Versions 2.x of Python don't support Unicode in sys.argv on
|
||||
# Windows, with the underlying Windows API instead replacing multi-byte
|
||||
# characters with '?'. So use shell32.GetCommandLineArgvW to get sys.argv
|
||||
# as a list of Unicode strings and encode them as utf-8
|
||||
|
||||
from ctypes import POINTER, byref, cdll, c_int, windll
|
||||
from ctypes.wintypes import LPCWSTR, LPWSTR
|
||||
|
||||
GetCommandLineW = cdll.kernel32.GetCommandLineW
|
||||
GetCommandLineW.argtypes = []
|
||||
GetCommandLineW.restype = LPCWSTR
|
||||
|
||||
CommandLineToArgvW = windll.shell32.CommandLineToArgvW
|
||||
CommandLineToArgvW.argtypes = [LPCWSTR, POINTER(c_int)]
|
||||
CommandLineToArgvW.restype = POINTER(LPWSTR)
|
||||
|
||||
cmd = GetCommandLineW()
|
||||
argc = c_int(0)
|
||||
argv = CommandLineToArgvW(cmd, byref(argc))
|
||||
if argc.value > 0:
|
||||
# Remove Python executable and commands if present
|
||||
start = argc.value - len(sys.argv)
|
||||
return [argv[i] for i in
|
||||
xrange(start, argc.value)]
|
||||
# if we don't have any arguments at all, just pass back script name
|
||||
# this should never happen
|
||||
return [u"epubtest.py"]
|
||||
else:
|
||||
argvencoding = sys.stdin.encoding
|
||||
if argvencoding == None:
|
||||
argvencoding = "utf-8"
|
||||
return [arg if (type(arg) == unicode) else unicode(arg,argvencoding) for arg in sys.argv]
|
||||
|
||||
_FILENAME_LEN_OFFSET = 26
|
||||
_EXTRA_LEN_OFFSET = 28
|
||||
@@ -129,38 +168,38 @@ def getfiledata(file, zi):
|
||||
|
||||
return data
|
||||
|
||||
def main(argv=unicode_argv()):
|
||||
infile = argv[1]
|
||||
kind = "Unknown"
|
||||
def encryption(infile):
|
||||
# returns encryption: one of Unencrypted, Adobe, B&N and Unknown
|
||||
encryption = "Unknown"
|
||||
with file(infile,'rb') as infileobject:
|
||||
bookdata = infileobject.read(58)
|
||||
# Check for Mobipocket/Kindle
|
||||
if bookdata[0:0+2] == "PK":
|
||||
if bookdata[30:30+28] == 'mimetypeapplication/epub+zip':
|
||||
kind = "ePub"
|
||||
else:
|
||||
kind = "ZIP"
|
||||
encryption = "Unencrypted"
|
||||
foundrights = False
|
||||
foundencryption = False
|
||||
inzip = zipfile.ZipFile(infile,'r')
|
||||
namelist = set(inzip.namelist())
|
||||
if 'META-INF/rights.xml' not in namelist or 'META-INF/encryption.xml' not in namelist:
|
||||
encryption = "Unencrypted"
|
||||
else:
|
||||
rights = etree.fromstring(inzip.read('META-INF/rights.xml'))
|
||||
adept = lambda tag: '{%s}%s' % (NSMAP['adept'], tag)
|
||||
expr = './/%s' % (adept('encryptedKey'),)
|
||||
bookkey = ''.join(rights.findtext(expr))
|
||||
if len(bookkey) == 172:
|
||||
encryption = "Adobe"
|
||||
elif len(bookkey) == 64:
|
||||
encryption = "B&N"
|
||||
try:
|
||||
with open(infile,'rb') as infileobject:
|
||||
bookdata = infileobject.read(58)
|
||||
# Check for Zip
|
||||
if bookdata[0:0+2] == "PK":
|
||||
foundrights = False
|
||||
foundencryption = False
|
||||
inzip = zipfile.ZipFile(infile,'r')
|
||||
namelist = set(inzip.namelist())
|
||||
if 'META-INF/rights.xml' not in namelist or 'META-INF/encryption.xml' not in namelist:
|
||||
encryption = "Unencrypted"
|
||||
else:
|
||||
encryption = "Unknown"
|
||||
rights = etree.fromstring(inzip.read('META-INF/rights.xml'))
|
||||
adept = lambda tag: '{%s}%s' % (NSMAP['adept'], tag)
|
||||
expr = './/%s' % (adept('encryptedKey'),)
|
||||
bookkey = ''.join(rights.findtext(expr))
|
||||
if len(bookkey) == 172:
|
||||
encryption = "Adobe"
|
||||
elif len(bookkey) == 64:
|
||||
encryption = "B&N"
|
||||
else:
|
||||
encryption = "Unknown"
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return encryption
|
||||
|
||||
print u"{0} {1}".format(encryption, kind)
|
||||
def main():
|
||||
argv=unicode_argv()
|
||||
print encryption(argv[1])
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -66,8 +66,9 @@
|
||||
# - Don't reject dictionary format.
|
||||
# - Ignore sidebars for dictionaries (different format?)
|
||||
# 0.22 - Unicode and plugin support, different image folders for PMLZ and source
|
||||
# 0.23 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
__version__='0.22'
|
||||
__version__='0.23'
|
||||
|
||||
import sys, re
|
||||
import struct, binascii, getopt, zlib, os, os.path, urllib, tempfile, traceback
|
||||
@@ -551,9 +552,10 @@ def getuser_key(name,cc):
|
||||
cc = cc.replace(" ","")
|
||||
return struct.pack('>LL', binascii.crc32(newname) & 0xffffffff,binascii.crc32(cc[-8:])& 0xffffffff)
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
print u"eRdr2Pml v{0}. Copyright © 2009–2012 The Dark Reverser et al.".format(__version__)
|
||||
|
||||
argv=unicode_argv()
|
||||
try:
|
||||
opts, args = getopt.getopt(argv[1:], "hp", ["make-pmlz"])
|
||||
except getopt.GetoptError, err:
|
||||
|
||||
@@ -33,13 +33,14 @@ from __future__ import with_statement
|
||||
# 3.6 - Revised to allow use in calibre plugins to eliminate need for duplicate code
|
||||
# 3.7 - Tweaked to match ineptepub more closely
|
||||
# 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
|
||||
|
||||
"""
|
||||
Decrypt Barnes & Noble encrypted ePub books.
|
||||
"""
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = "3.8"
|
||||
__version__ = "3.9"
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -316,7 +317,8 @@ def decryptBook(keyb64, inpath, outpath):
|
||||
return 0
|
||||
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
if len(argv) != 4:
|
||||
print u"usage: {0} <keyfile.b64> <inbook.epub> <outbook.epub>".format(progname)
|
||||
|
||||
@@ -31,13 +31,14 @@ from __future__ import with_statement
|
||||
# 2.3 - Modify interface to allow use of import
|
||||
# 2.4 - Improvements to UI and now works in plugins
|
||||
# 2.5 - Additional improvement for unicode and plugin support
|
||||
# 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
"""
|
||||
Generate Barnes & Noble EPUB user key from name and credit card number.
|
||||
"""
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = "2.5"
|
||||
__version__ = "2.6"
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -214,7 +215,8 @@ def generate_key(name, ccn):
|
||||
|
||||
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
if AES is None:
|
||||
print "%s: This script requires OpenSSL or PyCrypto, which must be installed " \
|
||||
|
||||
@@ -35,13 +35,14 @@ from __future__ import with_statement
|
||||
# 5.7 - Fix for potential problem with PyCrypto
|
||||
# 5.8 - Revised to allow use in calibre plugins to eliminate need for duplicate code
|
||||
# 5.9 - Fixed to retain zip file metadata (e.g. file modification date)
|
||||
# 5.10 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
"""
|
||||
Decrypt Adobe Digital Editions encrypted ePub books.
|
||||
"""
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = "5.9"
|
||||
__version__ = "5.10"
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -458,7 +459,8 @@ def decryptBook(userkey, inpath, outpath):
|
||||
return 0
|
||||
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
if len(argv) != 4:
|
||||
print u"usage: {0} <keyfile.der> <inbook.epub> <outbook.epub>".format(progname)
|
||||
|
||||
@@ -50,13 +50,14 @@ from __future__ import with_statement
|
||||
# 7.11 - More tweaks to fix minor problems.
|
||||
# 7.12 - Revised to allow use in calibre plugins to eliminate need for duplicate code
|
||||
# 7.13 - Fixed erroneous mentions of ineptepub
|
||||
# 7.14 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
"""
|
||||
Decrypts Adobe ADEPT-encrypted PDF files.
|
||||
"""
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = "7.13"
|
||||
__version__ = "7.14"
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -2185,7 +2186,8 @@ def decryptBook(userkey, inpath, outpath):
|
||||
return 0
|
||||
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
if len(argv) != 4:
|
||||
print u"usage: {0} <keyfile.der> <inbook.pdf> <outbook.pdf>".format(progname)
|
||||
|
||||
@@ -53,8 +53,9 @@ from __future__ import with_statement
|
||||
# 4.9 - Missed some invalid characters in cleanup_name
|
||||
# 5.0 - Extraction of info from Kindle for PC/Mac moved into kindlekey.py
|
||||
# - tweaked GetDecryptedBook interface to leave passed parameters unchanged
|
||||
# 5.1 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
__version__ = '5.0'
|
||||
__version__ = '5.1'
|
||||
|
||||
|
||||
import sys, os, re
|
||||
@@ -276,7 +277,8 @@ def usage(progname):
|
||||
#
|
||||
# Main
|
||||
#
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
print u"K4MobiDeDrm v{0}.\nCopyright © 2008-2013 The Dark Reverser et al.".format(__version__)
|
||||
|
||||
|
||||
@@ -15,13 +15,16 @@ from __future__ import with_statement
|
||||
# 1.3 - Added getkey interface for Windows DeDRM application
|
||||
# Simplified some of the Kindle for Mac code.
|
||||
# 1.4 - Remove dependency on alfcrypto
|
||||
# 1.5 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
# 1.6 - Fixed a problem getting the disk serial numbers
|
||||
|
||||
|
||||
"""
|
||||
Retrieve Kindle for PC/Mac user key.
|
||||
"""
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = '1.4'
|
||||
__version__ = '1.6'
|
||||
|
||||
import sys, os, re
|
||||
from struct import pack, unpack, unpack_from
|
||||
@@ -1266,10 +1269,10 @@ elif isosx:
|
||||
# uses a sub process to get the Hard Drive Serial Number using ioreg
|
||||
# returns serial numbers of all internal hard drive drives
|
||||
def GetVolumesSerialNumbers():
|
||||
sernums = []
|
||||
sernum = os.getenv('MYSERIALNUMBER')
|
||||
if sernum != None:
|
||||
return [sernum]
|
||||
sernums = []
|
||||
sernums.append(sernum.strip())
|
||||
cmdline = '/usr/sbin/ioreg -w 0 -r -c AppleAHCIDiskDriver'
|
||||
cmdline = cmdline.encode(sys.getfilesystemencoding())
|
||||
p = subprocess.Popen(cmdline, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=False)
|
||||
@@ -1285,7 +1288,7 @@ elif isosx:
|
||||
if pp >= 0:
|
||||
sernum = resline[pp+19:-1]
|
||||
sernums.append(sernum.strip())
|
||||
return [sernum]
|
||||
return sernums
|
||||
|
||||
def GetUserHomeAppSupKindleDirParitionName():
|
||||
home = os.getenv('HOME')
|
||||
@@ -1311,10 +1314,11 @@ elif isosx:
|
||||
return disk
|
||||
|
||||
# uses a sub process to get the UUID of the specified disk partition using ioreg
|
||||
def GetDiskPartitionUUID(diskpart):
|
||||
def GetDiskPartitionUUIDs(diskpart):
|
||||
uuids = []
|
||||
uuidnum = os.getenv('MYUUIDNUMBER')
|
||||
if uuidnum != None:
|
||||
return uuidnum
|
||||
uuids.append(strip(uuidnum))
|
||||
cmdline = '/usr/sbin/ioreg -l -S -w 0 -r -c AppleAHCIDiskDriver'
|
||||
cmdline = cmdline.encode(sys.getfilesystemencoding())
|
||||
p = subprocess.Popen(cmdline, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=False)
|
||||
@@ -1357,14 +1361,15 @@ elif isosx:
|
||||
uuidnest = -1
|
||||
uuidnum = None
|
||||
bsdname = None
|
||||
if not foundIt:
|
||||
uuidnum = ''
|
||||
return uuidnum
|
||||
if foundIt:
|
||||
uuids.append(uuidnum)
|
||||
return uuids
|
||||
|
||||
def GetMACAddressMunged():
|
||||
def GetMACAddressesMunged():
|
||||
macnums = []
|
||||
macnum = os.getenv('MYMACNUM')
|
||||
if macnum != None:
|
||||
return macnum
|
||||
macnums.append(macnum)
|
||||
cmdline = '/sbin/ifconfig en0'
|
||||
cmdline = cmdline.encode(sys.getfilesystemencoding())
|
||||
p = subprocess.Popen(cmdline, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=False)
|
||||
@@ -1399,9 +1404,9 @@ elif isosx:
|
||||
macnum = '%0.2x%0.2x%0.2x%0.2x%0.2x%0.2x' % (mlst[0], mlst[1], mlst[2], mlst[3], mlst[4], mlst[5])
|
||||
foundIt = True
|
||||
break
|
||||
if not foundIt:
|
||||
macnum = ''
|
||||
return macnum
|
||||
if foundIt:
|
||||
macnums.append(macnum)
|
||||
return macnums
|
||||
|
||||
|
||||
# uses unix env to get username instead of using sysctlbyname
|
||||
@@ -1412,11 +1417,12 @@ elif isosx:
|
||||
def GetIDStrings():
|
||||
# Return all possible ID Strings
|
||||
strings = []
|
||||
strings.append(GetMACAddressMunged())
|
||||
strings.extend(GetMACAddressesMunged())
|
||||
strings.extend(GetVolumesSerialNumbers())
|
||||
diskpart = GetUserHomeAppSupKindleDirParitionName()
|
||||
strings.append(GetDiskPartitionUUID(diskpart))
|
||||
strings.extend(GetDiskPartitionUUIDs(diskpart))
|
||||
strings.append('9999999999')
|
||||
#print strings
|
||||
return strings
|
||||
|
||||
|
||||
@@ -1797,7 +1803,8 @@ def usage(progname):
|
||||
print u" {0:s} [-h] [-k <kindle.info>] [<outpath>]".format(progname)
|
||||
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
print u"{0} v{1}\nCopyright © 2010-2013 some_updates and Apprentice Alf".format(progname,__version__)
|
||||
|
||||
@@ -1837,7 +1844,7 @@ def cli_main(argv=unicode_argv()):
|
||||
return 0
|
||||
|
||||
|
||||
def gui_main(argv=unicode_argv()):
|
||||
def gui_main():
|
||||
import Tkinter
|
||||
import Tkconstants
|
||||
import tkMessageBox
|
||||
@@ -1855,6 +1862,7 @@ def gui_main(argv=unicode_argv()):
|
||||
self.text.insert(Tkconstants.END, text)
|
||||
|
||||
|
||||
argv=unicode_argv()
|
||||
root = Tkinter.Tk()
|
||||
root.withdraw()
|
||||
progpath, progname = os.path.split(argv[0])
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
# 0.3 changed to autoflush stdout, fixed return code usage
|
||||
# 0.3 updated for unicode
|
||||
# 0.4 Added support for serial numbers starting with '9', fixed unicode bugs.
|
||||
# 0.5 moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
import sys
|
||||
import binascii
|
||||
@@ -111,8 +112,9 @@ def pidFromSerial(s, l):
|
||||
|
||||
return pid
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
print u"Mobipocket PID calculator for Amazon Kindle. Copyright © 2007, 2009 Igor Skochinsky"
|
||||
argv=unicode_argv()
|
||||
if len(argv)==2:
|
||||
serial = argv[1]
|
||||
else:
|
||||
|
||||
@@ -67,9 +67,10 @@
|
||||
# 0.37 - Fixed double announcement for stand-alone operation
|
||||
# 0.38 - Unicode used wherever possible, cope with absent alfcrypto
|
||||
# 0.39 - Fixed problem with TEXtREAd and getBookType interface
|
||||
# 0.40 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
|
||||
__version__ = u"0.39"
|
||||
__version__ = u"0.40"
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -506,7 +507,8 @@ def getUnencryptedBook(infile,pidlist):
|
||||
return book.mobi_data
|
||||
|
||||
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
if len(argv)<3 or len(argv)>4:
|
||||
print u"MobiDeDrm v{0}.\nCopyright © 2008-2012 The Dark Reverser et al.".format(__version__)
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# topazextract.py, version ?
|
||||
# topazextract.py
|
||||
# Mostly written by some_updates based on code from many others
|
||||
|
||||
__version__ = '4.8'
|
||||
# Changelog
|
||||
# 4.9 - moved unicode_argv call inside main for Windows DeDRM compatibility
|
||||
|
||||
__version__ = '4.9'
|
||||
|
||||
import sys
|
||||
import os, csv, getopt
|
||||
@@ -442,7 +445,8 @@ def usage(progname):
|
||||
print u" {0} [-k <kindle.k4i>] [-p <comma separated PIDs>] [-s <comma separated Kindle serial numbers>] <infile> <outdir>".format(progname)
|
||||
|
||||
# Main
|
||||
def cli_main(argv=unicode_argv()):
|
||||
def cli_main():
|
||||
argv=unicode_argv()
|
||||
progname = os.path.basename(argv[0])
|
||||
print u"TopazExtract v{0}.".format(__version__)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Do **NOT** select "Get plugins to enhance calibre" as this is reserved for "offi
|
||||
|
||||
Customization
|
||||
-------------
|
||||
On Windows and Mac, the keys for ebooks downloaded for Kindle for Mac/PC and Adobe Digital Editions are automatically generated. If all your DRMed ebooks can be opened and read in Kindle for Mac/PC and/or Adobe Digital Editions on the same computer on which you are running calibre, you do not need to do any configuration of this plugin. On Linux, keys for Kindle for PC and Adobe Figital Editions need to be generated separately (see Linux systems section)
|
||||
On Windows and Mac, the keys for ebooks downloaded for Kindle for Mac/PC and Adobe Digital Editions are automatically generated. If all your DRMed ebooks can be opened and read in Kindle for Mac/PC and/or Adobe Digital Editions on the same computer on which you are running calibre, you do not need to do any configuration of this plugin. On Linux, keys for Kindle for PC and Adobe Digital Editions need to be generated separately (see Linux systems section)
|
||||
|
||||
Otherwise, highlight the plugin (DeDRM under the "File type plugins" category) and click the "Customize Plugin" button.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user