New approach to Android backup files. Changed version number to 6.3.1

This commit is contained in:
apprenticeharper 2015-08-02 11:09:35 +01:00
parent f5e66d42a1
commit aa822de138
24 changed files with 158 additions and 105 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.3.0 Written 20102015 by Apprentice Alf et al.</string> <string>DeDRM AppleScript 6.3.1 Written 20102015 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.3.0</string> <string>6.3.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>dplt</string> <string>dplt</string>
<key>LSRequiresCarbon</key> <key>LSRequiresCarbon</key>
@ -48,6 +48,7 @@
<key>bundleDividerCollapsed</key> <key>bundleDividerCollapsed</key>
<false/> <false/>
<key>bundlePositionOfDivider</key> <key>bundlePositionOfDivider</key>
<real>1162</real>
<key>dividerCollapsed</key> <key>dividerCollapsed</key>
<false/> <false/>
<key>eventLogLevel</key> <key>eventLogLevel</key>
@ -55,9 +56,9 @@
<key>name</key> <key>name</key>
<string>ScriptWindowState</string> <string>ScriptWindowState</string>
<key>positionOfDivider</key> <key>positionOfDivider</key>
<real>439</real> <real>652</real>
<key>savedFrame</key> <key>savedFrame</key>
<string>128 98 1246 778 0 0 1680 1027 </string> <string>0 36 1680 991 0 0 1680 1027 </string>
<key>selectedTab</key> <key>selectedTab</key>
<string>log</string> <string>log</string>
</dict> </dict>

View File

@ -42,6 +42,7 @@ __docformat__ = 'restructuredtext en'
# 6.2.1 - Fix for non-ascii Windows user names # 6.2.1 - Fix for non-ascii Windows user names
# 6.2.2 - Added URL method for B&N/nook books # 6.2.2 - Added URL method for B&N/nook books
# 6.3.0 - Added in Kindle for Android serial number solution # 6.3.0 - Added in Kindle for Android serial number solution
# 6.3.1 - Version number bump for clarity
""" """
@ -49,7 +50,7 @@ Decrypt DRMed ebooks.
""" """
PLUGIN_NAME = u"DeDRM" PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 3, 0) PLUGIN_VERSION_TUPLE = (6, 3, 1)
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'

View File

@ -1,4 +1,4 @@
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160 {\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170
{\fonttbl} {\fonttbl}
{\colortbl;\red255\green255\blue255;} {\colortbl;\red255\green255\blue255;}
} }

View File

@ -30,7 +30,7 @@ Fetch Barnes & Noble EPUB user key from B&N servers using email and password
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "1.0" __version__ = "1.1"
import sys import sys
import os import os
@ -101,23 +101,23 @@ class IGNOBLEError(Exception):
pass pass
def fetch_key(email, password): def fetch_key(email, password):
# change name and CC numbers to utf-8 if unicode # change email and password to utf-8 if unicode
if type(email)==unicode: if type(email)==unicode:
email = email.encode('utf-8') email = email.encode('utf-8')
if type(password)==unicode: if type(password)==unicode:
password = password.encode('utf-8') password = password.encode('utf-8')
import random import random
random = "%030x" % random.randrange(16**30) random = "%030x" % random.randrange(16**30)
import urllib, urllib2, re import urllib, urllib2, re
# try the URL from nook for PC # try the URL from nook for PC
fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword=" fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword="
fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress=" fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB" fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url #print fetch_url
found = '' found = ''
try: try:
req = urllib2.Request(fetch_url) req = urllib2.Request(fetch_url)
@ -133,13 +133,13 @@ def fetch_key(email, password):
fetch_url += urllib.quote(password,'')+"&devID=hobbes_9.3.50818_"+random+"&emailAddress=" fetch_url += urllib.quote(password,'')+"&devID=hobbes_9.3.50818_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB" fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url #print fetch_url
found = '' found = ''
try: try:
req = urllib2.Request(fetch_url) req = urllib2.Request(fetch_url)
response = urllib2.urlopen(req) response = urllib2.urlopen(req)
the_page = response.read() the_page = response.read()
#print the_page #print the_page
found = re.search('ccHash>(.+?)</ccHash', the_page).group(1) found = re.search('ccHash>(.+?)</ccHash', the_page).group(1)
except: except:
found = '' found = ''
@ -169,6 +169,7 @@ def cli_main():
def gui_main(): def gui_main():
try: try:
import Tkinter import Tkinter
import tkFileDialog
import Tkconstants import Tkconstants
import tkMessageBox import tkMessageBox
import traceback import traceback

