Preserve upload configuration during scan and upload
This commit is contained in:
@@ -5,7 +5,10 @@ internal static class ScanAndUploadCommand
|
||||
public static int Execute(string[] args)
|
||||
{
|
||||
string outputPath = @"C:\ProgramData\OCSentinel\reports\latest.json";
|
||||
string? clientConfigPath = null;
|
||||
string? secretPath = null;
|
||||
bool hasOutput = false;
|
||||
var scanArgs = new List<string>();
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
@@ -13,11 +16,26 @@ internal static class ScanAndUploadCommand
|
||||
{
|
||||
outputPath = args[i + 1];
|
||||
hasOutput = true;
|
||||
break;
|
||||
}
|
||||
scanArgs.Add(args[i]);
|
||||
scanArgs.Add(args[++i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.Equals(args[i], "--client-config", StringComparison.OrdinalIgnoreCase) && i + 1 < args.Length)
|
||||
{
|
||||
clientConfigPath = args[++i];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.Equals(args[i], "--secret-path", StringComparison.OrdinalIgnoreCase) && i + 1 < args.Length)
|
||||
{
|
||||
secretPath = args[++i];
|
||||
continue;
|
||||
}
|
||||
|
||||
scanArgs.Add(args[i]);
|
||||
}
|
||||
|
||||
List<string> scanArgs = [.. args];
|
||||
if (!hasOutput)
|
||||
{
|
||||
scanArgs.Add("--output");
|
||||
@@ -36,6 +54,16 @@ internal static class ScanAndUploadCommand
|
||||
outputPath
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(clientConfigPath))
|
||||
{
|
||||
uploadArgs.AddRange(["--client-config", clientConfigPath]);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(secretPath))
|
||||
{
|
||||
uploadArgs.AddRange(["--secret-path", secretPath]);
|
||||
}
|
||||
|
||||
return UploadCommand.Execute([.. uploadArgs]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<RootNamespace>OCSentinelCli</RootNamespace>
|
||||
<Product>OfficeCom Sentinel</Product>
|
||||
<Company>OfficeCom</Company>
|
||||
<Version>1.2.5</Version>
|
||||
<Version>1.2.6</Version>
|
||||
<AssemblyVersion>1.2.3.0</AssemblyVersion>
|
||||
<FileVersion>1.2.3.0</FileVersion>
|
||||
<InformationalVersion>1.2.3</InformationalVersion>
|
||||
|
||||
Reference in New Issue
Block a user