From a4689f6ac0af8494c622c8bee3f8866ec028755f Mon Sep 17 00:00:00 2001 From: NoDRM Date: Fri, 18 Mar 2022 17:45:07 +0100 Subject: [PATCH] Make B&N plugin skip invalid hashes in Windows app --- DeDRM_plugin/ignoblekeyWindowsStore.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/DeDRM_plugin/ignoblekeyWindowsStore.py b/DeDRM_plugin/ignoblekeyWindowsStore.py index f22d64d..886c7cd 100644 --- a/DeDRM_plugin/ignoblekeyWindowsStore.py +++ b/DeDRM_plugin/ignoblekeyWindowsStore.py @@ -13,6 +13,7 @@ https://github.com/noDRM/DeDRM_tools/discussions/9 import sys, os import apsw import base64 +import traceback try: from Cryptodome.Cipher import AES from Cryptodome.Util.Padding import unpad @@ -56,11 +57,14 @@ def dump_keys(print_result=False): decrypted_hashes = [] for pass_hash in activation_xml.findall(".//{http://ns.adobe.com/adept}passHash"): - encrypted_cc_hash = base64.b64decode(pass_hash.text) - cc_hash = unpad(AES.new(hash_key, AES.MODE_CBC, encrypted_cc_hash[:16]).decrypt(encrypted_cc_hash[16:]), 16) - decrypted_hashes.append((base64.b64encode(cc_hash).decode("ascii"))) - if print_result: - print("Nook ccHash is %s" % (base64.b64encode(cc_hash).decode("ascii"))) + try: + encrypted_cc_hash = base64.b64decode(pass_hash.text) + cc_hash = unpad(AES.new(hash_key, AES.MODE_CBC, encrypted_cc_hash[:16]).decrypt(encrypted_cc_hash[16:]), 16) + decrypted_hashes.append((base64.b64encode(cc_hash).decode("ascii"))) + if print_result: + print("Nook ccHash is %s" % (base64.b64encode(cc_hash).decode("ascii"))) + except: + traceback.print_exc() return decrypted_hashes