View File

@ -33,13 +33,14 @@ from __future__ import with_statement
# 2.5 - Additional improvement for unicode and plugin support # 2.5 - Additional improvement for unicode and plugin support
# 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility # 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility
# 2.7 - Work if TkInter is missing # 2.7 - Work if TkInter is missing
# 2.8 - Fix bug in stand-alone use (import tkFileDialog)
""" """
Generate Barnes & Noble EPUB user key from name and credit card number. Generate Barnes & Noble EPUB user key from name and credit card number.
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "2.7" __version__ = "2.8"
import sys import sys
import os import os
@ -240,6 +241,7 @@ def gui_main():
import Tkinter import Tkinter
import Tkconstants import Tkconstants
import tkMessageBox import tkMessageBox
import tkFileDialog
import traceback import traceback
except: except:
return cli_main() return cli_main()

View File

@ -323,8 +323,8 @@ def cli_main():
serials = a.split(',') serials = a.split(',')
if o == '-a': if o == '-a':
if a == None: if a == None:
continue raise DrmException("Invalid parameter for -a")
androidFiles.apprend(a) androidFiles.append(a)
# try with built in Kindle Info files if not on Linux # try with built in Kindle Info files if not on Linux
k4 = not sys.platform.startswith('linux') k4 = not sys.platform.startswith('linux')

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# DeDRM.pyw # DeDRM.pyw
# Copyright 2010-2013 some_updates and Apprentice Alf # Copyright 2010-2015 some_updates, Apprentice Alf and Apprentice Harper
# Revision history: # Revision history:
# 6.0.0 - Release along with unified plugin # 6.0.0 - Release along with unified plugin
@ -15,8 +15,9 @@
# 6.2.1 - Fix for non-ascii user names # 6.2.1 - Fix for non-ascii user names
# 6.2.2 - Added URL method for B&N/nook books # 6.2.2 - Added URL method for B&N/nook books
# 6.3.0 - Add in Android support # 6.3.0 - Add in Android support
# 6.3.1 - Version bump for clarity
__version__ = '6.3.0' __version__ = '6.3.1'
import sys import sys
import os, os.path import os, os.path
@ -167,7 +168,7 @@ class PrefsDialog(Toplevel):
body.pack(fill=Tkconstants.X, expand=1) body.pack(fill=Tkconstants.X, expand=1)
sticky = Tkconstants.E + Tkconstants.W sticky = Tkconstants.E + Tkconstants.W
body.grid_columnconfigure(1, weight=2) body.grid_columnconfigure(1, weight=2)
cur_row = 0 cur_row = 0
Tkinter.Label(body, text='Adobe Key file (adeptkey.der)').grid(row=cur_row, sticky=Tkconstants.E) Tkinter.Label(body, text='Adobe Key file (adeptkey.der)').grid(row=cur_row, sticky=Tkconstants.E)
self.adkpath = Tkinter.Entry(body, width=50) self.adkpath = Tkinter.Entry(body, width=50)

View File

@ -42,6 +42,7 @@ __docformat__ = 'restructuredtext en'
# 6.2.1 - Fix for non-ascii Windows user names # 6.2.1 - Fix for non-ascii Windows user names
# 6.2.2 - Added URL method for B&N/nook books # 6.2.2 - Added URL method for B&N/nook books
# 6.3.0 - Added in Kindle for Android serial number solution # 6.3.0 - Added in Kindle for Android serial number solution
# 6.3.1 - Version number bump for clarity
""" """
@ -49,7 +50,7 @@ Decrypt DRMed ebooks.
""" """
PLUGIN_NAME = u"DeDRM" PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 3, 0) PLUGIN_VERSION_TUPLE = (6, 3, 1)
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'

View File

