Remove legacy AttackTracer repo content
Some checks failed
OfficeCom Sentinel Client / build-client (push) Has been cancelled
Some checks failed
OfficeCom Sentinel Client / build-client (push) Has been cancelled
This commit is contained in:
41
src/OCSentinelCli/Commands/ScanAndUploadCommand.cs
Normal file
41
src/OCSentinelCli/Commands/ScanAndUploadCommand.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace OCSentinelCli.Commands;
|
||||
|
||||
internal static class ScanAndUploadCommand
|
||||
{
|
||||
public static int Execute(string[] args)
|
||||
{
|
||||
string outputPath = @"C:\ProgramData\OCSentinel\reports\latest.json";
|
||||
bool hasOutput = false;
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (string.Equals(args[i], "--output", StringComparison.OrdinalIgnoreCase) && i + 1 < args.Length)
|
||||
{
|
||||
outputPath = args[i + 1];
|
||||
hasOutput = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
List<string> scanArgs = [.. args];
|
||||
if (!hasOutput)
|
||||
{
|
||||
scanArgs.Add("--output");
|
||||
scanArgs.Add(outputPath);
|
||||
}
|
||||
|
||||
int scanExitCode = ScanCommand.Execute([.. scanArgs]);
|
||||
if (scanExitCode != 0)
|
||||
{
|
||||
return scanExitCode;
|
||||
}
|
||||
|
||||
var uploadArgs = new List<string>
|
||||
{
|
||||
"--report",
|
||||
outputPath
|
||||
};
|
||||
|
||||
return UploadCommand.Execute([.. uploadArgs]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user