Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_installed_software(self, subkey_path):
try:
ras_subkey = self.registry_hive.get_key(subkey_path)
except RegistryKeyNotFoundException as ex:
logger.error(ex)
return
for entry in ras_subkey.iter_subkeys():
timestamp = convert_wintime(entry.header.last_modified, as_json=self.as_json)
self.entries.append({
'key': subkey_path,
'name': entry.name,
'timestamp': timestamp
})
def run(self):
try:
tsclient_subkey = self.registry_hive.get_key(TSCLIENT_HISTORY_PATH)
except (RegistryKeyNotFoundException, NoRegistrySubkeysException) as ex:
logger.error(ex)
return
for server in tsclient_subkey.iter_subkeys():
self.entries.append({
'server': server.name,
'last_connection': convert_wintime(server.header.last_modified, as_json=self.as_json),
'username_hint': server.get_value('UsernameHint')
})
def run(self):
try:
installer_subkey = self.registry_hive.get_key(CLASSES_INSTALLER_PATH)
except RegistryKeyNotFoundException as ex:
logger.error(ex)
return
for entry in installer_subkey.iter_subkeys():
identifier = entry.name
timestamp = convert_wintime(entry.header.last_modified, as_json=self.as_json)
product_name = entry.get_value('ProductName')
self.entries.append({
'identifier': identifier,
'timestamp': timestamp,
'product_name': product_name,
'is_hidden': product_name is None
})