From b430fc80bdf1e00e027f2a11f3801fd65f015b00 Mon Sep 17 00:00:00 2001 From: Lionel Ovaert Date: Sun, 18 Feb 2024 21:09:53 +0100 Subject: [PATCH] Add try-except for PrintCachedCreds --- .../winPEASexe/winPEAS/Checks/SystemInfo.cs | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs b/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs index 310071f..ab046f5 100644 --- a/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs +++ b/winPEAS/winPEASexe/winPEAS/Checks/SystemInfo.cs @@ -387,21 +387,28 @@ namespace winPEAS.Checks static void PrintCachedCreds() { - Beaprint.MainPrint("Cached Creds"); - 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)) + try { - int clc = Int16.Parse(cachedlogonscount); - if (clc > 0) + Beaprint.MainPrint("Cached Creds"); + 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); - } - else - { - Beaprint.BadPrint(" cachedlogonscount is " + cachedlogonscount); + int clc = Int16.Parse(cachedlogonscount); + if (clc > 0) + { + Beaprint.BadPrint(" cachedlogonscount is " + cachedlogonscount); + } + else + { + Beaprint.BadPrint(" cachedlogonscount is " + cachedlogonscount); + } } } + catch (Exception ex) + { + Beaprint.PrintException(ex.Message); + } } static void PrintUserEV()