From 659aa30fb3b801acd9b831bb23779960e4280f48 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 15 Mar 2023 14:16:20 -0400 Subject: [PATCH] Update names, access permissions --- BurnOutSharp/Handler.cs | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/BurnOutSharp/Handler.cs b/BurnOutSharp/Handler.cs index 5a960475..e77115ac 100644 --- a/BurnOutSharp/Handler.cs +++ b/BurnOutSharp/Handler.cs @@ -55,7 +55,7 @@ namespace BurnOutSharp Parallel.ForEach(ScanningClasses.ContentCheckClasses, checkClass => { // Get the protection for the class, if possible - var subProtections = HandleContentCheck(checkClass, fileName, fileContent, scanner.IncludeDebug); + var subProtections = checkClass.PerformCheck(fileName, fileContent, scanner.IncludeDebug); if (subProtections != null) { // If we are filtering the output of the check @@ -85,7 +85,7 @@ namespace BurnOutSharp Parallel.ForEach(ScanningClasses.LinearExecutableCheckClasses, checkClass => { // Get the protection for the class, if possible - var subProtections = HandleLinearExecutableCheck(checkClass, fileName, lex, scanner.IncludeDebug); + var subProtections = checkClass.PerformCheck(fileName, lex, scanner.IncludeDebug); if (subProtections == null) return; @@ -124,7 +124,7 @@ namespace BurnOutSharp Parallel.ForEach(ScanningClasses.NewExecutableCheckClasses, checkClass => { // Get the protection for the class, if possible - var subProtections = HandleNewExecutableCheck(checkClass, fileName, nex, scanner.IncludeDebug); + var subProtections = checkClass.PerformCheck(fileName, nex, scanner.IncludeDebug); if (subProtections == null) return; @@ -164,7 +164,7 @@ namespace BurnOutSharp // Iterate through all checks Parallel.ForEach(ScanningClasses.PathCheckClasses, checkClass => { - var subProtections = HandlePathCheck(checkClass, path, files); + var subProtections = checkClass.PerformCheck(path, files); if (subProtections != null) AppendToDictionary(protections, subProtections); }); @@ -188,7 +188,7 @@ namespace BurnOutSharp Parallel.ForEach(ScanningClasses.PortableExecutableCheckClasses, checkClass => { // Get the protection for the class, if possible - var subProtections = HandlePortableExecutableCheck(checkClass, fileName, pex, scanner.IncludeDebug); + var subProtections = checkClass.PerformCheck(fileName, pex, scanner.IncludeDebug); if (subProtections == null) return; @@ -215,20 +215,6 @@ namespace BurnOutSharp #region Single Implementation Handlers - /// - /// Handle files based on an IContentCheck implementation - /// - /// IDetectable class representing the check - /// Name of the source file of the byte array, for tracking - /// Contents of the source file - /// True to include debug data, false otherwise - /// Set of protections in file, null on error - public static ConcurrentQueue HandleContentCheck(IContentCheck impl, string fileName, byte[] fileContent, bool includeDebug) - { - string protection = impl.CheckContents(fileName, fileContent, includeDebug); - return ProcessProtectionString(protection); - } - /// /// Handle files based on an IDetectable implementation /// @@ -287,6 +273,20 @@ namespace BurnOutSharp return null; } + /// + /// Handle files based on an IContentCheck implementation + /// + /// IDetectable class representing the check + /// Name of the source file of the byte array, for tracking + /// Contents of the source file + /// True to include debug data, false otherwise + /// Set of protections in file, null on error + private static ConcurrentQueue PerformCheck(this IContentCheck impl, string fileName, byte[] fileContent, bool includeDebug) + { + string protection = impl.CheckContents(fileName, fileContent, includeDebug); + return ProcessProtectionString(protection); + } + /// /// Handle files based on an ILinearExecutableCheck implementation /// @@ -295,7 +295,7 @@ namespace BurnOutSharp /// LinearExecutable to check /// True to include debug data, false otherwise /// Set of protections in file, null on error - public static ConcurrentQueue HandleLinearExecutableCheck(ILinearExecutableCheck impl, string fileName, LinearExecutable lex, bool includeDebug) + private static ConcurrentQueue PerformCheck(this ILinearExecutableCheck impl, string fileName, LinearExecutable lex, bool includeDebug) { string protection = impl.CheckLinearExecutable(fileName, lex, includeDebug); return ProcessProtectionString(protection); @@ -309,7 +309,7 @@ namespace BurnOutSharp /// NewExecutable to check /// True to include debug data, false otherwise /// Set of protections in file, null on error - public static ConcurrentQueue HandleNewExecutableCheck(INewExecutableCheck impl, string fileName, NewExecutable nex, bool includeDebug) + private static ConcurrentQueue PerformCheck(this INewExecutableCheck impl, string fileName, NewExecutable nex, bool includeDebug) { string protection = impl.CheckNewExecutable(fileName, nex, includeDebug); return ProcessProtectionString(protection); @@ -321,7 +321,7 @@ namespace BurnOutSharp /// IPathCheck class representing the file type /// Path of the file or directory to check /// Set of protections in path, null on error - public static ConcurrentDictionary> HandlePathCheck(IPathCheck impl, string path, IEnumerable files) + private static ConcurrentDictionary> PerformCheck(this IPathCheck impl, string path, IEnumerable files) { // If we have an invalid path if (string.IsNullOrWhiteSpace(path)) @@ -358,7 +358,7 @@ namespace BurnOutSharp /// NewExecutable to check /// True to include debug data, false otherwise /// Set of protections in file, null on error - public static ConcurrentQueue HandlePortableExecutableCheck(IPortableExecutableCheck impl, string fileName, PortableExecutable pex, bool includeDebug) + private static ConcurrentQueue PerformCheck(this IPortableExecutableCheck impl, string fileName, PortableExecutable pex, bool includeDebug) { string protection = impl.CheckPortableExecutable(fileName, pex, includeDebug); return ProcessProtectionString(protection);