@ -30,7 +30,7 @@ Fetch Barnes & Noble EPUB user key from B&N servers using email and password
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "1.0" __version__ = "1.1"
import sys import sys
import os import os
@ -101,23 +101,23 @@ class IGNOBLEError(Exception):
pass pass
def fetch_key(email, password): def fetch_key(email, password):
# change name and CC numbers to utf-8 if unicode # change email and password to utf-8 if unicode
if type(email)==unicode: if type(email)==unicode:
email = email.encode('utf-8') email = email.encode('utf-8')
if type(password)==unicode: if type(password)==unicode:
password = password.encode('utf-8') password = password.encode('utf-8')
import random import random
random = "%030x" % random.randrange(16**30) random = "%030x" % random.randrange(16**30)
import urllib, urllib2, re import urllib, urllib2, re
# try the URL from nook for PC # try the URL from nook for PC
fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword=" fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword="
fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress=" fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB" fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url #print fetch_url
found = '' found = ''
try: try:
req = urllib2.Request(fetch_url) req = urllib2.Request(fetch_url)
@ -133,13 +133,13 @@ def fetch_key(email, password):
fetch_url += urllib.quote(password,'')+"&devID=hobbes_9.3.50818_"+random+"&emailAddress=" fetch_url += urllib.quote(password,'')+"&devID=hobbes_9.3.50818_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB" fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url #print fetch_url
found = '' found = ''
try: try:
req = urllib2.Request(fetch_url) req = urllib2.Request(fetch_url)
response = urllib2.urlopen(req) response = urllib2.urlopen(req)
the_page = response.read() the_page = response.read()
#print the_page #print the_page
found = re.search('ccHash>(.+?)</ccHash', the_page).group(1) found = re.search('ccHash>(.+?)</ccHash', the_page).group(1)
except: except:
found = '' found = ''
@ -169,6 +169,7 @@ def cli_main():
def gui_main(): def gui_main():
try: try:
import Tkinter import Tkinter
import tkFileDialog
import Tkconstants import Tkconstants
import tkMessageBox import tkMessageBox
import traceback import traceback

View File

@ -33,13 +33,14 @@ from __future__ import with_statement
# 2.5 - Additional improvement for unicode and plugin support # 2.5 - Additional improvement for unicode and plugin support
# 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility # 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility
# 2.7 - Work if TkInter is missing # 2.7 - Work if TkInter is missing
# 2.8 - Fix bug in stand-alone use (import tkFileDialog)
""" """
Generate Barnes & Noble EPUB user key from name and credit card number. Generate Barnes & Noble EPUB user key from name and credit card number.
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "2.7" __version__ = "2.8"
import sys import sys
import os import os
@ -240,6 +241,7 @@ def gui_main():
import Tkinter import Tkinter
import Tkconstants import Tkconstants
import tkMessageBox import tkMessageBox
import tkFileDialog
import traceback import traceback
except: except:
return cli_main() return cli_main()

View File

@ -323,8 +323,8 @@ def cli_main():
serials = a.split(',') serials = a.split(',')
if o == '-a': if o == '-a':
if a == None: if a == None:
continue raise DrmException("Invalid parameter for -a")
androidFiles.apprend(a) androidFiles.append(a)
# try with built in Kindle Info files if not on Linux # try with built in Kindle Info files if not on Linux
k4 = not sys.platform.startswith('linux') k4 = not sys.platform.startswith('linux')

View File

@ -42,6 +42,7 @@ __docformat__ = 'restructuredtext en'
# 6.2.1 - Fix for non-ascii Windows user names # 6.2.1 - Fix for non-ascii Windows user names
# 6.2.2 - Added URL method for B&N/nook books # 6.2.2 - Added URL method for B&N/nook books
# 6.3.0 - Added in Kindle for Android serial number solution # 6.3.0 - Added in Kindle for Android serial number solution
# 6.3.1 - Version number bump for clarity
""" """
@ -49,7 +50,7 @@ Decrypt DRMed ebooks.
""" """
PLUGIN_NAME = u"DeDRM" PLUGIN_NAME = u"DeDRM"
PLUGIN_VERSION_TUPLE = (6, 3, 0) PLUGIN_VERSION_TUPLE = (6, 3, 1)
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'

View File

