Compare commits

...

1 Commits

Author SHA1 Message Date
HackTricks PEASS Autoimprover
d4f44acc0c autoimprover: simplify winpeas checks 2026-01-31 04:05:27 +00:00
3 changed files with 8 additions and 4 deletions

View File

@@ -524,7 +524,7 @@ namespace winPEAS.Checks
{
Beaprint.MainPrint("Looking for documents --limit 100--");
List<string> docFiles = InterestingFiles.InterestingFiles.ListUsersDocs();
Beaprint.ListPrint(docFiles.GetRange(0, docFiles.Count <= 100 ? docFiles.Count : 100));
Beaprint.ListPrint(MyUtils.GetLimitedRange(docFiles, 100));
}
catch (Exception ex)
{
@@ -546,7 +546,7 @@ namespace winPEAS.Checks
if (recFiles.Count != 0)
{
foreach (Dictionary<string, string> recF in recFiles.GetRange(0, recFiles.Count <= 70 ? recFiles.Count : 70))
foreach (Dictionary<string, string> recF in MyUtils.GetLimitedRange(recFiles, 70))
{
Beaprint.AnsiPrint(" " + recF["Target"] + "(" + recF["Accessed"] + ")", colorF);
}

View File

@@ -348,8 +348,7 @@ namespace winPEAS.Checks
Beaprint.MainPrint("DNS cached --limit 70--");
Beaprint.GrayPrint(string.Format(" {0,-38}{1,-38}{2}", "Entry", "Name", "Data"));
List<Dictionary<string, string>> DNScache = NetworkInfoHelper.GetDNSCache();
foreach (Dictionary<string, string> entry in DNScache.GetRange(0,
DNScache.Count <= 70 ? DNScache.Count : 70))
foreach (Dictionary<string, string> entry in MyUtils.GetLimitedRange(DNScache, 70))
{
Console.WriteLine($" {entry["Entry"],-38}{entry["Name"],-38}{entry["Data"]}");
}

View File

@@ -21,6 +21,11 @@ namespace winPEAS.Helpers
""); //To get the default object you need to use an empty string
}
public static List<T> GetLimitedRange<T>(List<T> items, int limit)
{
return items.GetRange(0, Math.Min(items.Count, limit));
}
////////////////////////////////////
/////// MISC - Files & Paths ///////
////////////////////////////////////