mirror of
https://github.com/carlospolop/PEASS-ng
synced 2025-03-25 05:46:23 +01:00
Update FileAnalysis.cs
This commit is contained in:
parent
6ec25656f2
commit
9416b924cb
@ -154,17 +154,18 @@ namespace winPEAS.Checks
|
||||
try
|
||||
{
|
||||
Regex rgx;
|
||||
bool is_re_match = false;
|
||||
try
|
||||
{
|
||||
// Use "IsMatch" because it supports timeout, if exception is thrown exit the func to avoid ReDoS in "rgx.Matches"
|
||||
if (caseinsensitive)
|
||||
{
|
||||
_ = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.IgnoreCase, TimeSpan.FromSeconds(60));
|
||||
is_re_match = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.IgnoreCase, TimeSpan.FromSeconds(60));
|
||||
rgx = new Regex(regex_str.Trim(), RegexOptions.IgnoreCase);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.None, TimeSpan.FromSeconds(60));
|
||||
is_re_match = Regex.IsMatch(text, regex_str.Trim(), RegexOptions.None, TimeSpan.FromSeconds(60));
|
||||
rgx = new Regex(regex_str.Trim());
|
||||
}
|
||||
}
|
||||
@ -176,6 +177,11 @@ namespace winPEAS.Checks
|
||||
}
|
||||
return foundMatches;
|
||||
}
|
||||
|
||||
if (!is_re_match)
|
||||
{
|
||||
return foundMatches;
|
||||
}
|
||||
|
||||
int cont = 0;
|
||||
foreach (Match match in rgx.Matches(text))
|
||||
|
Loading…
x
Reference in New Issue
Block a user