@ -30,7 +30,7 @@ Fetch Barnes & Noble EPUB user key from B&N servers using email and password
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "1.0" __version__ = "1.1"
import sys import sys
import os import os
@ -101,23 +101,23 @@ class IGNOBLEError(Exception):
pass pass
def fetch_key(email, password): def fetch_key(email, password):
# change name and CC numbers to utf-8 if unicode # change email and password to utf-8 if unicode
if type(email)==unicode: if type(email)==unicode:
email = email.encode('utf-8') email = email.encode('utf-8')
if type(password)==unicode: if type(password)==unicode:
password = password.encode('utf-8') password = password.encode('utf-8')
import random import random
random = "%030x" % random.randrange(16**30) random = "%030x" % random.randrange(16**30)
import urllib, urllib2, re import urllib, urllib2, re
# try the URL from nook for PC # try the URL from nook for PC
fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword=" fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword="
fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress=" fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB" fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url #print fetch_url
found = '' found = ''
try: try:
req = urllib2.Request(fetch_url) req = urllib2.Request(fetch_url)
@ -133,13 +133,13 @@ def fetch_key(email, password):
fetch_url += urllib.quote(password,'')+"&devID=hobbes_9.3.50818_"+random+"&emailAddress=" fetch_url += urllib.quote(password,'')+"&devID=hobbes_9.3.50818_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB" fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url #print fetch_url
found = '' found = ''
try: try:
req = urllib2.Request(fetch_url) req = urllib2.Request(fetch_url)
response = urllib2.urlopen(req) response = urllib2.urlopen(req)
the_page = response.read() the_page = response.read()
#print the_page #print the_page
found = re.search('ccHash>(.+?)</ccHash', the_page).group(1) found = re.search('ccHash>(.+?)</ccHash', the_page).group(1)
except: except:
found = '' found = ''
@ -169,6 +169,7 @@ def cli_main():
def gui_main(): def gui_main():
try: try:
import Tkinter import Tkinter
import tkFileDialog
import Tkconstants import Tkconstants
import tkMessageBox import tkMessageBox
import traceback import traceback

View File

@ -33,13 +33,14 @@ from __future__ import with_statement
# 2.5 - Additional improvement for unicode and plugin support # 2.5 - Additional improvement for unicode and plugin support
# 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility # 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility
# 2.7 - Work if TkInter is missing # 2.7 - Work if TkInter is missing
# 2.8 - Fix bug in stand-alone use (import tkFileDialog)
""" """
Generate Barnes & Noble EPUB user key from name and credit card number. Generate Barnes & Noble EPUB user key from name and credit card number.
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "2.7" __version__ = "2.8"
import sys import sys
import os import os
@ -240,6 +241,7 @@ def gui_main():
import Tkinter import Tkinter
import Tkconstants import Tkconstants
import tkMessageBox import tkMessageBox
import tkFileDialog
import traceback import traceback
except: except:
return cli_main() return cli_main()

View File

@ -323,8 +323,8 @@ def cli_main():
serials = a.split(',') serials = a.split(',')
if o == '-a': if o == '-a':
if a == None: if a == None:
continue raise DrmException("Invalid parameter for -a")
androidFiles.apprend(a) androidFiles.append(a)
# try with built in Kindle Info files if not on Linux # try with built in Kindle Info files if not on Linux
k4 = not sys.platform.startswith('linux') k4 = not sys.platform.startswith('linux')

View File

