33 lines
988 B
C#
33 lines
988 B
C#
using System.Text.Json;
|
|
|
|
namespace OCSentinelCli;
|
|
|
|
internal sealed record ScannerConfiguration
|
|
{
|
|
public int WarningEventThreshold { get; init; } = 1;
|
|
|
|
public int CriticalEventThreshold { get; init; } = 20;
|
|
|
|
public int WarningUniqueIpThreshold { get; init; } = 1;
|
|
|
|
public int CriticalUniqueIpThreshold { get; init; } = 10;
|
|
|
|
public int CorrelationWarningCveThreshold { get; init; } = 1;
|
|
|
|
public int CorrelationCriticalCveThreshold { get; init; } = 1;
|
|
|
|
public List<string> FtpRoots { get; init; } = [];
|
|
|
|
public List<string> FileZillaRoots { get; init; } = [];
|
|
|
|
public List<string> ExcludedIps { get; init; } = [];
|
|
|
|
public static ScannerConfiguration Load(string path)
|
|
{
|
|
string fullPath = Path.GetFullPath(path);
|
|
string json = File.ReadAllText(fullPath);
|
|
ScannerConfiguration? config = JsonSerializer.Deserialize<ScannerConfiguration>(json, JsonOptions.Default);
|
|
return config ?? new ScannerConfiguration();
|
|
}
|
|
}
|