using System; using System.Collections.Concurrent; using System.Collections.Generic; using BinaryObjectScanner.Interfaces; using BinaryObjectScanner.Matching; using BinaryObjectScanner.Wrappers; namespace BinaryObjectScanner.Protection { public class Origin : IPathCheck, IPortableExecutableCheck { /// public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) { // Get the sections from the executable, if possible var sections = pex?.SectionTable; if (sections == null) return null; string name = pex.FileDescription; if (name?.Equals("Origin", StringComparison.OrdinalIgnoreCase) == true) return "Origin"; name = pex.ProductName; if (name?.Equals("Origin", StringComparison.OrdinalIgnoreCase) == true) return "Origin"; return null; } /// public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files) { var matchers = new List { new PathMatchSet(new PathMatch("OriginSetup.exe", useEndsWith: true), "Origin"), }; return MatchUtil.GetAllMatches(files, matchers, any: true); } /// public string CheckFilePath(string path) { var matchers = new List { new PathMatchSet(new PathMatch("OriginSetup.exe", useEndsWith: true), "Origin"), }; return MatchUtil.GetFirstMatch(path, matchers, any: true); } } }