1
mirror of https://github.com/carlospolop/PEASS-ng synced 2025-03-25 05:46:23 +01:00

Add try-except for PrintCachedCreds

This commit is contained in:
Lionel Ovaert 2024-02-18 21:09:53 +01:00 committed by GitHub
parent b4b8afa169
commit b430fc80bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -387,21 +387,28 @@ namespace winPEAS.Checks
static void PrintCachedCreds() static void PrintCachedCreds()
{ {
Beaprint.MainPrint("Cached Creds"); try
Beaprint.LinkPrint("https://book.hacktricks.xyz/windows-hardening/stealing-credentials/credentials-protections#cached-credentials", "If > 0, credentials will be cached in the registry and accessible by SYSTEM user");
string cachedlogonscount = RegistryHelper.GetRegValue("HKLM", @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "CACHEDLOGONSCOUNT");
if (!string.IsNullOrEmpty(cachedlogonscount))
{ {
int clc = Int16.Parse(cachedlogonscount); Beaprint.MainPrint("Cached Creds");
if (clc > 0) Beaprint.LinkPrint("https://book.hacktricks.xyz/windows-hardening/stealing-credentials/credentials-protections#cached-credentials", "If > 0, credentials will be cached in the registry and accessible by SYSTEM user");
string cachedlogonscount = RegistryHelper.GetRegValue("HKLM", @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "CACHEDLOGONSCOUNT");
if (!string.IsNullOrEmpty(cachedlogonscount))
{ {
Beaprint.BadPrint(" cachedlogonscount is " + cachedlogonscount); int clc = Int16.Parse(cachedlogonscount);
} if (clc > 0)
else {
{ Beaprint.BadPrint(" cachedlogonscount is " + cachedlogonscount);
Beaprint.BadPrint(" cachedlogonscount is " + cachedlogonscount); }
else
{
Beaprint.BadPrint(" cachedlogonscount is " + cachedlogonscount);
}
} }
} }
catch (Exception ex)
{
Beaprint.PrintException(ex.Message);
}
} }
static void PrintUserEV() static void PrintUserEV()