@ -3,13 +3,14 @@
from __future__ import with_statement from __future__ import with_statement
# ignoblekeyfetch.pyw, version 1.0 # ignoblekeyfetch.pyw, version 1.1
# Copyright © 2015 Apprentice Harper # Copyright © 2015 Apprentice Harper
# 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/>
# Based on discoveries by "Nobody You Know" # Based on discoveries by "Nobody You Know"
# Code partly based on ignoblekeygen.py 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 from # We recommend ActiveState Python 2.7.X for Windows from
@ -17,18 +18,19 @@ from __future__ import with_statement
# Then save this script file as ignoblekeyfetch.pyw and double-click on it to run it. # Then save this script file as ignoblekeyfetch.pyw and double-click on it to run it.
# #
# Mac OS X users: Save this script file as ignoblekeyfetch.pyw. You can run this # Mac OS X users: Save this script file as ignoblekeyfetch.pyw. You can run this
# program from the command line (python ignoblekeygen.pyw) or by double-clicking # program from the command line (python ignoblekeyfetch.pyw) or by double-clicking
# it when it has been associated with PythonLauncher. # it when it has been associated with PythonLauncher.
# Revision history: # Revision history:
# 1.0 - Initial release # 1.0 - Initial version
# 1.1 - Try second URL if first one fails
""" """
Fetch Barnes & Noble EPUB user key from B&N servers using email and password Fetch Barnes & Noble EPUB user key from B&N servers using email and password
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "1.0" __version__ = "1.1"
import sys import sys
import os import os
@ -87,7 +89,7 @@ def unicode_argv():
xrange(start, argc.value)] xrange(start, argc.value)]
# if we don't have any arguments at all, just pass back script name # if we don't have any arguments at all, just pass back script name
# this should never happen # this should never happen
return [u"ignoblekeygen.py"] return [u"ignoblekeyfetch.py"]
else: else:
argvencoding = sys.stdin.encoding argvencoding = sys.stdin.encoding
if argvencoding == None: if argvencoding == None:
@ -99,33 +101,49 @@ class IGNOBLEError(Exception):
pass pass
def fetch_key(email, password): def fetch_key(email, password):
# remove spaces and case from name and CC numbers. # change email and password to utf-8 if unicode
if type(email)==unicode: if type(email)==unicode:
email = email.encode('utf-8') email = email.encode('utf-8')
if type(password)==unicode: if type(password)==unicode:
password = password.encode('utf-8') password = password.encode('utf-8')
import random import random
random = "%030x" % random.randrange(16**30) random = "%030x" % random.randrange(16**30)
import urllib, urllib2 import urllib, urllib2, re
# try the URL from nook for PC
fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword=" fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword="
fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress=" fetch_url += urllib.quote(password,'')+"&devID=PC_BN_2.5.6.9575_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB" fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url #print fetch_url
found = '' found = ''
try: try:
req = urllib2.Request(fetch_url) req = urllib2.Request(fetch_url)
response = urllib2.urlopen(req) response = urllib2.urlopen(req)
the_page = response.read() the_page = response.read()
#print the_page #print the_page
import re
found = re.search('ccHash>(.+?)</ccHash', the_page).group(1) found = re.search('ccHash>(.+?)</ccHash', the_page).group(1)
except: except:
found = '' found = ''
if len(found)!=28:
# try the URL from android devices
fetch_url = "https://cart4.barnesandnoble.com/services/service.aspx?Version=2&acctPassword="
fetch_url += urllib.quote(password,'')+"&devID=hobbes_9.3.50818_"+random+"&emailAddress="
fetch_url += urllib.quote(email,"")+"&outFormat=5&schema=1&service=1&stage=deviceHashB"
#print fetch_url
found = ''
try:
req = urllib2.Request(fetch_url)
response = urllib2.urlopen(req)
the_page = response.read()
#print the_page
found = re.search('ccHash>(.+?)</ccHash', the_page).group(1)
except:
found = ''
return found return found
@ -151,6 +169,7 @@ def cli_main():
def gui_main(): def gui_main():
try: try:
import Tkinter import Tkinter
import tkFileDialog
import Tkconstants import Tkconstants
import tkMessageBox import tkMessageBox
import traceback import traceback

View File

@ -33,13 +33,14 @@ from __future__ import with_statement
# 2.5 - Additional improvement for unicode and plugin support # 2.5 - Additional improvement for unicode and plugin support
# 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility # 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility
# 2.7 - Work if TkInter is missing # 2.7 - Work if TkInter is missing
# 2.8 - Fix bug in stand-alone use (import tkFileDialog)
""" """
Generate Barnes & Noble EPUB user key from name and credit card number. Generate Barnes & Noble EPUB user key from name and credit card number.
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = "2.7" __version__ = "2.8"
import sys import sys
import os import os

View File

@ -14,14 +14,15 @@ from __future__ import with_statement
# 1.2 - Changed to be callable from AppleScript by returning only serial number # 1.2 - Changed to be callable from AppleScript by returning only serial number
# - and changed name to androidkindlekey.py # - and changed name to androidkindlekey.py
# - and added in unicode command line support # - and added in unicode command line support
# 1.3 - added in TkInter interface, output to a file and attempt to get backup from a connected android device. # 1.3 - added in TkInter interface, output to a file
# 1.4 - Fix some problems identified by Aldo Bleeker
""" """
Retrieve Kindle for Android Serial Number. Retrieve Kindle for Android Serial Number.
""" """
__license__ = 'GPL v3' __license__ = 'GPL v3'
__version__ = '1.3' __version__ = '1.4'
import os import os
import sys import sys
@ -199,13 +200,16 @@ def get_serials1(path=STORAGE1):
return [] return []
serials = [] serials = []
if dsnid:
serials.append(dsnid)
for token in tokens: for token in tokens:
if token: if token:
serials.append('%s%s' % (dsnid, token)) serials.append('%s%s' % (dsnid, token))
serials.append(token)
return serials return serials
def get_serials2(path=STORAGE2): def get_serials2(path=STORAGE2):
''' get serials from android's shared preference xml ''' ''' get serials from android's sql database '''
if not os.path.isfile(path): if not os.path.isfile(path):
return [] return []
@ -213,14 +217,32 @@ def get_serials2(path=STORAGE2):
connection = sqlite3.connect(path) connection = sqlite3.connect(path)
cursor = connection.cursor() cursor = connection.cursor()
cursor.execute('''select userdata_value from userdata where userdata_key like '%/%token.device.deviceserialname%' ''') cursor.execute('''select userdata_value from userdata where userdata_key like '%/%token.device.deviceserialname%' ''')
dsns = [x[0].encode('utf8') for x in cursor.fetchall()] userdata_keys = cursor.fetchall()
dsns = []
for userdata_row in userdata_keys:
if userdata_row:
userdata_utf8 = userdata_row[0].encode('utf8')
if len(userdata_utf8) > 0:
dsns.append(userdata_utf8)
dsns = list(set(dsns))
cursor.execute('''select userdata_value from userdata where userdata_key like '%/%kindle.account.tokens%' ''') cursor.execute('''select userdata_value from userdata where userdata_key like '%/%kindle.account.tokens%' ''')
tokens = [x[0].encode('utf8') for x in cursor.fetchall()] userdata_keys = cursor.fetchall()
tokens = []
for userdata_row in userdata_keys:
if userdata_row:
userdata_utf8 = userdata_row[0].encode('utf8')
if len(userdata_utf8) > 0:
tokens.append(userdata_utf8)
tokens = list(set(tokens))
serials = [] serials = []
for x in dsns: for x in dsns:
serials.append(x)
for y in tokens: for y in tokens:
serials.append('%s%s' % (x, y)) serials.append('%s%s' % (x, y))
for y in tokens:
serials.append(y)
return serials return serials
def get_serials(path=STORAGE): def get_serials(path=STORAGE):
@ -269,46 +291,31 @@ def get_serials(path=STORAGE):
write_path = os.path.abspath(write.name) write_path = os.path.abspath(write.name)
serials.extend(get_serials2(write_path)) serials.extend(get_serials2(write_path))
os.remove(write_path) os.remove(write_path)
return list(set(serials))
return serials
__all__ = [ 'get_serials', 'getkey'] __all__ = [ 'get_serials', 'getkey']
# interface for Python DeDRM # procedure for CLI and GUI interfaces
# returns single key or multiple keys, depending on path or file passed in # returns single or multiple keys (one per line) in the specified file
def getkey(outpath, inpath): def getkey(outfile, inpath):
keys = get_serials(inpath) keys = get_serials(inpath)
if len(keys) > 0: if len(keys) > 0:
if not os.path.isdir(outpath): with file(outfile, 'w') as keyfileout:
outfile = outpath
with file(outfile, 'w') as keyfileout:
keyfileout.write(keys[0])
print u"Saved a key to {0}".format(outfile)
else:
keycount = 0
for key in keys: for key in keys:
while True: keyfileout.write(key)
keycount += 1 keyfileout.write("\n")
outfile = os.path.join(outpath,u"kindlekey{0:d}.k4a".format(keycount))
if not os.path.exists(outfile):
break
with file(outfile, 'w') as keyfileout:
keyfileout.write(key)
print u"Saved a key to {0}".format(outfile)
return True return True
return False return False
def usage(progname): def usage(progname):
print u"{0} v{1}\nCopyright © 2013-2015 Thom and Apprentice Harper".format(progname,__version__) print u"Decrypts the serial number(s) of Kindle For Android from Android backup or file"
print u"Decrypts the serial number of Kindle For Android from Android backup or file"
print u"Get backup.ab file using adb backup com.amazon.kindle for Android 4.0+." print u"Get backup.ab file using adb backup com.amazon.kindle for Android 4.0+."
print u"Otherwise extract AmazonSecureStorage.xml from /data/data/com.amazon.kindle/shared_prefs/AmazonSecureStorage.xml" print u"Otherwise extract AmazonSecureStorage.xml from /data/data/com.amazon.kindle/shared_prefs/AmazonSecureStorage.xml"
print u"Or map_data_storage.db from /data/data/com.amazon.kindle/databases/map_data_storage.db" print u"Or map_data_storage.db from /data/data/com.amazon.kindle/databases/map_data_storage.db"
print u"" print u""
print u"Serial number is written to standard output."
print u"Usage:" print u"Usage:"
print u" {0:s} [-h] [-b <backup.ab>] [<outpath>]".format(progname) print u" {0:s} [-h] [-b <backup.ab>] [<outfile.k4a>]".format(progname)
def cli_main(): def cli_main():
@ -339,24 +346,28 @@ def cli_main():
if len(args) == 1: if len(args) == 1:
# save to the specified file or directory # save to the specified file or directory
outpath = args[0] outfile = args[0]
if not os.path.isabs(outpath): if not os.path.isabs(outfile):
outpath = os.path.join(os.path.dirname(argv[0]),outpath) outfile = os.path.join(os.path.dirname(argv[0]),outfile)
outpath = os.path.abspath(outpath) outfile = os.path.abspath(outfile)
if os.path.isdir(outfile):
outfile = os.path.join(os.path.dirname(argv[0]),"androidkindlekey.k4a")
else: else:
# save to the same directory as the script # save to the same directory as the script
outpath = os.path.dirname(argv[0]) outfile = os.path.join(os.path.dirname(argv[0]),"androidkindlekey.k4a")
# make sure the outpath is OK # make sure the outpath is OK
outpath = os.path.realpath(os.path.normpath(outpath)) outfile = os.path.realpath(os.path.normpath(outfile))
if not os.path.isfile(inpath): if not os.path.isfile(inpath):
usage(progname) usage(progname)
print u"\n{0:s} file not found".format(inpath) print u"\n{0:s} file not found".format(inpath)
return 2 return 2
if not getkey(outpath, inpath): if getkey(outfile, inpath):
print u"Could not retrieve Kindle for Android key." print u"\nSaved Kindle for Android key to {0}".format(outfile)
else:
print u"\nCould not retrieve Kindle for Android key."
return 0 return 0

View File

@ -1,3 +1,14 @@
Of Historical Interest Only
===========================
It is now much simpler and easier to get a backup.ab file from your Android device and import that into the tools.
Comment at Apprentice Alf's Blog by cestmoicestmoi, 21st December, 2012. Comment at Apprentice Alf's Blog by cestmoicestmoi, 21st December, 2012.
======================================================================== ========================================================================

View File

@ -8,8 +8,8 @@ Mostly it tracks the tools releases by Apprentice Alf, athough it also includes
Users should download the latest zip archive. Users should download the latest zip archive.
Developers might be interested in forking the repository, as it contains unzipped versions of those tools that are zipped, and text versions of the AppleScripts, to make the changes over time easier to follow. Developers might be interested in forking the repository, as it contains unzipped versions of those tools that are zipped, and text versions of the AppleScripts, to make the changes over time easier to follow.
I welcome contributions from others to improve these tools, from expanding the range of books handled, improving key retrieval, to just general bug fixe, speed improvements and UI enhancements. I welcome contributions from others to improve these tools, from expanding the range of books handled, improving key retrieval, to just general bug fixes, speed improvements and UI enhancements.
My special thanks to all those developers who have done the hard work of reverse engineering to provide the initial tools. My special thanks to all those developers who have done the hard work of reverse engineering to provide the initial tools.
Apprentice Harper. Apprentice Harper.

