mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-09 02:16:46 +00:00
Add content scanning flag in Scanner/Test
This commit is contained in:
@@ -20,6 +20,11 @@ namespace BurnOutSharp
|
||||
/// </summary>
|
||||
public bool ScanArchives { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if content matches are used or not
|
||||
/// </summary>
|
||||
public bool ScanContents { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if packers are counted as detected protections or not
|
||||
/// </summary>
|
||||
@@ -46,13 +51,15 @@ namespace BurnOutSharp
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="scanArchives">Enable scanning archive contents</param>
|
||||
/// <param name="scanContents">Enable including content detections in output</param>
|
||||
/// <param name="scanPackers">Enable including packers in output</param>
|
||||
/// <param name="scanPaths">Enable including path detections in output</param>
|
||||
/// <param name="includeDebug">Enable including debug information</param>
|
||||
/// <param name="fileProgress">Optional progress callback</param>
|
||||
public Scanner(bool scanArchives, bool scanPackers, bool scanPaths, bool includeDebug, IProgress<ProtectionProgress> fileProgress = null)
|
||||
public Scanner(bool scanArchives, bool scanContents, bool scanPackers, bool scanPaths, bool includeDebug, IProgress<ProtectionProgress> fileProgress = null)
|
||||
{
|
||||
ScanArchives = scanArchives;
|
||||
ScanContents = scanContents;
|
||||
ScanPackers = scanPackers;
|
||||
ScanPaths = scanPaths;
|
||||
IncludeDebug = includeDebug;
|
||||
@@ -133,15 +140,18 @@ namespace BurnOutSharp
|
||||
}
|
||||
|
||||
// Scan for content-detectable protections
|
||||
var fileProtections = GetInternalProtections(file);
|
||||
if (fileProtections != null && fileProtections.Any())
|
||||
if (ScanContents)
|
||||
{
|
||||
foreach (string key in fileProtections.Keys)
|
||||
var fileProtections = GetInternalProtections(file);
|
||||
if (fileProtections != null && fileProtections.Any())
|
||||
{
|
||||
if (!protections.ContainsKey(key))
|
||||
protections[key] = new ConcurrentQueue<string>();
|
||||
foreach (string key in fileProtections.Keys)
|
||||
{
|
||||
if (!protections.ContainsKey(key))
|
||||
protections[key] = new ConcurrentQueue<string>();
|
||||
|
||||
protections[key].AddRange(fileProtections[key]);
|
||||
protections[key].AddRange(fileProtections[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,15 +181,18 @@ namespace BurnOutSharp
|
||||
}
|
||||
|
||||
// Scan for content-detectable protections
|
||||
var fileProtections = GetInternalProtections(path);
|
||||
if (fileProtections != null && fileProtections.Any())
|
||||
if (ScanContents)
|
||||
{
|
||||
foreach (string key in fileProtections.Keys)
|
||||
var fileProtections = GetInternalProtections(path);
|
||||
if (fileProtections != null && fileProtections.Any())
|
||||
{
|
||||
if (!protections.ContainsKey(key))
|
||||
protections[key] = new ConcurrentQueue<string>();
|
||||
foreach (string key in fileProtections.Keys)
|
||||
{
|
||||
if (!protections.ContainsKey(key))
|
||||
protections[key] = new ConcurrentQueue<string>();
|
||||
|
||||
protections[key].AddRange(fileProtections[key]);
|
||||
protections[key].AddRange(fileProtections[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Test
|
||||
p.ProgressChanged += Protector.Changed;
|
||||
|
||||
// Set initial values for scanner flags
|
||||
bool debug = false, archives = true, packers = true, paths = true, info = false, extract = false;
|
||||
bool debug = false, archives = true, contents = true, packers = true, paths = true, info = false, extract = false;
|
||||
string outputPath = string.Empty;
|
||||
var inputPaths = new List<string>();
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Test
|
||||
}
|
||||
|
||||
// Create scanner for all paths
|
||||
var scanner = new Scanner(archives, packers, paths, debug, p);
|
||||
var scanner = new Scanner(archives, contents, packers, paths, debug, p);
|
||||
|
||||
// If we have extraction, check the output path exists and is valid
|
||||
if (extract)
|
||||
@@ -148,6 +148,7 @@ namespace Test
|
||||
Console.WriteLine("Possible options:");
|
||||
Console.WriteLine("-?, -h, --help Display this help text and quit");
|
||||
Console.WriteLine("-d, --debug Enable debug mode");
|
||||
Console.WriteLine("-nc, --no-contents Disable scanning for content checks");
|
||||
Console.WriteLine("-na, --no-archives Disable scanning archives");
|
||||
Console.WriteLine("-np, --no-packers Disable scanning for packers");
|
||||
Console.WriteLine("-ns, --no-paths Disable scanning for path checks");
|
||||
|
||||
Reference in New Issue
Block a user