Add JSON serialization to wrappers (.NET 6)

This commit is contained in:
Matt Nadareski
2023-01-13 10:41:50 -08:00
parent f85adda24c
commit 0fd0cf689a
26 changed files with 390 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ namespace Test
p.ProgressChanged += Protector.Changed;
// Set initial values for scanner flags
bool debug = false, archives = true, contents = true, packers = true, paths = true, info = false, extract = false;
bool debug = false, archives = true, contents = true, json = false, packers = true, paths = true, info = false, extract = false;
string outputPath = string.Empty;
var inputPaths = new List<string>();
@@ -52,6 +52,15 @@ namespace Test
contents = false;
break;
#if NET6_0_OR_GREATER
case "-j":
case "--json":
json = true;
break;
#endif
case "-np":
case "--no-packers":
packers = false;
@@ -130,7 +139,7 @@ namespace Test
foreach (string inputPath in inputPaths)
{
if (info)
Printer.PrintPathInfo(inputPath, debug);
Printer.PrintPathInfo(inputPath, json, debug);
else if (extract)
Extractor.ExtractPath(inputPath, outputPath);
else
@@ -158,6 +167,9 @@ namespace Test
Console.WriteLine("-np, --no-packers Disable scanning for packers");
Console.WriteLine("-ns, --no-paths Disable scanning for path checks");
Console.WriteLine("-i, --info Print executable info");
#if NET6_0_OR_GREATER
Console.WriteLine("-j, --json Print executable info as JSON");
#endif
Console.WriteLine("-x, --extract Extract archive formats");
Console.WriteLine("-o, --outdir [PATH] Set output path for extraction (REQUIRED)");
}