From c4447fc5054043b9e7ff5f2e6b2e3f69ced84d23 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 14 Mar 2022 12:09:03 -0700 Subject: [PATCH] Modernize path check for SolidShield a little --- BurnOutSharp/ProtectionType/SolidShield.cs | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index 97888d1b..6e179e80 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -12,17 +12,6 @@ namespace BurnOutSharp.ProtectionType // TODO: Not matching all SolidShield Wrapper v1 (See NFS11) public class SolidShield : IPEContentCheck, IPathCheck { - /// - /// Set of all PathMatchSets for this protection - /// - private static readonly List pathMatchers = new List - { - new PathMatchSet(new PathMatch("dvm.dll", useEndsWith: true), "SolidShield"), - new PathMatchSet(new PathMatch("hc.dll", useEndsWith: true), "SolidShield"), - new PathMatchSet(new PathMatch("solidshield-cd.dll", useEndsWith: true), "SolidShield"), - new PathMatchSet(new PathMatch("c11prot.dll", useEndsWith: true), "SolidShield"), - }; - /// public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex) { @@ -102,14 +91,30 @@ namespace BurnOutSharp.ProtectionType /// public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files) { + var matchers = new List + { + new PathMatchSet(new PathMatch("dvm.dll", useEndsWith: true), "SolidShield"), + new PathMatchSet(new PathMatch("hc.dll", useEndsWith: true), "SolidShield"), + new PathMatchSet(new PathMatch("solidshield-cd.dll", useEndsWith: true), "SolidShield"), + new PathMatchSet(new PathMatch("c11prot.dll", useEndsWith: true), "SolidShield"), + }; + // TODO: Verify if these are OR or AND - return MatchUtil.GetAllMatches(files, pathMatchers, any: true); + return MatchUtil.GetAllMatches(files, matchers, any: true); } /// public string CheckFilePath(string path) { - return MatchUtil.GetFirstMatch(path, pathMatchers, any: true); + var matchers = new List + { + new PathMatchSet(new PathMatch("dvm.dll", useEndsWith: true), "SolidShield"), + new PathMatchSet(new PathMatch("hc.dll", useEndsWith: true), "SolidShield"), + new PathMatchSet(new PathMatch("solidshield-cd.dll", useEndsWith: true), "SolidShield"), + new PathMatchSet(new PathMatch("c11prot.dll", useEndsWith: true), "SolidShield"), + }; + + return MatchUtil.GetFirstMatch(path, matchers, any: true); } public static string GetExeWrapperVersion(string file, byte[] fileContent, List positions)