Make B&N plugin skip invalid hashes in Windows app

This commit is contained in:
NoDRM 2022-03-18 17:45:07 +01:00
parent 82a698edf6
commit a4689f6ac0

View File

@ -13,6 +13,7 @@ https://github.com/noDRM/DeDRM_tools/discussions/9
import sys, os import sys, os
import apsw import apsw
import base64 import base64
import traceback
try: try:
from Cryptodome.Cipher import AES from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import unpad from Cryptodome.Util.Padding import unpad
@ -56,11 +57,14 @@ def dump_keys(print_result=False):
decrypted_hashes = [] decrypted_hashes = []
for pass_hash in activation_xml.findall(".//{http://ns.adobe.com/adept}passHash"): for pass_hash in activation_xml.findall(".//{http://ns.adobe.com/adept}passHash"):
encrypted_cc_hash = base64.b64decode(pass_hash.text) try:
cc_hash = unpad(AES.new(hash_key, AES.MODE_CBC, encrypted_cc_hash[:16]).decrypt(encrypted_cc_hash[16:]), 16) encrypted_cc_hash = base64.b64decode(pass_hash.text)
decrypted_hashes.append((base64.b64encode(cc_hash).decode("ascii"))) cc_hash = unpad(AES.new(hash_key, AES.MODE_CBC, encrypted_cc_hash[:16]).decrypt(encrypted_cc_hash[16:]), 16)
if print_result: decrypted_hashes.append((base64.b64encode(cc_hash).decode("ascii")))
print("Nook ccHash is %s" % (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 return decrypted_hashes