Include NinjaOne identifiers in reports
This commit is contained in:
@@ -66,6 +66,7 @@ internal sealed class AttackScanner
|
||||
{
|
||||
SchemaVersion = "2.0",
|
||||
MachineName = Environment.MachineName,
|
||||
NinjaOne = GetNinjaOneContext(),
|
||||
GeneratedAtLocal = generatedAtLocal,
|
||||
GeneratedAtUtc = generatedAtUtc,
|
||||
ClientVersion = BuildMetadata.Version,
|
||||
@@ -89,6 +90,24 @@ internal sealed class AttackScanner
|
||||
};
|
||||
}
|
||||
|
||||
private static NinjaOneContext GetNinjaOneContext()
|
||||
{
|
||||
return new NinjaOneContext
|
||||
{
|
||||
OrganizationId = ReadEnvironmentVariable("NINJA_ORGANIZATION_ID"),
|
||||
OrganizationName = ReadEnvironmentVariable("NINJA_ORGANIZATION_NAME"),
|
||||
MachineId = ReadEnvironmentVariable("NINJA_AGENT_MACHINE_ID"),
|
||||
NodeId = ReadEnvironmentVariable("NINJA_AGENT_NODE_ID"),
|
||||
LocationId = ReadEnvironmentVariable("NINJA_LOCATION_ID"),
|
||||
LocationName = ReadEnvironmentVariable("NINJA_LOCATION_NAME")
|
||||
};
|
||||
}
|
||||
|
||||
private static string ReadEnvironmentVariable(string name)
|
||||
{
|
||||
return Environment.GetEnvironmentVariable(name)?.Trim() ?? string.Empty;
|
||||
}
|
||||
|
||||
private static ScannerConfiguration LoadConfiguration(ScanOptions options)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(options.ConfigPath))
|
||||
|
||||
@@ -80,6 +80,9 @@ internal sealed record ScanResult
|
||||
|
||||
public string MachineName { get; init; } = string.Empty;
|
||||
|
||||
// Populated only for runs launched by NinjaOne automation.
|
||||
public NinjaOneContext NinjaOne { get; init; } = new();
|
||||
|
||||
public DateTimeOffset GeneratedAtLocal { get; init; }
|
||||
|
||||
public DateTimeOffset GeneratedAtUtc { get; init; }
|
||||
@@ -111,6 +114,21 @@ internal sealed record ScanResult
|
||||
public List<string> Errors { get; init; } = [];
|
||||
}
|
||||
|
||||
internal sealed record NinjaOneContext
|
||||
{
|
||||
public string OrganizationId { get; init; } = string.Empty;
|
||||
|
||||
public string OrganizationName { get; init; } = string.Empty;
|
||||
|
||||
public string MachineId { get; init; } = string.Empty;
|
||||
|
||||
public string NodeId { get; init; } = string.Empty;
|
||||
|
||||
public string LocationId { get; init; } = string.Empty;
|
||||
|
||||
public string LocationName { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
internal sealed record ScanRuntimeMetadata
|
||||
{
|
||||
public DateTimeOffset StartedAtUtc { get; init; }
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<RootNamespace>OCSentinelCli</RootNamespace>
|
||||
<Product>OfficeCom Sentinel</Product>
|
||||
<Company>OfficeCom</Company>
|
||||
<Version>1.2.4</Version>
|
||||
<Version>1.2.5</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