Update FileAnalysis.cs

This commit is contained in:
Carlos Polop 2022-11-02 18:42:29 +00:00 committed by GitHub
parent 3039ce555d
commit 6ec25656f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,12 +159,12 @@ namespace winPEAS.Checks
// Use "IsMatch" because it supports timeout, if exception is thrown exit the func to avoid ReDoS in "rgx.Matches" // Use "IsMatch" because it supports timeout, if exception is thrown exit the func to avoid ReDoS in "rgx.Matches"
if (caseinsensitive) if (caseinsensitive)
{ {
_ = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(5000)); _ = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.IgnoreCase, TimeSpan.FromSeconds(60));
rgx = new Regex(regex_str.Trim(), RegexOptions.IgnoreCase); rgx = new Regex(regex_str.Trim(), RegexOptions.IgnoreCase);
} }
else else
{ {
_ = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.None, TimeSpan.FromMilliseconds(5000)); _ = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.None, TimeSpan.FromSeconds(60));
rgx = new Regex(regex_str.Trim()); rgx = new Regex(regex_str.Trim());
} }
} }
@ -367,7 +367,7 @@ namespace winPEAS.Checks
timer.Stop(); timer.Stop();
TimeSpan timeTaken = timer.Elapsed; TimeSpan timeTaken = timer.Elapsed;
if (timeTaken.TotalMilliseconds > 5000) if (timeTaken.TotalMilliseconds > 20000)
Beaprint.PrintDebugLine($"\nThe regex {regex.regex} took {timeTaken.TotalMilliseconds}s in {f.FullPath}"); Beaprint.PrintDebugLine($"\nThe regex {regex.regex} took {timeTaken.TotalMilliseconds}s in {f.FullPath}");
} }
} }