- import win32crypt, win32con, win32api;
- def get_regkey():
- try:
- accessRead = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
- keyPath = 'Licenses\\5C505A59-E312-4B89-9508-E162F8150517\\08878'
- try:
- hkey = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, keyPath, 0, accessRead)
- except Exception as e:
- print (e)
- return ''
- num = win32api.RegQueryInfoKey(hkey)[1]
- k = win32api.RegEnumValue(hkey, 0)
- if k:
- key = k[1]
- return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1]
- except Exception as e:
- print (e)
- return 'failed'
- encKey = get_regkey()
- print(encKey);
- plainKey = encKey.decode('windows-1252');
- print(plainKey);