Add and use FilePathMatch (fixes #262)

This commit is contained in:
Matt Nadareski
2023-08-26 22:51:55 -04:00
parent 3045c41eda
commit cfe889d5b3
12 changed files with 77 additions and 63 deletions

View File

@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BinaryObjectScanner.Interfaces;
using BinaryObjectScanner.Matching;
@@ -36,8 +35,8 @@ namespace BinaryObjectScanner.Protection
{
new PathMatchSet(new List<PathMatch>
{
new PathMatch($"{Path.DirectorySeparatorChar}00001.TMP", useEndsWith: true),
new PathMatch($"{Path.DirectorySeparatorChar}00002.TMP", useEndsWith: true)
new FilePathMatch("00001.TMP"),
new FilePathMatch("00002.TMP")
}, "SmartE"),
};
@@ -49,8 +48,8 @@ namespace BinaryObjectScanner.Protection
{
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}00001.TMP", useEndsWith: true), "SmartE"),
new PathMatchSet(new PathMatch($"{Path.DirectorySeparatorChar}00002.TMP", useEndsWith: true), "SmartE"),
new PathMatchSet(new FilePathMatch("00001.TMP"), "SmartE"),
new PathMatchSet(new FilePathMatch("00002.TMP"), "SmartE"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);