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
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()
if actpath is None:
raise ADEPTError("Could not find ADE activation.dat file.")
tree = etree.parse(actpath)
adept = lambda tag: '{%s}%s' % (NSMAP['adept'], tag)
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'))
keyName = ""
@ -408,11 +411,14 @@ elif isosx:
else:
keyName = keyName[:-1]
userkey = b64decode(userkey)
userkey = userkey[26:]
return [userkey], [keyName]
userkeys.append(userkey)
keynames.append(keyName)
print("Found {0:d} keys".format(len(userkeys)))
return userkeys, keynames
else:
def adeptkeys():