Resolved device list and IP addresses not working via osqueryi.

Now also returning last boottime by doing bootup time and math from current time
This commit is contained in:
2025-11-04 08:55:00 +08:00
parent cedf28199e
commit dce789db94
3 changed files with 8 additions and 9 deletions

View File

@@ -1,9 +1,7 @@
{
"permissions": {
"allow": [
"Bash(dotnet build:*)",
"Bash(git add:*)",
"Bash(git commit -m \"$(cat <<''EOF''\nRelease v1.2.0: Integrate osquery for enhanced system information\n\nMajor Features:\n- Integrated osquery for comprehensive system information gathering\n- Added OsqueryService for executing SQL queries against system tables\n- Implemented Osquery Console tab for interactive SQL queries\n\nSystem Info Improvements:\n- Enhanced system info collection using osquery tables\n- Added support for multiple GPU detection\n- Improved memory detection with proper GB formatting\n- Fixed OS Architecture detection (x64/x86)\n- Better network interface detection (IPv4 only)\n- Human-readable timestamp formatting\n\nUI/UX Enhancements:\n- Added window resizing with corner drag support\n- Implemented dynamic window sizing (SizeToContent)\n- Added ScrollViewer for content overflow\n- Improved IP address formatting with bullet points\n- Added field labels to all system info displays\n- Set minimum/maximum window size constraints\n\nBug Fixes:\n- Fixed XAML StackPanel Spacing property issue\n- Merged duplicate MainWindow constructors\n- Fixed non-nullable field warnings\n- Fixed EventHandler nullability signatures\n- Removed redundant hostname/OS name fields\n- Fixed GPU registry query to detect all GPUs\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")"
"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;\")"
],
"deny": [],
"ask": []

View File

@@ -9,7 +9,8 @@
<UseWPF>true</UseWPF>
<StartupObject>LD_SysInfo.App</StartupObject>
<ApplicationIcon>Assets\LDShortcut.ico</ApplicationIcon>
<OutputPath>C:\Users\Sonder\source\repos\psg-oversight-app\BuildDir\bin\Debug\net8.0-windows\</OutputPath>
<OutputPath>C:\Users\Sonder\source\repos\psg-oversight-app\BuildDir\bin\Debug\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IncludeSatelliteAssembliesForPublish>false</IncludeSatelliteAssembliesForPublish>
<!-- 🔢 Version Info -->

View File

@@ -142,10 +142,10 @@ namespace LD_SysInfo
}
// ✅ Drives
info.Drives = OsqueryService.Query("SELECT device, size, free_space, type FROM logical_drives;")
info.Drives = OsqueryService.Query("SELECT device_id, size, free_space, type FROM logical_drives;")
.Select(d => new DriveInfoSummary
{
Name = d.GetValueOrDefault("device"),
Name = d.GetValueOrDefault("device_id"),
TotalSizeGB = d.ContainsKey("size") && double.TryParse(d["size"], out double size)
? Math.Round(size / (1024.0 * 1024.0 * 1024.0), 2) : 0,
FreeSpaceGB = d.ContainsKey("free_space") && double.TryParse(d["free_space"], out double free)
@@ -179,9 +179,9 @@ namespace LD_SysInfo
.Where(ni => !string.IsNullOrEmpty(ni.IpAddress))
.ToList();
// ✅ Last boot time
info.LastBootTime = OsqueryService.Query("SELECT datetime(boot_time, 'unixepoch') AS last_boot FROM uptime;")
.FirstOrDefault()?.GetValueOrDefault("last_boot");
// ✅ Last boot time - calculate from current time minus uptime
info.LastBootTime = OsqueryService.Query("SELECT datetime((SELECT CAST(unix_time AS INTEGER) FROM time) - total_seconds, 'unixepoch') as boot_time FROM uptime;")
.FirstOrDefault()?.GetValueOrDefault("boot_time");
// ✅ Installed apps (user + system)
info.InstalledApplications = OsqueryService.Query("SELECT name, version, publisher FROM programs;")