From d880ebeedb56336ae8c48c2a697b5160b7963ceb Mon Sep 17 00:00:00 2001 From: sonderau Date: Tue, 4 Nov 2025 13:55:04 +0800 Subject: [PATCH] Migration to a ServiceWorker for most tasks. Implementation of basic PatchComplianceTask. First real iteration, basic/raw asf. --- .claude/settings.local.json | 3 +- Directory.Packages.props | 2 + LD-SysInfo/Config.cs | 8 + LD-SysInfo/LD_SysInfo.csproj | 1 + LD-SysInfo/MainWindow.xaml | 101 ++++++ LD-SysInfo/MainWindow.xaml.cs | 116 +++++++ LD-SysInfo/Services/ApiClient.cs | 38 +++ LD-SysInfo/Services/OsqueryTaskScheduler.cs | 152 +++++++++ LD-SysInfo/Services/PatchComplianceTask.cs | 132 ++++++++ LD-SysInfo/Services/ScheduledTask.cs | 35 ++ OversightService/Config.cs | 47 +++ OversightService/EncryptionHelper.cs | 36 ++ OversightService/OversightService.csproj | 22 ++ OversightService/Program.cs | 7 + OversightService/Services/ApiClient.cs | 317 ++++++++++++++++++ OversightService/Services/LoginResponse.cs | 9 + OversightService/Services/OsqueryService.cs | 97 ++++++ .../Services/OsqueryTaskScheduler.cs | 152 +++++++++ .../Services/PatchComplianceTask.cs | 132 ++++++++ OversightService/Services/ScheduledTask.cs | 35 ++ OversightService/Worker.cs | 77 ++++- OversightService/config.json | 14 + OversightService/osqueryi.exe | Bin 0 -> 24843552 bytes 23 files changed, 1527 insertions(+), 6 deletions(-) create mode 100644 LD-SysInfo/Services/OsqueryTaskScheduler.cs create mode 100644 LD-SysInfo/Services/PatchComplianceTask.cs create mode 100644 LD-SysInfo/Services/ScheduledTask.cs create mode 100644 OversightService/Config.cs create mode 100644 OversightService/EncryptionHelper.cs create mode 100644 OversightService/Services/ApiClient.cs create mode 100644 OversightService/Services/LoginResponse.cs create mode 100644 OversightService/Services/OsqueryService.cs create mode 100644 OversightService/Services/OsqueryTaskScheduler.cs create mode 100644 OversightService/Services/PatchComplianceTask.cs create mode 100644 OversightService/Services/ScheduledTask.cs create mode 100644 OversightService/config.json create mode 100644 OversightService/osqueryi.exe diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 932a99a..cca9991 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -1,7 +1,8 @@ { "permissions": { "allow": [ - "Bash(\"BuildDir\\bin\\Debug\\Assets\\osqueryi.exe\" --json \"SELECT datetime((SELECT CAST(unix_time AS INTEGER) FROM time) - total_seconds, ''unixepoch'') as boot_time FROM uptime;\")" + "Bash(\"BuildDir\\bin\\Debug\\Assets\\osqueryi.exe\" --json \"SELECT datetime((SELECT CAST(unix_time AS INTEGER) FROM time) - total_seconds, ''unixepoch'') as boot_time FROM uptime;\")", + "Bash(git describe:*)" ], "deny": [], "ask": [] diff --git a/Directory.Packages.props b/Directory.Packages.props index 4bcc052..bd35fe1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -41,5 +41,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + + \ No newline at end of file diff --git a/LD-SysInfo/Config.cs b/LD-SysInfo/Config.cs index 17949fa..36fc17b 100644 --- a/LD-SysInfo/Config.cs +++ b/LD-SysInfo/Config.cs @@ -14,6 +14,14 @@ namespace LD_SysInfo [JsonProperty("SystemInfoInterval")] public int SystemInfoInterval { get; set; } = 60; [JsonProperty("ClientIdentifier")] public string ClientIdentifier { get; set; } = "your-default-client-id"; [JsonProperty("Auth")] public AuthConfig Auth { get; set; } = new(); + [JsonProperty("PatchCompliance")] public PatchComplianceConfig PatchCompliance { get; set; } = new(); + } + + public class PatchComplianceConfig + { + [JsonProperty("Enabled")] public bool Enabled { get; set; } = false; + [JsonProperty("CheckIntervalHours")] public int CheckIntervalHours { get; set; } = 24; + [JsonProperty("LastCheckTime")] public DateTime? LastCheckTime { get; set; } = null; } public class AuthConfig diff --git a/LD-SysInfo/LD_SysInfo.csproj b/LD-SysInfo/LD_SysInfo.csproj index 4c1098c..28c2fe7 100644 --- a/LD-SysInfo/LD_SysInfo.csproj +++ b/LD-SysInfo/LD_SysInfo.csproj @@ -72,6 +72,7 @@ + diff --git a/LD-SysInfo/MainWindow.xaml b/LD-SysInfo/MainWindow.xaml index 2285cf0..d206398 100644 --- a/LD-SysInfo/MainWindow.xaml +++ b/LD-SysInfo/MainWindow.xaml @@ -230,6 +230,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + +