summaryrefslogtreecommitdiffstats
path: root/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs
diff options
context:
space:
mode:
Diffstat (limited to 'Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs')
-rw-r--r--Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeyfetch.pyw45
-rw-r--r--Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeygen.pyw3
2 files changed, 34 insertions, 14 deletions
diff --git a/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeyfetch.pyw b/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeyfetch.pyw
index 2ecbe96..e9637a1 100644
--- a/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeyfetch.pyw
+++ b/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeyfetch.pyw
@@ -3,13 +3,14 @@
from __future__ import with_statement
-# ignoblekeyfetch.pyw, version 1.0
+# ignoblekeyfetch.pyw, version 1.1
# Copyright © 2015 Apprentice Harper
# Released under the terms of the GNU General Public Licence, version 3
# <http://www.gnu.org/licenses/>
# 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.
# 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.
#
# 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.
# 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
"""
__license__ = 'GPL v3'
-__version__ = "1.0"
+__version__ = "1.1"
import sys
import os
@@ -87,7 +89,7 @@ def unicode_argv():
xrange(start, argc.value)]
# if we don't have any arguments at all, just pass back script name
# this should never happen
- return [u"ignoblekeygen.py"]
+ return [u"ignoblekeyfetch.py"]
else:
argvencoding = sys.stdin.encoding
if argvencoding == None:
@@ -99,33 +101,49 @@ class IGNOBLEError(Exception):
pass
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:
email = email.encode('utf-8')
if type(password)==unicode:
password = password.encode('utf-8')
-
+
import random
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 += 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"
#print fetch_url
-
+
found = ''
try:
req = urllib2.Request(fetch_url)
response = urllib2.urlopen(req)
the_page = response.read()
#print the_page
-
- import re
-
found = re.search('ccHash>(.+?)</ccHash', the_page).group(1)
except:
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
@@ -151,6 +169,7 @@ def cli_main():
def gui_main():
try:
import Tkinter
+ import tkFileDialog
import Tkconstants
import tkMessageBox
import traceback
diff --git a/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeygen.pyw b/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeygen.pyw
index 83bb2ce..d2917c7 100644
--- a/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeygen.pyw
+++ b/Other_Tools/DRM_Key_Scripts/Barnes_and_Noble_ePubs/ignoblekeygen.pyw
@@ -33,13 +33,14 @@ from __future__ import with_statement
# 2.5 - Additional improvement for unicode and plugin support
# 2.6 - moved unicode_argv call inside main for Windows DeDRM compatibility
# 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.
"""
__license__ = 'GPL v3'
-__version__ = "2.7"
+__version__ = "2.8"
import sys
import os