View File

@ -1,11 +1,11 @@
Welcome to the tools! Welcome to the tools!
===================== =====================
This ReadMe_First.txt is meant to give users a quick overview of what is available and how to get started. This document is part of the Tools v6.2.2 archive from Apprentice Alf's Blog: http://apprenticealf.wordpress.com/ This ReadMe_First.txt is meant to give users a quick overview of what is available and how to get started. This document is part of the Tools v6.3.1 archive from Apprentice Alf's Blog: http://apprenticealf.wordpress.com/
The is archive includes tools to remove DRM from: The is archive includes tools to remove DRM from:
- Kindle ebooks (Mobi, Topaz, Print Replica and KF8). - Kindle ebooks (from Kindle for Mac/PC, eInk Kindles and Kindle for Android).
- Barnes and Noble ePubs - Barnes and Noble ePubs
- Adobe Digital Editions ePubs (including Kobo and Google ePubs downloaded to ADE) - Adobe Digital Editions ePubs (including Kobo and Google ePubs downloaded to ADE)
- Kobo kePubs from the Kobo Desktop application - Kobo kePubs from the Kobo Desktop application
@ -36,7 +36,7 @@ DeDRM application for Mac OS X users: (Mac OS X 10.4 and above)
--------------------------------------------------------------- ---------------------------------------------------------------
This application is a stand-alone DRM removal application for Mac OS X users. This application is a stand-alone DRM removal application for Mac OS X users.
For instructions, see the "DeDRM ReadMe.rtf" file in the DeDRM_Application_Macintosh folder. For instructions, see the "DeDRM ReadMe.rtf" file in the DeDRM_Macintosh_Application folder.
N.B. Mac OS X 10.4 users need to take extra steps before using the application, see the ReadMe. N.B. Mac OS X 10.4 users need to take extra steps before using the application, see the ReadMe.
@ -62,17 +62,14 @@ Other_Tools
----------- -----------
This is a folder of other tools that may be useful for DRMed ebooks from certain sources or for Linux users. Most users won't need any of these tools. This is a folder of other tools that may be useful for DRMed ebooks from certain sources or for Linux users. Most users won't need any of these tools.
DRM_Key_Scripts B_and_N_Download_Helper
This folder contains python scripts that create or extract or fetch encryption keyfiles for Barnes and Noble ePubs, Adobe Digital Editions ePubs, Kindle for Mac/PC and Kindle for Android ebooks. These files are needed for the Windows stand-alone DeDRM application.
B&N_Download_Helper
A Javascript to enable a download button at the B&N website for ebooks that normally won't download to your PC. Only for the adventurous. A Javascript to enable a download button at the B&N website for ebooks that normally won't download to your PC. Only for the adventurous.
DRM_Key_Scripts DRM_Key_Scripts
This folder contains python scripts that create or extract or fetch encryption keyfiles for Barnes and Noble ePubs, Adobe Digital Editions ePubs, Kindle for Mac/PC and Kindle for Android ebooks. This folder contains python scripts that create or extract or fetch encryption keyfiles for Barnes and Noble ePubs, Adobe Digital Editions ePubs, Kindle for Mac/PC and Kindle for Android ebooks.
Kindle_for_Android_Patches Kindle_for_Android_Patches
Definitely only for the adventurous, this folder contains information on how to modify the Kindel for Android app to b able to get a PID for use with the other Kindle tools (DeDRM apps and calibre plugin). Definitely only for the adventurous, this folder contains information on how to modify the Kindle for Android app to b able to get a PID for use with the other Kindle tools (DeDRM apps and calibre plugin). This is now of historical interest only, as Android support has now been added to the tools more simply.
Kobo Kobo
Contains the standalone obok python script for removing DRM from kePubs downloaded using the kobo desktop application. Contains the standalone obok python script for removing DRM from kePubs downloaded using the kobo desktop application.