Support multiple keys on MacOS

This commit is contained in:
Giovanni Carvelli 2024-05-19 18:54:18 -04:00
parent 3373d93874
commit 763ddb81e2
1 changed files with 28 additions and 22 deletions

View File

@ -379,15 +379,18 @@ elif isosx:
return None return None
def adeptkeys(): def adeptkeys():
# TODO: All the code to support extracting multiple activation keys
# TODO: seems to be Windows-only currently, still needs to be added for Mac.
actpath = findActivationDat() actpath = findActivationDat()
if actpath is None: if actpath is None:
raise ADEPTError("Could not find ADE activation.dat file.") raise ADEPTError("Could not find ADE activation.dat file.")
tree = etree.parse(actpath) tree = etree.parse(actpath)
adept = lambda tag: '{%s}%s' % (NSMAP['adept'], tag) adept = lambda tag: '{%s}%s' % (NSMAP['adept'], tag)
expr = '//%s/%s' % (adept('credentials'), adept('privateLicenseKey')) expr = '//%s/%s' % (adept('credentials'), adept('privateLicenseKey'))
userkey = tree.findtext(expr) userkeyelems = tree.findall(expr)
userkeys = []
keynames = []
for userkeyelem in userkeyelems:
userkey = userkeyelem.text
exprUUID = '//%s/%s' % (adept('credentials'), adept('user')) exprUUID = '//%s/%s' % (adept('credentials'), adept('user'))
keyName = "" keyName = ""
@ -408,11 +411,14 @@ elif isosx:
else: else:
keyName = keyName[:-1] keyName = keyName[:-1]
userkey = b64decode(userkey) userkey = b64decode(userkey)
userkey = userkey[26:] userkey = userkey[26:]
return [userkey], [keyName]
userkeys.append(userkey)
keynames.append(keyName)
print("Found {0:d} keys".format(len(userkeys)))
return userkeys, keynames
else: else:
def adeptkeys(): def adeptkeys():