diff --git a/.gitignore b/.gitignore
index 0385ff2..9491a2f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,19 +1,21 @@
-*.swp
-*.*~
-project.lock.json
-.DS_Store
-*.pyc
-nupkg/
-
-# Visual Studio Code
-.vscode
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
+*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
# Build results
[Dd]ebug/
[Dd]ebugPublic/
@@ -21,11 +23,341 @@ nupkg/
[Rr]eleases/
x64/
x86/
-build/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
-msbuild.log
-msbuild.err
-msbuild.wrn
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
\ No newline at end of file
diff --git a/insight.sln b/insight.sln
new file mode 100644
index 0000000..c6e0266
--- /dev/null
+++ b/insight.sln
@@ -0,0 +1,105 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32210.238
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{88B03853-2215-4E52-8986-0E76602E5F21}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{038C3821-E554-496D-B585-A3BC193B7913}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Agent", "Agent", "{140F73DD-29D3-4C44-809B-5B470880AA0D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Setup", "Setup", "{15D04093-4974-4B2F-AE8A-F3721F31767A}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Updater", "Updater", "{F2D241DB-7692-46DB-8A6A-958B365DAAF8}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Infrastructure", "src\Core\Insight.Infrastructure\Insight.Infrastructure.csproj", "{3DC54216-3D5A-4DCE-9B1E-3D1AF2DE8C2C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{3F000016-069D-477E-ACA3-F643880B57E8}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Domain", "src\Core\Insight.Domain\Insight.Domain.csproj", "{02A50CD8-40DF-4329-89A9-961ED78EDAA6}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Setup.Windows", "src\Setup\Insight.Setup.Windows\Insight.Setup.Windows.csproj", "{CA99B8CF-520A-4B48-ACCE-0A301C35A7FE}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Web", "src\Web\Insight.Web\Insight.Web.csproj", "{375EF474-512A-4410-86CF-46974E07C1F7}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Api", "Api", "{35BA5DCB-BECC-4F51-8DD0-694C555D205A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Api", "src\Api\Insight.Api\Insight.Api.csproj", "{EF3188D7-338D-43DA-BF6B-D26E5BDAC3A6}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Server", "src\Server\Insight.Server\Insight.Server.csproj", "{1E75F7E9-E6AA-44E7-A2F3-DB4CA85E0118}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Updater", "src\Updater\Insight.Updater\Insight.Updater.csproj", "{4875D70F-A96B-4EBA-99BE-218886D29BEB}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Web.Assets", "src\Web\Insight.Web.Assets\Insight.Web.Assets.csproj", "{EBB8A2A8-453B-4867-A8E2-072530391DD0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Agent", "src\Agent\Insight.Agent\Insight.Agent.csproj", "{2A391CA2-F96B-4DB7-80AA-0668A5141640}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Agent.Assets", "src\Agent\Insight.Agent.Assets\Insight.Agent.Assets.csproj", "{4C2B66EA-4EE1-47BF-BAEE-DDBAF6FCB324}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3DC54216-3D5A-4DCE-9B1E-3D1AF2DE8C2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3DC54216-3D5A-4DCE-9B1E-3D1AF2DE8C2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3DC54216-3D5A-4DCE-9B1E-3D1AF2DE8C2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3DC54216-3D5A-4DCE-9B1E-3D1AF2DE8C2C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {02A50CD8-40DF-4329-89A9-961ED78EDAA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {02A50CD8-40DF-4329-89A9-961ED78EDAA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {02A50CD8-40DF-4329-89A9-961ED78EDAA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {02A50CD8-40DF-4329-89A9-961ED78EDAA6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CA99B8CF-520A-4B48-ACCE-0A301C35A7FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CA99B8CF-520A-4B48-ACCE-0A301C35A7FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CA99B8CF-520A-4B48-ACCE-0A301C35A7FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CA99B8CF-520A-4B48-ACCE-0A301C35A7FE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {375EF474-512A-4410-86CF-46974E07C1F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {375EF474-512A-4410-86CF-46974E07C1F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {375EF474-512A-4410-86CF-46974E07C1F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {375EF474-512A-4410-86CF-46974E07C1F7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EF3188D7-338D-43DA-BF6B-D26E5BDAC3A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EF3188D7-338D-43DA-BF6B-D26E5BDAC3A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EF3188D7-338D-43DA-BF6B-D26E5BDAC3A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EF3188D7-338D-43DA-BF6B-D26E5BDAC3A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1E75F7E9-E6AA-44E7-A2F3-DB4CA85E0118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1E75F7E9-E6AA-44E7-A2F3-DB4CA85E0118}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1E75F7E9-E6AA-44E7-A2F3-DB4CA85E0118}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1E75F7E9-E6AA-44E7-A2F3-DB4CA85E0118}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4875D70F-A96B-4EBA-99BE-218886D29BEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4875D70F-A96B-4EBA-99BE-218886D29BEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4875D70F-A96B-4EBA-99BE-218886D29BEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4875D70F-A96B-4EBA-99BE-218886D29BEB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EBB8A2A8-453B-4867-A8E2-072530391DD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EBB8A2A8-453B-4867-A8E2-072530391DD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EBB8A2A8-453B-4867-A8E2-072530391DD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EBB8A2A8-453B-4867-A8E2-072530391DD0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2A391CA2-F96B-4DB7-80AA-0668A5141640}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A391CA2-F96B-4DB7-80AA-0668A5141640}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A391CA2-F96B-4DB7-80AA-0668A5141640}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A391CA2-F96B-4DB7-80AA-0668A5141640}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4C2B66EA-4EE1-47BF-BAEE-DDBAF6FCB324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C2B66EA-4EE1-47BF-BAEE-DDBAF6FCB324}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4C2B66EA-4EE1-47BF-BAEE-DDBAF6FCB324}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4C2B66EA-4EE1-47BF-BAEE-DDBAF6FCB324}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {3DC54216-3D5A-4DCE-9B1E-3D1AF2DE8C2C} = {88B03853-2215-4E52-8986-0E76602E5F21}
+ {02A50CD8-40DF-4329-89A9-961ED78EDAA6} = {88B03853-2215-4E52-8986-0E76602E5F21}
+ {CA99B8CF-520A-4B48-ACCE-0A301C35A7FE} = {15D04093-4974-4B2F-AE8A-F3721F31767A}
+ {375EF474-512A-4410-86CF-46974E07C1F7} = {3F000016-069D-477E-ACA3-F643880B57E8}
+ {EF3188D7-338D-43DA-BF6B-D26E5BDAC3A6} = {35BA5DCB-BECC-4F51-8DD0-694C555D205A}
+ {1E75F7E9-E6AA-44E7-A2F3-DB4CA85E0118} = {038C3821-E554-496D-B585-A3BC193B7913}
+ {4875D70F-A96B-4EBA-99BE-218886D29BEB} = {F2D241DB-7692-46DB-8A6A-958B365DAAF8}
+ {EBB8A2A8-453B-4867-A8E2-072530391DD0} = {3F000016-069D-477E-ACA3-F643880B57E8}
+ {2A391CA2-F96B-4DB7-80AA-0668A5141640} = {140F73DD-29D3-4C44-809B-5B470880AA0D}
+ {4C2B66EA-4EE1-47BF-BAEE-DDBAF6FCB324} = {140F73DD-29D3-4C44-809B-5B470880AA0D}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F376A326-7590-4E7E-AB9B-76CED8527AB0}
+ EndGlobalSection
+EndGlobal
diff --git a/src/Agent/Insight.Agent.Assets/Enums/CategoryEnum.cs b/src/Agent/Insight.Agent.Assets/Enums/CategoryEnum.cs
new file mode 100644
index 0000000..5ba8cb9
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Enums/CategoryEnum.cs
@@ -0,0 +1,14 @@
+namespace Insight.Agent.Enums
+{
+ public enum CategoryEnum
+ {
+ Network = 1,
+ System = 2,
+ Application = 3,
+ Security = 4,
+ Monitoring = 5,
+ Task = 6,
+ Printer = 7,
+ RDP = 8
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Enums/DispatchEnum.cs b/src/Agent/Insight.Agent.Assets/Enums/DispatchEnum.cs
new file mode 100644
index 0000000..2d824d4
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Enums/DispatchEnum.cs
@@ -0,0 +1,9 @@
+namespace Insight.Agent.Enums
+{
+ public enum DispatchEnum
+ {
+ Pending = 1,
+ Failure = 2,
+ Success = 3,
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Enums/StatusEnum.cs b/src/Agent/Insight.Agent.Assets/Enums/StatusEnum.cs
new file mode 100644
index 0000000..49b8e7d
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Enums/StatusEnum.cs
@@ -0,0 +1,9 @@
+namespace Insight.Agent.Enums
+{
+ public enum StatusEnum
+ {
+ Information = 1,
+ Warning = 2,
+ Error = 3
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Insight.Agent.Assets.csproj b/src/Agent/Insight.Agent.Assets/Insight.Agent.Assets.csproj
new file mode 100644
index 0000000..540ca66
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Insight.Agent.Assets.csproj
@@ -0,0 +1,30 @@
+
+
+
+ net7.0
+ true
+ enable
+ Insight.Agent.Assets
+ Insight.Agent
+ Insight
+ 2023.9.14.0
+
+
+
+ none
+
+
+
+ none
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Agent/Insight.Agent.Assets/Interfaces/IAgentMessageHandler.cs b/src/Agent/Insight.Agent.Assets/Interfaces/IAgentMessageHandler.cs
new file mode 100644
index 0000000..a9e69a6
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Interfaces/IAgentMessageHandler.cs
@@ -0,0 +1,9 @@
+using Insight.Agent.Messages;
+
+namespace Insight.Agent.Interfaces
+{
+ public partial interface IAgentMessageHandler
+ {
+ ValueTask HandleAsync(TSender sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage;
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Application/Application.cs b/src/Agent/Insight.Agent.Assets/Messages/Application/Application.cs
new file mode 100644
index 0000000..ba3ad5c
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Application/Application.cs
@@ -0,0 +1,41 @@
+using MemoryPack;
+using System.Runtime.InteropServices;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(120, typeof(Application))]
+ [MemoryPackUnion(121, typeof(ApplicationList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Application : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Publisher { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Version { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Location { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Source { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Uninstall { get; set; }
+
+ [MemoryPackOrder(6)]
+ public DateTime? InstallDate { get; set; }
+
+ [MemoryPackOrder(7)]
+ public Architecture? Architecture { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class ApplicationList : List, IAgentMessage { }
+
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Authentication/Authentication.cs b/src/Agent/Insight.Agent.Assets/Messages/Authentication/Authentication.cs
new file mode 100644
index 0000000..84406f4
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Authentication/Authentication.cs
@@ -0,0 +1,34 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(1, typeof(Authentication))]
+ [MemoryPackUnion(2, typeof(AuthenticationRequest))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Authentication : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public PlatformType? Platform { get; set; }
+
+ [MemoryPackOrder(1)]
+ public Guid Serial { get; set; }
+
+ [MemoryPackOrder(2)]
+ public Version? Version { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Hostname { get; set; }
+
+ public enum PlatformType
+ {
+ Unknown = 0,
+ Windows = 1,
+ Unix = 2
+ }
+ }
+
+ [MemoryPackable]
+ public partial class AuthenticationRequest : IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Commands/Commands.cs b/src/Agent/Insight.Agent.Assets/Messages/Commands/Commands.cs
new file mode 100644
index 0000000..b231232
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Commands/Commands.cs
@@ -0,0 +1,10 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(2000, typeof(GetInventory))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class GetInventory : IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Console/ConsoleQuery.cs b/src/Agent/Insight.Agent.Assets/Messages/Console/ConsoleQuery.cs
new file mode 100644
index 0000000..369304c
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Console/ConsoleQuery.cs
@@ -0,0 +1,49 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(1000, typeof(ConsoleQuery))]
+ [MemoryPackUnion(1001, typeof(ConsoleQueryRequest))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class ConsoleQuery : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Id { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? HostId { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Query { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Data { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Errors { get; set; }
+
+ [MemoryPackOrder(5)]
+ public bool IsString { get; set; }
+
+ [MemoryPackOrder(6)]
+ public bool IsArray { get; set; }
+
+ [MemoryPackOrder(7)]
+ public bool HadErrors { get; set; }
+ }
+
+ [MemoryPackable]
+ public partial class ConsoleQueryRequest : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Id { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? HostId { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Query { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Drive/Drive.cs b/src/Agent/Insight.Agent.Assets/Messages/Drive/Drive.cs
new file mode 100644
index 0000000..5a2f966
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Drive/Drive.cs
@@ -0,0 +1,103 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(50, typeof(Drive))]
+ [MemoryPackUnion(51, typeof(DriveList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Drive : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public uint? Index { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Id { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Manufacturer { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? SerialNumber { get; set; }
+
+ [MemoryPackOrder(5)]
+ public ulong? Size { get; set; }
+
+ [MemoryPackOrder(6)]
+ public string? Status { get; set; }
+
+ [MemoryPackOrder(7)]
+ public string? InterfaceType { get; set; }
+
+ [MemoryPackOrder(8)]
+ public string? FirmwareRevision { get; set; }
+
+ [MemoryPackOrder(9)]
+ public string? PNPDeviceID { get; set; }
+
+ [MemoryPackOrder(10)]
+ public List? Volumes { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class DriveList : List, IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Volume : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public uint? Index { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Id { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? SerialNumber { get; set; }
+
+ [MemoryPackOrder(4)]
+ public ulong? Size { get; set; }
+
+ [MemoryPackOrder(5)]
+ public ulong? FreeSpace { get; set; }
+
+ [MemoryPackOrder(6)]
+ public string? Type { get; set; }
+
+ [MemoryPackOrder(7)]
+ public string? FileSystem { get; set; }
+
+ [MemoryPackOrder(8)]
+ public bool? Compressed { get; set; }
+
+ [MemoryPackOrder(9)]
+ public bool? Bootable { get; set; }
+
+ [MemoryPackOrder(10)]
+ public bool? PrimaryPartition { get; set; }
+
+ [MemoryPackOrder(11)]
+ public bool? BootPartition { get; set; }
+
+ [MemoryPackOrder(12)]
+ public ulong? BlockSize { get; set; }
+
+ [MemoryPackOrder(13)]
+ public ulong? NumberOfBlocks { get; set; }
+
+ [MemoryPackOrder(14)]
+ public ulong? StartingOffset { get; set; }
+
+ [MemoryPackOrder(15)]
+ public DriveType? DriveType { get; set; }
+
+ [MemoryPackOrder(16)]
+ public string? ProviderName { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Event/Event.cs b/src/Agent/Insight.Agent.Assets/Messages/Event/Event.cs
new file mode 100644
index 0000000..edd3b61
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Event/Event.cs
@@ -0,0 +1,41 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(10, typeof(Event))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Event : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public DateTime? Timestamp { get; set; }
+
+ [MemoryPackOrder(1)]
+ public StatusType? Status { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Source { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Category { get; set; }
+
+ [MemoryPackOrder(4)]
+ public int? EventId { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Task { get; set; }
+
+ [MemoryPackOrder(6)]
+ public string? Message { get; set; }
+
+ public enum StatusType
+ {
+ Unknown = 0,
+ Information = 1,
+ Warning = 2,
+ Error = 3,
+ Critical = 4
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/IAgentMessage.cs b/src/Agent/Insight.Agent.Assets/Messages/IAgentMessage.cs
new file mode 100644
index 0000000..3c3edf0
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/IAgentMessage.cs
@@ -0,0 +1,7 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackable]
+ public partial interface IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Interface/Interface.cs b/src/Agent/Insight.Agent.Assets/Messages/Interface/Interface.cs
new file mode 100644
index 0000000..1c008c5
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Interface/Interface.cs
@@ -0,0 +1,195 @@
+using MemoryPack;
+using System.Net;
+using System.Net.NetworkInformation;
+using System.Net.Sockets;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(70, typeof(Interface))]
+ [MemoryPackUnion(71, typeof(InterfaceList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Interface : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public uint? Index { get; set; }
+
+ [MemoryPackOrder(1)]
+ public Guid? Guid { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Mac { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Description { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Manufacturer { get; set; }
+
+ [MemoryPackOrder(6)]
+ public string? Suffix { get; set; }
+
+ [MemoryPackOrder(7)]
+ public bool? Physical { get; set; }
+
+ [MemoryPackOrder(8)]
+ public NetworkInterfaceType? Type { get; set; }
+
+ [MemoryPackOrder(9)]
+ public OperationalStatus? Status { get; set; }
+
+ [MemoryPackOrder(10)]
+ public long? Speed { get; set; }
+
+ [MemoryPackOrder(11)]
+ public long? Ipv4Mtu { get; set; }
+
+ [MemoryPackOrder(12)]
+ public bool? Ipv4Dhcp { get; set; }
+
+ [MemoryPackOrder(13)]
+ public bool? Ipv4Forwarding { get; set; }
+
+ [MemoryPackOrder(14)]
+ public long? Ipv6Mtu { get; set; }
+
+ [MemoryPackOrder(15)]
+ public long? Sent { get; set; }
+
+ [MemoryPackOrder(16)]
+ public long? Received { get; set; }
+
+ [MemoryPackOrder(17)]
+ public long? IncomingPacketsDiscarded { get; set; }
+
+ [MemoryPackOrder(18)]
+ public long? IncomingPacketsWithErrors { get; set; }
+
+ [MemoryPackOrder(19)]
+ public long? IncomingUnknownProtocolPackets { get; set; }
+
+ [MemoryPackOrder(20)]
+ public long? OutgoingPacketsDiscarded { get; set; }
+
+ [MemoryPackOrder(21)]
+ public long? OutgoingPacketsWithErrors { get; set; }
+
+ [MemoryPackOrder(22)]
+ public List? Addresses { get; set; }
+
+ [MemoryPackOrder(23)]
+ public List? Gateways { get; set; }
+
+ [MemoryPackOrder(24)]
+ public List? Dns { get; set; }
+
+ [MemoryPackOrder(25)]
+ public List? Dhcp { get; set; }
+
+ [MemoryPackOrder(26)]
+ public List? Routes { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class InterfaceList : List, IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Unicast : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public IPAddress2? IpAddress { get; set; }
+
+ [MemoryPackOrder(1)]
+ public IPAddress2? Ipv4Mask { get; set; }
+
+ [MemoryPackOrder(2)]
+ public long? AddressPreferredLifetime { get; set; }
+
+ [MemoryPackOrder(3)]
+ public long? AddressValidLifetime { get; set; }
+
+ [MemoryPackOrder(4)]
+ public long? DhcpLeaseLifetime { get; set; }
+
+ [MemoryPackOrder(5)]
+ public DuplicateAddressDetectionState? DuplicateAddressDetectionState { get; set; }
+
+ [MemoryPackOrder(6)]
+ public int? PrefixLength { get; set; }
+
+ [MemoryPackOrder(7)]
+ public PrefixOrigin? PrefixOrigin { get; set; }
+
+ [MemoryPackOrder(8)]
+ public SuffixOrigin? SuffixOrigin { get; set; }
+ }
+
+ [MemoryPackable]
+ public partial class Route : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public uint? InterfaceIndex { get; set; }
+
+ [MemoryPackOrder(1)]
+ public IPAddress2? Destination { get; set; }
+
+ [MemoryPackOrder(2)]
+ public IPAddress2? Gateway { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Mask { get; set; }
+
+ [MemoryPackOrder(4)]
+ public int? Metric { get; set; }
+ }
+
+ [MemoryPackable]
+ public partial class IPAddress2 : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public AddressFamily? AddressFamily { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Address { get; set; }
+
+ [MemoryPackOrder(2)]
+ public bool? IsIPv6Teredo { get; set; }
+
+ [MemoryPackOrder(3)]
+ public bool? IsIPv6SiteLocal { get; set; }
+
+ [MemoryPackOrder(4)]
+ public bool? IsIPv6Multicast { get; set; }
+
+ [MemoryPackOrder(5)]
+ public bool? IsIPv6LinkLocal { get; set; }
+
+ [MemoryPackOrder(6)]
+ public bool? IsIPv4MappedToIPv6 { get; set; }
+
+ [MemoryPackOrder(7)]
+ public bool? IsIPv6UniqueLocal { get; set; }
+
+ [MemoryPackConstructor]
+ public IPAddress2()
+ {
+
+ }
+
+ public IPAddress2(IPAddress address)
+ {
+ AddressFamily = address.AddressFamily;
+ Address = address.ToString();
+ IsIPv4MappedToIPv6 = address.IsIPv4MappedToIPv6;
+ IsIPv6LinkLocal = address.IsIPv6LinkLocal;
+ IsIPv6Multicast = address.IsIPv6Multicast;
+ IsIPv6SiteLocal = address.IsIPv6SiteLocal;
+ IsIPv6Teredo = address.IsIPv6Teredo;
+ IsIPv6UniqueLocal = address.IsIPv6UniqueLocal;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Keepalive/Keepalive.cs b/src/Agent/Insight.Agent.Assets/Messages/Keepalive/Keepalive.cs
new file mode 100644
index 0000000..63588dc
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Keepalive/Keepalive.cs
@@ -0,0 +1,10 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(0, typeof(Keepalive))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Keepalive : IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Mainboard/Mainboard.cs b/src/Agent/Insight.Agent.Assets/Messages/Mainboard/Mainboard.cs
new file mode 100644
index 0000000..a86bc5b
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Mainboard/Mainboard.cs
@@ -0,0 +1,29 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(20, typeof(Mainboard))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Mainboard : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Manufacturer { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Model { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Serial { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? BiosManufacturer { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? BiosVersion { get; set; }
+
+ [MemoryPackOrder(5)]
+ public DateTime? BiosDate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Memory/Memory.cs b/src/Agent/Insight.Agent.Assets/Messages/Memory/Memory.cs
new file mode 100644
index 0000000..bb8e444
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Memory/Memory.cs
@@ -0,0 +1,67 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(40, typeof(Memory))]
+ [MemoryPackUnion(41, typeof(MemoryList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Memory : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public uint? Index { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Tag { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Location { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Manufacturer { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Model { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Serial { get; set; }
+
+ [MemoryPackOrder(6)]
+ public ulong? Capacity { get; set; }
+
+ [MemoryPackOrder(7)]
+ public uint? Speed { get; set; }
+
+ [MemoryPackOrder(8)]
+ public uint? Voltage { get; set; }
+
+ [MemoryPackOrder(9)]
+ public uint? ConfiguredSpeed { get; set; }
+
+ [MemoryPackOrder(10)]
+ public uint? ConfiguredVoltage { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class MemoryList : List, IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class MemoryMetric : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public DateTime? Timestamp { get; set; }
+
+ [MemoryPackOrder(1)]
+ public float? MemoryAvailable { get; set; }
+
+ [MemoryPackOrder(2)]
+ public float? MemoryAvailablePercentage { get; set; }
+
+ [MemoryPackOrder(3)]
+ public float? MemoryUsed { get; set; }
+
+ [MemoryPackOrder(4)]
+ public float? MemoryUsagePercentage { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/OperationSystem/OperationSystem.cs b/src/Agent/Insight.Agent.Assets/Messages/OperationSystem/OperationSystem.cs
new file mode 100644
index 0000000..0fe4ee5
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/OperationSystem/OperationSystem.cs
@@ -0,0 +1,30 @@
+using MemoryPack;
+using System.Runtime.InteropServices;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(90, typeof(OperationSystem))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class OperationSystem : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Version { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? SerialNumber { get; set; }
+
+ [MemoryPackOrder(3)]
+ public Architecture? Architecture { get; set; }
+
+ [MemoryPackOrder(4)]
+ public bool? Virtual { get; set; }
+
+ [MemoryPackOrder(5)]
+ public DateTime? InstallDate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Printer/Printer.cs b/src/Agent/Insight.Agent.Assets/Messages/Printer/Printer.cs
new file mode 100644
index 0000000..0478fc0
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Printer/Printer.cs
@@ -0,0 +1,30 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(140, typeof(Printer))]
+ [MemoryPackUnion(141, typeof(PrinterList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Printer : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Driver { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Port { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Location { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Comment { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class PrinterList : List, IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Processor/Processor.cs b/src/Agent/Insight.Agent.Assets/Messages/Processor/Processor.cs
new file mode 100644
index 0000000..edd63af
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Processor/Processor.cs
@@ -0,0 +1,70 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(30, typeof(Processor))]
+ [MemoryPackUnion(31, typeof(ProcessorList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Processor : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public uint? Index { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Manufacturer { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? SerialNumber { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Socket { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Version { get; set; }
+
+ [MemoryPackOrder(6)]
+ public string? DeviceId { get; set; }
+
+ [MemoryPackOrder(7)]
+ public uint? Cores { get; set; }
+
+ [MemoryPackOrder(8)]
+ public uint? LogicalCores { get; set; }
+
+ [MemoryPackOrder(9)]
+ public uint? CurrentSpeed { get; set; }
+
+ [MemoryPackOrder(10)]
+ public uint? MaxSpeed { get; set; }
+
+ [MemoryPackOrder(11)]
+ public uint? L1Size { get; set; }
+
+ [MemoryPackOrder(12)]
+ public uint? L2Size { get; set; }
+
+ [MemoryPackOrder(13)]
+ public uint? L3Size { get; set; }
+
+ [MemoryPackOrder(14)]
+ public bool? Virtualization { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class ProcessorList : List, IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class ProcessorMetric : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public DateTime? Timestamp { get; set; }
+
+ [MemoryPackOrder(1)]
+ public float? ProcessorUsagePercentage { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Service/Service.cs b/src/Agent/Insight.Agent.Assets/Messages/Service/Service.cs
new file mode 100644
index 0000000..61aa86d
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Service/Service.cs
@@ -0,0 +1,64 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(130, typeof(Service))]
+ [MemoryPackUnion(131, typeof(ServiceList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Service : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public uint? ProcessId { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Display { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Description { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? PathName { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Account { get; set; }
+
+ [MemoryPackOrder(6)]
+ public bool? Delay { get; set; }
+
+ [MemoryPackOrder(7)]
+ public ServiceStatus? Status { get; set; }
+
+ [MemoryPackOrder(8)]
+ public ServiceMode? StartMode { get; set; }
+
+ public enum ServiceStatus
+ {
+ Unknown = -1,
+ Stopped = 1,
+ StartPending = 2,
+ StopPending = 3,
+ Running = 4,
+ ContinuePending = 5,
+ PausePending = 6,
+ Paused = 7
+ }
+
+ public enum ServiceMode
+ {
+ Unknown = -1,
+ Boot = 0,
+ System = 1,
+ Automatic = 2,
+ Manual = 3,
+ Disabled = 4
+ }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class ServiceList : List, IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Session/Session.cs b/src/Agent/Insight.Agent.Assets/Messages/Session/Session.cs
new file mode 100644
index 0000000..625c4ef
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Session/Session.cs
@@ -0,0 +1,30 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(110, typeof(Session))]
+ [MemoryPackUnion(111, typeof(SessionList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Session : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Sid { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? User { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Type { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Status { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Remote { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class SessionList : List, IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Status/Status.cs b/src/Agent/Insight.Agent.Assets/Messages/Status/Status.cs
new file mode 100644
index 0000000..de31591
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Status/Status.cs
@@ -0,0 +1,17 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(3, typeof(Status))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Status : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public DateTime Timestamp { get; } = DateTime.Now;
+
+ [MemoryPackOrder(1)]
+ public TimeSpan Uptime { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/StoragePool/StoragePool.cs b/src/Agent/Insight.Agent.Assets/Messages/StoragePool/StoragePool.cs
new file mode 100644
index 0000000..6148979
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/StoragePool/StoragePool.cs
@@ -0,0 +1,302 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(160, typeof(StoragePool))]
+ [MemoryPackUnion(161, typeof(StoragePoolList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class StoragePool : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? UniqueId { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? FriendlyName { get; set; }
+
+ [MemoryPackOrder(3)]
+ public List? States { get; set; }
+
+ [MemoryPackOrder(4)]
+ public HealthState? Health { get; set; }
+
+ [MemoryPackOrder(5)]
+ public RetireMissingPhysicalDisksEnum? RetireMissingPhysicalDisks { get; set; }
+
+ [MemoryPackOrder(6)]
+ public string? Resiliency { get; set; }
+
+ [MemoryPackOrder(7)]
+ public bool? IsPrimordial { get; set; }
+
+ [MemoryPackOrder(8)]
+ public bool? IsReadOnly { get; set; }
+
+ [MemoryPackOrder(9)]
+ public bool? IsClustered { get; set; }
+
+ [MemoryPackOrder(10)]
+ public ulong? Size { get; set; }
+
+ [MemoryPackOrder(11)]
+ public ulong? AllocatedSize { get; set; }
+
+ [MemoryPackOrder(12)]
+ public ulong? SectorSize { get; set; }
+
+ [MemoryPackOrder(13)]
+ public List? PhysicalDisks { get; set; }
+
+ [MemoryPackOrder(14)]
+ public List? VirtualDisks { get; set; }
+
+ public enum OperationalState
+ {
+ Unknown = 0,
+ Other = 1,
+ OK = 2,
+ Degraded = 3,
+ Stressed = 4,
+ Predictive_Failure = 5,
+ Error = 6,
+ Non_Recoverable_Error = 7,
+ Starting = 8,
+ Stopping = 9,
+ Stopped = 10,
+ In_Service = 11,
+ No_Contact = 12,
+ Lost_Communication = 13,
+ Aborted = 14,
+ Dormant = 15,
+ Supporting_Entity_In_Error = 16,
+ Completed = 17,
+ Power_Mode = 18,
+ Relocating = 19
+ }
+
+ public enum HealthState
+ {
+ Healthy = 0,
+ Warning = 1,
+ Unhealthy = 2,
+ Unknown = 3
+ }
+
+ public enum RetireMissingPhysicalDisksEnum
+ {
+ Auto = 1,
+ Always = 2,
+ Never = 3
+ }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class StoragePoolList : List, IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class PhysicalDisk : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? UniqueId { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? DeviceId { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? FriendlyName { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Manufacturer { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Model { get; set; }
+
+ [MemoryPackOrder(5)]
+ public ushort? MediaType { get; set; }
+
+ [MemoryPackOrder(6)]
+ public ushort? BusType { get; set; }
+
+ [MemoryPackOrder(7)]
+ public List? States { get; set; }
+
+ [MemoryPackOrder(8)]
+ public HealthState? Health { get; set; }
+
+ [MemoryPackOrder(9)]
+ public List? SupportedUsages { get; set; }
+
+ [MemoryPackOrder(10)]
+ public ushort? Usage { get; set; }
+
+ [MemoryPackOrder(11)]
+ public string? PhysicalLocation { get; set; }
+
+ [MemoryPackOrder(12)]
+ public string? SerialNumber { get; set; }
+
+ [MemoryPackOrder(13)]
+ public string? FirmwareVersion { get; set; }
+
+ [MemoryPackOrder(14)]
+ public ulong? Size { get; set; }
+
+ [MemoryPackOrder(15)]
+ public ulong? AllocatedSize { get; set; }
+
+ [MemoryPackOrder(16)]
+ public ulong? LogicalSectorSize { get; set; }
+
+ [MemoryPackOrder(17)]
+ public ulong? PhysicalSectorSize { get; set; }
+
+ [MemoryPackOrder(18)]
+ public ulong? VirtualDiskFootprint { get; set; }
+
+ public enum OperationalState
+ {
+ Unknown = 0,
+ Other = 1,
+ OK = 2,
+ Degraded = 3,
+ Stressed = 4,
+ Predictive_Failure = 5,
+ Error = 6,
+ Non_Recoverable_Error = 7,
+ Starting = 8,
+ Stopping = 9,
+ Stopped = 10,
+ In_Service = 11,
+ No_Contact = 12,
+ Lost_Communication = 13,
+ Aborted = 14,
+ Dormant = 15,
+ Supporting_Entity_In_Error = 16,
+ Completed = 17,
+ Power_Mode = 18,
+ Relocating = 19
+ }
+
+ public enum HealthState
+ {
+ Healthy = 0,
+ Warning = 1,
+ Unhealthy = 2,
+ Unknown = 3
+ }
+
+ public enum SupportedUsagesEnum
+ {
+ Unknown = 0,
+ Auto_Select = 1,
+ Manual_Select = 2,
+ Hot_Spare = 3,
+ Retired = 4,
+ Journal = 5
+ }
+ }
+
+ [MemoryPackable]
+ public partial class VirtualDisk : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? UniqueId { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? FriendlyName { get; set; }
+
+ [MemoryPackOrder(3)]
+ public List? States { get; set; }
+
+ [MemoryPackOrder(4)]
+ public HealthState? Health { get; set; }
+
+ [MemoryPackOrder(5)]
+ public AccessTypeEnum? AccessType { get; set; }
+
+ [MemoryPackOrder(6)]
+ public ProvisioningTypeEnum? ProvisioningType { get; set; }
+
+ [MemoryPackOrder(7)]
+ public ushort? PhysicalDiskRedundancy { get; set; }
+
+ [MemoryPackOrder(8)]
+ public string? ResiliencySettingName { get; set; }
+
+ [MemoryPackOrder(9)]
+ public bool? Deduplication { get; set; }
+
+ [MemoryPackOrder(10)]
+ public bool? IsSnapshot { get; set; }
+
+ [MemoryPackOrder(11)]
+ public ulong? Size { get; set; }
+
+ [MemoryPackOrder(12)]
+ public ulong? AllocatedSize { get; set; }
+
+ [MemoryPackOrder(13)]
+ public ulong? FootprintOnPool { get; set; }
+
+ [MemoryPackOrder(14)]
+ public ulong? ReadCacheSize { get; set; }
+
+ [MemoryPackOrder(15)]
+ public ulong? WriteCacheSize { get; set; }
+
+ public enum OperationalState
+ {
+ Unknown = 0,
+ Other = 1,
+ OK = 2,
+ Degraded = 3,
+ Stressed = 4,
+ Predictive_Failure = 5,
+ Error = 6,
+ Non_Recoverable_Error = 7,
+ Starting = 8,
+ Stopping = 9,
+ Stopped = 10,
+ In_Service = 11,
+ No_Contact = 12,
+ Lost_Communication = 13,
+ Aborted = 14,
+ Dormant = 15,
+ Supporting_Entity_In_Error = 16,
+ Completed = 17,
+ Power_Mode = 18,
+ Relocating = 19
+ }
+
+ public enum HealthState
+ {
+ Healthy = 0,
+ Warning = 1,
+ Unhealthy = 2,
+ Unknown = 3
+ }
+
+ public enum AccessTypeEnum
+ {
+ Unknown = 0,
+ Readable = 1,
+ Writeable = 2,
+ Read_Write = 3,
+ Write_Once = 4
+ }
+
+ public enum ProvisioningTypeEnum
+ {
+ Unknown = 0,
+ Thin = 1,
+ Fixed = 2
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/SystemInfo/SystemInfo.cs b/src/Agent/Insight.Agent.Assets/Messages/SystemInfo/SystemInfo.cs
new file mode 100644
index 0000000..8ec0441
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/SystemInfo/SystemInfo.cs
@@ -0,0 +1,23 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(80, typeof(SystemInfo))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class SystemInfo : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public DateTime? LastBootUpTime { get; set; }
+
+ [MemoryPackOrder(1)]
+ public DateTime? LocalDateTime { get; set; }
+
+ [MemoryPackOrder(2)]
+ public uint? Processes { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? License { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Trap/Trap.cs b/src/Agent/Insight.Agent.Assets/Messages/Trap/Trap.cs
new file mode 100644
index 0000000..d0a66db
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Trap/Trap.cs
@@ -0,0 +1,29 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(11, typeof(Trap))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Trap : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public DateTime? Timestamp { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Endpoint { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Hostname { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Version { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Community { get; set; }
+
+ [MemoryPackOrder(5)]
+ public List>? Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Update/Update.cs b/src/Agent/Insight.Agent.Assets/Messages/Update/Update.cs
new file mode 100644
index 0000000..ecc84c1
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Update/Update.cs
@@ -0,0 +1,83 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(100, typeof(Update))]
+ [MemoryPackUnion(101, typeof(UpdateList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Update : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Id { get; set; }
+
+ [MemoryPackOrder(1)]
+ public DateTime? Date { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Description { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? SupportUrl { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Hotfix { get; set; }
+
+ // if installed
+ [MemoryPackOrder(6)]
+ public OsUpdateResultCodeEnum? Result { get; set; }
+
+ // if pending
+ [MemoryPackOrder(7)]
+ public OsUpdateTypeEnum? Type { get; set; }
+
+ [MemoryPackOrder(8)]
+ public decimal? Size { get; set; }
+
+ [MemoryPackOrder(9)]
+ public bool? IsDownloaded { get; set; }
+
+ [MemoryPackOrder(10)]
+ public bool? CanRequestUserInput { get; set; }
+
+ [MemoryPackOrder(11)]
+ public OsUpdateRebootBehaviorEnum? RebootBehavior { get; set; }
+
+ public enum OsUpdateRebootBehaviorEnum
+ {
+ NeverReboots = 1,
+ AlwaysRequiresReboot = 2,
+ CanRequestReboot = 3
+ }
+
+ public enum OsUpdateResultCodeEnum
+ {
+ NotStarted = 1,
+ InProgress = 2,
+ Succeeded = 3,
+ SucceededWithErrors = 4,
+ Failed = 5,
+ Aborted = 6
+ }
+
+ public enum OsUpdateTypeEnum
+ {
+ Software = 1,
+ Driver = 2
+ }
+ }
+
+ [MemoryPackable]
+ public partial class UpdateList : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public List? Installed { get; set; }
+
+ [MemoryPackOrder(1)]
+ public List? Pending { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/User/User.cs b/src/Agent/Insight.Agent.Assets/Messages/User/User.cs
new file mode 100644
index 0000000..968c4bb
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/User/User.cs
@@ -0,0 +1,73 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(150, typeof(User))]
+ [MemoryPackUnion(151, typeof(UserList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class User : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Sid { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Domain { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? FullName { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Description { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Status { get; set; }
+
+ [MemoryPackOrder(6)]
+ public bool? LocalAccount { get; set; }
+
+ [MemoryPackOrder(7)]
+ public bool? Disabled { get; set; }
+
+ [MemoryPackOrder(8)]
+ public bool? Lockout { get; set; }
+
+ [MemoryPackOrder(9)]
+ public bool? PasswordChangeable { get; set; }
+
+ [MemoryPackOrder(10)]
+ public bool? PasswordExpires { get; set; }
+
+ [MemoryPackOrder(11)]
+ public bool? PasswordRequired { get; set; }
+
+ [MemoryPackOrder(12)]
+ public List? Groups { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class UserList : List, IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Group : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Sid { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Domain { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Description { get; set; }
+
+ [MemoryPackOrder(4)]
+ public bool? LocalAccount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/Videocard/Videocard.cs b/src/Agent/Insight.Agent.Assets/Messages/Videocard/Videocard.cs
new file mode 100644
index 0000000..151d441
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/Videocard/Videocard.cs
@@ -0,0 +1,30 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(60, typeof(Videocard))]
+ [MemoryPackUnion(61, typeof(VideocardList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class Videocard : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? DeviceId { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? Model { get; set; }
+
+ [MemoryPackOrder(2)]
+ public ulong Memory { get; set; }
+
+ [MemoryPackOrder(3)]
+ public DateTime DriverDate { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? DriverVersion { get; set; }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class VideocardList : List, IAgentMessage { }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Messages/VirtualMaschine/VirtualMaschine.cs b/src/Agent/Insight.Agent.Assets/Messages/VirtualMaschine/VirtualMaschine.cs
new file mode 100644
index 0000000..a91dc44
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Messages/VirtualMaschine/VirtualMaschine.cs
@@ -0,0 +1,265 @@
+using MemoryPack;
+
+namespace Insight.Agent.Messages
+{
+ [MemoryPackUnion(170, typeof(VirtualMaschine))]
+ [MemoryPackUnion(171, typeof(VirtualMaschineList))]
+ public partial interface IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class VirtualMaschine : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public Guid? Id { get; set; }
+
+ [MemoryPackOrder(1)]
+ public uint? ProcessId { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Caption { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(4)]
+ public string? Notes { get; set; }
+
+ [MemoryPackOrder(5)]
+ public EnabledEnum? Enabled { get; set; }
+
+ [MemoryPackOrder(6)]
+ public EnabledDefaultEnum? EnabledDefault { get; set; }
+
+ [MemoryPackOrder(7)]
+ public HealthStatusEnum? HealthState { get; set; }
+
+ [MemoryPackOrder(8)]
+ public string? Status { get; set; }
+
+ [MemoryPackOrder(9)]
+ public ulong? OnTime { get; set; }
+
+ [MemoryPackOrder(10)]
+ public uint? ReplicationMode { get; set; }
+
+ [MemoryPackOrder(11)]
+ public ReplicationStateEnum? ReplicationState { get; set; }
+
+ [MemoryPackOrder(12)]
+ public ReplicationHealthEnum? ReplicationHealth { get; set; }
+
+ [MemoryPackOrder(13)]
+ public string? ConfigurationVersion { get; set; }
+
+ [MemoryPackOrder(14)]
+ public IntegrationServicesVersionStateEnum? IntegrationServicesVersionState { get; set; }
+
+ [MemoryPackOrder(15)]
+ public uint? NumberOfProcessors { get; set; }
+
+ [MemoryPackOrder(16)]
+ public uint? ProcessorLoad { get; set; }
+
+ [MemoryPackOrder(17)]
+ public int? MemoryAvailable { get; set; }
+
+ [MemoryPackOrder(18)]
+ public ulong? MemoryUsage { get; set; }
+
+ [MemoryPackOrder(19)]
+ public DateTime? InstallDate { get; set; }
+
+ [MemoryPackOrder(20)]
+ public DateTime? TimeOfLastConfigurationChange { get; set; }
+
+ [MemoryPackOrder(21)]
+ public DateTime? TimeOfLastStateChange { get; set; }
+
+ [MemoryPackOrder(22)]
+ public DateTime? LastReplicationTime { get; set; }
+
+ [MemoryPackOrder(23)]
+ public string? GuestOperatingSystem { get; set; }
+
+ [MemoryPackOrder(24)]
+ public List? Configurations { get; set; }
+
+ public enum EnabledEnum
+ {
+ Unbekannt = 0,
+ Andere = 1,
+ Aktiviert = 2,
+ Deaktiviert = 3,
+ Herunterfahren = 4,
+ Nicht_Verfügbar = 5,
+ Aktiviert_Offline = 6,
+ In_Test = 7,
+ Latent = 8,
+ Eingeschränkt = 9,
+ Wird_gestartet = 10
+ }
+
+ public enum EnabledDefaultEnum
+ {
+ Aktiviert = 2,
+ Deaktiviert = 3,
+ Aktiviert_Offline = 6
+ }
+
+ public enum HealthStatusEnum
+ {
+ OK = 5,
+ Hauptfehler = 20,
+ Kritischer_Fehler = 25
+ }
+
+ public enum ReplicationStateEnum
+ {
+ Deaktiviert = 0,
+ Bereit = 1,
+ Warten_auf_Erstreplikation = 2,
+ Replikat = 3,
+ Synchronisierte_Replication_abgeschlossen = 4,
+ Wiederhergestellt = 5,
+ Commit = 6,
+ Angehalten = 7,
+ Kritisch = 8,
+ Warten_auf_die_Neusynchronisierung = 9,
+ Resynchronisierung = 10,
+ Resynchronisierung_angehalten = 11,
+ Failover_in_Bearbeitung = 12,
+ Failback_in_Fortschritt = 13,
+ Failback_abgeschlossen = 14,
+ Datenträgerupdate_in_Bearbeitung = 15,
+ Datenträgeraktualisierung_kritisch = 16,
+ Unbekannt = 17,
+ Repurpose_Replikation_in_Bearbeitung = 18,
+ Vorbereitet_für_die_Synchronisierungsreplikation = 19,
+ Vorbereitet_für_die_Umgekehrte_Replikation_der_Gruppe = 20,
+ Failover_in_Fortschritt = 21
+ }
+
+ public enum ReplicationHealthEnum
+ {
+ OK = 1,
+ Warnung = 2,
+ Kritisch = 3
+ }
+
+ public enum IntegrationServicesVersionStateEnum
+ {
+ Unknown = 0,
+ UpToDate = 1,
+ Mismatch = 2
+ }
+ }
+
+ [MemoryPackable(GenerateType.Collection)]
+ public partial class VirtualMaschineList : List, IAgentMessage { }
+
+ [MemoryPackable]
+ public partial class VirtualMaschineConfiguration : IAgentMessage
+ {
+ [MemoryPackOrder(0)]
+ public string? Id { get; set; }
+
+ [MemoryPackOrder(1)]
+ public string? ParentId { get; set; }
+
+ [MemoryPackOrder(2)]
+ public string? Type { get; set; }
+
+ [MemoryPackOrder(3)]
+ public string? Name { get; set; }
+
+ [MemoryPackOrder(4)]
+ public DateTime? CreationTime { get; set; }
+
+ [MemoryPackOrder(5)]
+ public string? Generation { get; set; }
+
+ [MemoryPackOrder(6)]
+ public string? Architecture { get; set; }
+
+ [MemoryPackOrder(7)]
+ public AutomaticStartupActionEnum? AutomaticStartupAction { get; set; }
+ //public DateTime? AutomaticStartupActionDelay { get; set; }
+
+ [MemoryPackOrder(8)]
+ public AutomaticShutdownActionEnum? AutomaticShutdownAction { get; set; }
+
+ [MemoryPackOrder(9)]
+ public AutomaticRecoveryActionEnum? AutomaticRecoveryAction { get; set; }
+
+ [MemoryPackOrder(10)]
+ public bool? AutomaticSnapshotsEnabled { get; set; }
+
+ [MemoryPackOrder(11)]
+ public string? BaseBoardSerialNumber { get; set; }
+
+ [MemoryPackOrder(12)]
+ public string? BIOSGUID { get; set; }
+
+ [MemoryPackOrder(13)]
+ public string? BIOSSerialNumber { get; set; }
+
+ [MemoryPackOrder(14)]
+ public ushort[]? BootOrder { get; set; }
+
+ [MemoryPackOrder(15)]
+ public string? ConfigurationDataRoot { get; set; }
+
+ [MemoryPackOrder(16)]
+ public string? ConfigurationFile { get; set; }
+
+ [MemoryPackOrder(17)]
+ public string? GuestStateDataRoot { get; set; }
+
+ [MemoryPackOrder(18)]
+ public string? GuestStateFile { get; set; }
+
+ [MemoryPackOrder(19)]
+ public string? SnapshotDataRoot { get; set; }
+
+ [MemoryPackOrder(20)]
+ public string? SuspendDataRoot { get; set; }
+
+ [MemoryPackOrder(21)]
+ public string? SwapFileDataRoot { get; set; }
+
+ [MemoryPackOrder(22)]
+ public bool? SecureBootEnabled { get; set; }
+
+ [MemoryPackOrder(23)]
+ public bool? IsAutomaticSnapshot { get; set; }
+
+ [MemoryPackOrder(24)]
+ public string[]? Notes { get; set; }
+
+ [MemoryPackOrder(25)]
+ public List? Childs { get; set; }
+
+ //public string[]? HostResource { get; set; }
+
+ public enum AutomaticStartupActionEnum
+ {
+ Nothing = 2,
+ RestartIfLastStateActive = 3,
+ Alway = 4
+ }
+
+ public enum AutomaticShutdownActionEnum
+ {
+ Ausschalten = 2,
+ Speichern = 3,
+ Herunterfahren = 4
+ }
+
+ public enum AutomaticRecoveryActionEnum
+ {
+ Keine = 2,
+ Neustart = 3,
+ Rollback = 4
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent.Assets/Models/Config.cs b/src/Agent/Insight.Agent.Assets/Models/Config.cs
new file mode 100644
index 0000000..4be9391
--- /dev/null
+++ b/src/Agent/Insight.Agent.Assets/Models/Config.cs
@@ -0,0 +1,7 @@
+namespace Insight.Agent.Models
+{
+ public class Config
+ {
+ public Guid? Serial { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Assemblies/Interop.WUApiLib.dll b/src/Agent/Insight.Agent/Assemblies/Interop.WUApiLib.dll
new file mode 100644
index 0000000..990990c
Binary files /dev/null and b/src/Agent/Insight.Agent/Assemblies/Interop.WUApiLib.dll differ
diff --git a/src/Agent/Insight.Agent/Constants/Appsettings.cs b/src/Agent/Insight.Agent/Constants/Appsettings.cs
new file mode 100644
index 0000000..9a45fe7
--- /dev/null
+++ b/src/Agent/Insight.Agent/Constants/Appsettings.cs
@@ -0,0 +1,10 @@
+namespace Insight.Agent
+{
+ public static class Appsettings
+ {
+ public const string Api = "api";
+ public const string ServerHost = "server.host";
+ public const string ServerPort = "server.port";
+ public const string TrapPort = "trap.port";
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Constants/Deploy.cs b/src/Agent/Insight.Agent/Constants/Deploy.cs
new file mode 100644
index 0000000..35aa19b
--- /dev/null
+++ b/src/Agent/Insight.Agent/Constants/Deploy.cs
@@ -0,0 +1,21 @@
+namespace Insight.Agent.Constants
+{
+ public static class Deploy
+ {
+ public static class Updater
+ {
+ public const string Name = "Updater";
+ public const string ServiceName = "insight_updater";
+ public const string Description = "Insight Updater";
+ }
+
+ public static DirectoryInfo GetAppDirectory(string appName)
+ => new($"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}/Webmatic/Insight/{appName}");
+
+ public static FileInfo GetAppExecutable(string appName)
+ => new($"{GetAppDirectory(appName).FullName}/{appName.ToLower()}.exe");
+
+ public static Uri GetUpdateHref(Uri api, string appName)
+ => new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Extensions/Configuration.cs b/src/Agent/Insight.Agent/Extensions/Configuration.cs
new file mode 100644
index 0000000..c5df5da
--- /dev/null
+++ b/src/Agent/Insight.Agent/Extensions/Configuration.cs
@@ -0,0 +1,14 @@
+using Microsoft.Extensions.Configuration;
+
+namespace Insight.Agent.Extensions
+{
+ public static class ConfigurationExtensions
+ {
+ public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
+ {
+ configuration.Sources.Clear();
+ configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
+ return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Extensions/Linux.cs b/src/Agent/Insight.Agent/Extensions/Linux.cs
new file mode 100644
index 0000000..da4f85a
--- /dev/null
+++ b/src/Agent/Insight.Agent/Extensions/Linux.cs
@@ -0,0 +1,32 @@
+using System.Diagnostics;
+using System.Runtime.Versioning;
+
+namespace Insight.Agent.Extensions
+{
+ public static class Linux
+ {
+ [SupportedOSPlatform("linux")]
+ public static string Bash(this string cmd)
+ {
+ var escaped = cmd.Replace("\"", "\\\"");
+
+ using var proc = new Process()
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = "/bin/bash",
+ Arguments = $"-c \"{escaped}\"",
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ }
+ };
+
+ proc.Start();
+ var result = proc.StandardOutput.ReadToEnd();
+ proc.WaitForExit();
+
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Insight.Agent.csproj b/src/Agent/Insight.Agent/Insight.Agent.csproj
new file mode 100644
index 0000000..59ff570
--- /dev/null
+++ b/src/Agent/Insight.Agent/Insight.Agent.csproj
@@ -0,0 +1,53 @@
+
+
+
+ Exe
+ net7.0
+ Insight.Agent
+ Insight
+ agent
+ 2023.9.14.0
+ enable
+ enable
+
+
+
+ none
+
+
+
+ none
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Assemblies\Interop.WUApiLib.dll
+ True
+ False
+
+
+
+
+
+ Always
+
+
+ Always
+
+
+
+
diff --git a/src/Agent/Insight.Agent/Internals/Extensions.cs b/src/Agent/Insight.Agent/Internals/Extensions.cs
new file mode 100644
index 0000000..9699249
--- /dev/null
+++ b/src/Agent/Insight.Agent/Internals/Extensions.cs
@@ -0,0 +1,69 @@
+using System.Management;
+using System.Runtime.Versioning;
+
+namespace Insight.Agent
+{
+ public static class ManagmentExtensions
+ {
+ [SupportedOSPlatform("windows")]
+ public static HashSet GetPropertyHashes(this ManagementBaseObject @object)
+ {
+ var properties = new HashSet();
+
+ foreach (var property in @object.Properties)
+ {
+ properties.Add(property.Name);
+ }
+
+ return properties;
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static bool TryGet(this ManagementObjectSearcher searcher, out ManagementObjectCollection collection)
+ {
+ collection = searcher.Get();
+
+ try
+ {
+ _ = collection.Count;
+ return true;
+ }
+ catch (ManagementException)
+ {
+ collection.Dispose();
+ return false;
+ }
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static T? GetValue(this ManagementObject @object, HashSet properties, string key)
+ {
+ if (@object is null || properties is null || key is null) return default;
+ if (properties.Contains(key, StringComparer.OrdinalIgnoreCase) is false) return default;
+
+ if (@object[key] is not T obj)
+ {
+ return default;
+ }
+
+ return obj;
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static bool TryGetValue(this ManagementBaseObject @object, HashSet properties, string key, out T? value)
+ {
+ value = default;
+
+ if (@object is null || properties is null || key is null) return default;
+ if (properties.Contains(key, StringComparer.OrdinalIgnoreCase) is false) return false;
+
+ if (@object[key] is not T obj)
+ {
+ return false;
+ }
+
+ value = obj;
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Internals/Helpers.cs b/src/Agent/Insight.Agent/Internals/Helpers.cs
new file mode 100644
index 0000000..93d7e62
--- /dev/null
+++ b/src/Agent/Insight.Agent/Internals/Helpers.cs
@@ -0,0 +1,44 @@
+using System.Runtime.Versioning;
+using System.ServiceProcess;
+using System.Text;
+
+namespace Insight.Agent
+{
+ internal class Helpers
+ {
+ internal static string? EscapeWql(string text)
+ {
+ if (text == null) return null;
+
+ var sb = new StringBuilder(text.Length);
+ foreach (var c in text)
+ {
+ if (c == '\\' || c == '\'' || c == '"')
+ {
+ sb.Append('\\');
+ }
+ sb.Append(c);
+ }
+ return sb.ToString();
+ }
+
+ [SupportedOSPlatform("windows")]
+ internal static bool ForceWinRmStart()
+ {
+ var winRm = ServiceController
+ .GetServices()
+ .First(x => x.ServiceName
+ .ToLower()
+ .Equals("winrm", StringComparison.Ordinal));
+
+ if (winRm.Status is not ServiceControllerStatus.Running)
+ {
+ winRm.Start();
+ winRm.WaitForStatus(ServiceControllerStatus.Running);
+ }
+
+ if (winRm.Status != ServiceControllerStatus.Running) return false;
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Network/AgentSession.cs b/src/Agent/Insight.Agent/Network/AgentSession.cs
new file mode 100644
index 0000000..84678ea
--- /dev/null
+++ b/src/Agent/Insight.Agent/Network/AgentSession.cs
@@ -0,0 +1,57 @@
+using Insight.Agent.Interfaces;
+using Insight.Agent.Messages;
+using Microsoft.Extensions.Logging;
+using Vaitr.Network;
+
+namespace Insight.Agent.Network
+{
+ public class AgentSession : TcpSession
+ {
+ private readonly IEnumerable> _handlers;
+
+ public AgentSession(IEnumerable> handlers, ISerializer serializer, ILogger logger) : base(serializer, logger)
+ {
+ _handlers = handlers;
+ }
+
+ protected override ValueTask OnConnectedAsync(CancellationToken cancellationToken)
+ {
+ _logger.LogInformation("Agent ({ep?}) connected", RemoteEndPoint);
+ return default;
+ }
+
+ protected override ValueTask OnDisconnectedAsync(CancellationToken cancellationToken)
+ {
+ _logger.LogInformation("Agent ({ep?}) disconnected", RemoteEndPoint);
+ return default;
+ }
+
+ protected override ValueTask OnSentAsync(IPacketContext context, CancellationToken cancellationToken)
+ {
+ return base.OnSentAsync(context, cancellationToken);
+ }
+
+ protected override async ValueTask OnReceivedAsync(IPacketContext context, CancellationToken cancellationToken)
+ {
+ await base.OnReceivedAsync(context, cancellationToken);
+
+ foreach (var handler in _handlers)
+ {
+ try
+ {
+ await handler.HandleAsync(this, context.Packet, cancellationToken);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogWarning("Agent ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
+ }
+ }
+ }
+
+ protected override ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
+ {
+ _logger.LogInformation("Agent ({ep?}) Heartbeat", RemoteEndPoint);
+ return default;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Network/Handlers/AuthenticationHandler.cs b/src/Agent/Insight.Agent/Network/Handlers/AuthenticationHandler.cs
new file mode 100644
index 0000000..4247693
--- /dev/null
+++ b/src/Agent/Insight.Agent/Network/Handlers/AuthenticationHandler.cs
@@ -0,0 +1,38 @@
+using Insight.Agent.Interfaces;
+using Insight.Agent.Messages;
+using Insight.Agent.Models;
+using Insight.Agent.Services;
+using Insight.Domain.Constants;
+
+namespace Insight.Agent.Network.Handlers
+{
+ public class AuthenticationHandler : IAgentMessageHandler
+ {
+ public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
+ {
+ if (message is AuthenticationRequest)
+ {
+ Config? config = null;
+
+ try
+ {
+ config = await Configurator.ReadAsync(Configuration.DefaultConfig, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception) { }
+
+ if (config is null)
+ {
+ config = new Config { Serial = Guid.NewGuid() };
+ await Configurator.WriteAsync(config, Configuration.DefaultConfig, cancellationToken).ConfigureAwait(false);
+ }
+
+ await sender.SendAsync(new Authentication
+ {
+ Serial = config.Serial ?? throw new InvalidDataException(nameof(config.Serial)),
+ Version = Configuration.Version,
+ Hostname = Configuration.Hostname
+ }, cancellationToken);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Network/Handlers/ConsoleHandler.cs b/src/Agent/Insight.Agent/Network/Handlers/ConsoleHandler.cs
new file mode 100644
index 0000000..267bb5d
--- /dev/null
+++ b/src/Agent/Insight.Agent/Network/Handlers/ConsoleHandler.cs
@@ -0,0 +1,111 @@
+using Insight.Agent.Interfaces;
+using Insight.Agent.Messages;
+using System.Management.Automation;
+using System.Management.Automation.Runspaces;
+
+namespace Insight.Agent.Network.Handlers;
+
+public class ConsoleHandler : IAgentMessageHandler
+{
+ public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
+ {
+ if (message is ConsoleQueryRequest consoleQueryRequest)
+ {
+ await OnConsoleQueryRequestAsync(sender, consoleQueryRequest, cancellationToken);
+ }
+ }
+
+ private async ValueTask OnConsoleQueryRequestAsync(AgentSession sender, ConsoleQueryRequest consoleQueryRequest, CancellationToken cancellationToken)
+ {
+ var result = await QueryScriptAsync(consoleQueryRequest.Query);
+
+ await sender.SendAsync(new ConsoleQuery
+ {
+ Id = consoleQueryRequest.Id,
+ HostId = consoleQueryRequest.HostId,
+ Query = consoleQueryRequest.Query,
+ Data = result.Data,
+ Errors = result.Errors,
+ HadErrors = result.HadErrors
+ }, cancellationToken);
+ }
+
+ private static async Task QueryScriptAsync(string query)
+ {
+ var result = new QueryResult();
+ var errors = new List();
+
+ try
+ {
+ using var runspace = RunspaceFactory.CreateRunspace();
+ runspace.Open();
+ runspace.SessionStateProxy.LanguageMode = PSLanguageMode.FullLanguage;
+
+ using var ps = PowerShell.Create(runspace);
+ ps.AddScript("Set-ExecutionPolicy unrestricted -Scope Process");
+ ps.AddScript(query);
+ ps.AddCommand("ConvertTo-Json"); // -Depth 10
+
+ result.Query = query;
+
+ var queryResult = await ps.InvokeAsync();
+
+ if (ps.HadErrors)
+ {
+ result.HadErrors = true;
+ errors.AddRange(ps.Streams.Error.Select(e => e.ToString()));
+ }
+ else
+ {
+ result.Data = queryResult[0].ToString();
+
+ //if (string.IsNullOrWhiteSpace(jsonString)) return result;
+
+ //if (jsonString.TrimStart().StartsWith("[")) // It's an array
+ //{
+ // result.IsArray = true;
+
+ // var deserialized = JsonSerializer.Deserialize>>(jsonString, new JsonSerializerOptions { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping });
+ // if (deserialized is null) return result;
+
+ // result.Data.AddRange(deserialized);
+
+ // //Console.WriteLine("Deserialized to List>");
+ //}
+ //else
+ //{
+ // if (jsonString.TrimStart().StartsWith("{") is false) // It's an object
+ // {
+ // result.IsString = true;
+ // result.Data.Add(new Dictionary { { query, jsonString.Trim('"') } });
+ // }
+ // else
+ // {
+ // var deserialized = JsonSerializer.Deserialize>(jsonString, new JsonSerializerOptions { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping });
+ // if (deserialized is null) return result;
+
+ // result.Data.Add(deserialized);
+
+ // //Console.WriteLine("Deserialized to Dictionary");
+ // }
+ //}
+ }
+ }
+ catch (Exception ex)
+ {
+ result.HadErrors = true;
+ errors.Add(ex.Message);
+ }
+
+ result.Errors = string.Join("\n", errors);
+ return result;
+ }
+}
+
+public class QueryResult
+{
+ public bool HadErrors { get; set; }
+ public string? Query { get; set; }
+ public string? Data { get; set; }
+ public string? Errors { get; set; }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Network/Handlers/DriveHandler.cs b/src/Agent/Insight.Agent/Network/Handlers/DriveHandler.cs
new file mode 100644
index 0000000..13fafe8
--- /dev/null
+++ b/src/Agent/Insight.Agent/Network/Handlers/DriveHandler.cs
@@ -0,0 +1,178 @@
+using Insight.Agent.Interfaces;
+using Insight.Agent.Messages;
+using System.Management;
+using System.Runtime.Versioning;
+
+namespace Insight.Agent.Network.Handlers
+{
+ [SupportedOSPlatform("windows")]
+ public class DriveHandler : IAgentMessageHandler
+ {
+ public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
+ {
+ if (message is GetInventory)
+ {
+ var result = new DriveList();
+ result.AddRange(GetDrives());
+
+ await sender.SendAsync(result, cancellationToken);
+ }
+ }
+
+ private static List GetDrives()
+ {
+ using var searcher = new ManagementObjectSearcher
+ {
+ Scope = new ManagementScope(@"root\cimv2"),
+ Query = new ObjectQuery("select index, name, caption, model, manufacturer, serialNumber, size, status, interfacetype, firmwarerevision, deviceid, pnpdeviceid from win32_diskdrive")
+ };
+
+ if (searcher.TryGet(out var collection) is false)
+ {
+ searcher.Query = new ObjectQuery("select * from win32_diskdrive");
+
+ if (searcher.TryGet(out collection) is false) throw new InvalidOperationException("WMI Collection NULL");
+ }
+
+ var drives = new List();
+
+ using (collection)
+ {
+ foreach (ManagementObject @object in collection.Cast())
+ {
+ var drive = new Drive();
+
+ var properties = @object.GetPropertyHashes();
+
+ drive.Index = @object.GetValue(properties, "index");
+ drive.Id = @object.GetValue(properties, "deviceid")?.Trim();
+ drive.Name = @object.GetValue(properties, "model")?.Trim();
+ drive.Manufacturer = @object.GetValue(properties, "manufacturer")?.Trim();
+ drive.SerialNumber = @object.GetValue(properties, "serialnumber")?.Trim();
+ drive.Size = @object.GetValue(properties, "size");
+ drive.Status = @object.GetValue(properties, "status")?.Trim();
+ drive.InterfaceType = @object.GetValue(properties, "interfacetype")?.Trim();
+ drive.FirmwareRevision = @object.GetValue(properties, "firmwarerevision")?.Trim();
+ drive.PNPDeviceID = @object.GetValue(properties, "pnpdeviceid")?.Trim();
+ drive.Volumes = new List();
+
+ var diskpartition = @object.GetRelated("win32_diskpartition");
+ using (diskpartition)
+ {
+ foreach (ManagementObject dp in diskpartition.Cast())
+ {
+ var volume = new Volume();
+ var dpProperties = dp.GetPropertyHashes();
+
+ volume.NumberOfBlocks = dp.GetValue(dpProperties, "numberofblocks");
+ volume.BootPartition = dp.GetValue(dpProperties, "bootpartition");
+ volume.PrimaryPartition = dp.GetValue(dpProperties, "primarypartition");
+ volume.Size = dp.GetValue(dpProperties, "size");
+ volume.Index = dp.GetValue(dpProperties, "index");
+ volume.Type = dp.GetValue(dpProperties, "type")?.Trim();
+ volume.Bootable = dp.GetValue(dpProperties, "bootable");
+ volume.BlockSize = dp.GetValue(dpProperties, "blocksize");
+ volume.StartingOffset = dp.GetValue(dpProperties, "startingoffset");
+
+ var logicaldisk = dp.GetRelated("win32_logicaldisk");
+ using (logicaldisk)
+ {
+ foreach (ManagementObject ld in logicaldisk.Cast())
+ {
+ var ldProperties = ld.GetPropertyHashes();
+
+ volume.Id = ld.GetValue(ldProperties, "deviceid")?.Trim();
+ volume.Name = ld.GetValue(ldProperties, "volumename")?.Trim();
+ volume.SerialNumber = ld.GetValue(ldProperties, "volumeserialnumber")?.Trim();
+ volume.DriveType = (DriveType)ld.GetValue(ldProperties, "drivetype");
+ volume.FileSystem = ld.GetValue(ldProperties, "filesystem")?.Trim();
+ volume.Compressed = ld.GetValue(ldProperties, "compressed");
+ volume.Size = ld.GetValue(ldProperties, "size");
+ volume.FreeSpace = ld.GetValue(ldProperties, "freespace");
+ volume.ProviderName = ld.GetValue(ldProperties, "providername")?.Trim();
+ }
+ }
+
+ drive.Volumes.Add(volume);
+ }
+ }
+
+ drives.Add(drive);
+ }
+ }
+
+ return drives;
+ }
+
+ private static List GetVolumes()
+ {
+ using var searcher = new ManagementObjectSearcher
+ {
+ Scope = new ManagementScope(@"root\cimv2"),
+ Query = new ObjectQuery("select deviceid, volumename, volumeserialnumber, drivetype, filesystem, compressed, size, freeSpace, providername from win32_logicaldisk")
+ };
+
+ // per device query
+ // "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" + driveDeviceId + "'} WHERE AssocClass=Win32_DiskDriveToDiskPartition"
+
+ if (searcher.TryGet(out var collection) is false)
+ {
+ searcher.Query = new ObjectQuery("select * from win32_logicaldisk");
+
+ if (searcher.TryGet(out collection) is false) throw new InvalidOperationException("WMI Collection NULL");
+ }
+
+ var volumes = new List();
+
+ using (collection)
+ {
+ foreach (ManagementObject @object in collection.Cast())
+ {
+ var volume = new Volume();
+
+ var properties = @object.GetPropertyHashes();
+
+ //volume.DeviceId = @object.GetValue(properties, "deviceid")?.Trim();
+ //volume.VolumeName = @object.GetValue(properties, "volumename")?.Trim();
+ //volume.VolumeSerialNumber = @object.GetValue(properties, "volumeserialnumber")?.Trim();
+ volume.DriveType = (DriveType)@object.GetValue(properties, "drivetype");
+ volume.FileSystem = @object.GetValue(properties, "filesystem")?.Trim();
+ volume.Compressed = @object.GetValue(properties, "compressed");
+ volume.Size = @object.GetValue(properties, "size");
+ volume.FreeSpace = @object.GetValue(properties, "freespace");
+ volume.ProviderName = @object.GetValue(properties, "providername")?.Trim();
+
+ if (volume.Id is not null)
+ {
+ searcher.Query = new ObjectQuery("associators of {win32_logicaldisk.deviceid='" + volume.Id + "'} where assocclass=win32_logicaldisktopartition");
+
+ if (searcher.TryGet(out var collection2))
+ {
+ using (collection2)
+ {
+ foreach (ManagementObject @object2 in collection2)
+ {
+ var properties2 = @object2.GetPropertyHashes();
+
+ volume.Index = @object2.GetValue(properties2, "index");
+ //volume.DiskIndex = @object2.GetValue(properties2, "diskindex");
+ volume.Type = @object2.GetValue(properties2, "type")?.Trim();
+ volume.Bootable = @object2.GetValue(properties2, "bootable");
+ volume.PrimaryPartition = @object2.GetValue(properties2, "primarypartition");
+ volume.BootPartition = @object2.GetValue(properties2, "bootpartition");
+ volume.BlockSize = @object2.GetValue(properties2, "blocksize");
+ volume.NumberOfBlocks = @object2.GetValue(properties2, "numberofblocks");
+ volume.StartingOffset = @object2.GetValue(properties2, "startingoffset");
+ }
+ }
+ }
+ }
+
+ volumes.Add(volume);
+ }
+ }
+
+ return volumes;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Network/Handlers/InterfaceHandler.cs b/src/Agent/Insight.Agent/Network/Handlers/InterfaceHandler.cs
new file mode 100644
index 0000000..2d6e294
--- /dev/null
+++ b/src/Agent/Insight.Agent/Network/Handlers/InterfaceHandler.cs
@@ -0,0 +1,274 @@
+using Insight.Agent.Interfaces;
+using Insight.Agent.Messages;
+using System.Management;
+using System.Net;
+using System.Net.NetworkInformation;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+using Route = Insight.Agent.Messages.Route;
+
+namespace Insight.Agent.Network.Handlers
+{
+ [SupportedOSPlatform("windows")]
+ public class InterfaceHandler : IAgentMessageHandler
+ {
+ public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
+ {
+ if (message is GetInventory)
+ {
+ var result = new InterfaceList();
+ result.AddRange(GetInterfaces());
+
+ await sender.SendAsync(result, cancellationToken);
+ }
+ }
+
+ private static List GetInterfaces()
+ {
+ if (NetworkInterface.GetIsNetworkAvailable() is false) return null;
+ if (NetworkInterface.GetAllNetworkInterfaces().Any() is false) return null;
+
+ var interfaces = new List();
+
+ foreach (var ni in NetworkInterface.GetAllNetworkInterfaces())
+ {
+ var ipProperties = ni.GetIPProperties();
+ var ipStatistics = ni.GetIPStatistics();
+
+ var @interface = new Interface
+ {
+ Mac = ni.GetPhysicalAddress().ToString(),
+ Name = ni.Name,
+ Description = ni.Description,
+ Type = ni.NetworkInterfaceType,
+ Speed = ni.Speed,
+ Status = ni.OperationalStatus,
+ Suffix = ipProperties.DnsSuffix,
+ Sent = ipStatistics.BytesSent,
+ Received = ipStatistics.BytesReceived,
+ IncomingPacketsDiscarded = ipStatistics.IncomingPacketsDiscarded,
+ IncomingPacketsWithErrors = ipStatistics.IncomingPacketsWithErrors,
+ IncomingUnknownProtocolPackets = ipStatistics.IncomingUnknownProtocolPackets,
+ OutgoingPacketsDiscarded = ipStatistics.OutgoingPacketsDiscarded,
+ OutgoingPacketsWithErrors = ipStatistics.OutgoingPacketsWithErrors
+ };
+
+ try
+ {
+ var propertiesV4 = ipProperties.GetIPv4Properties();
+ @interface.Index = uint.Parse(propertiesV4.Index.ToString());
+ @interface.Ipv4Mtu = propertiesV4.Mtu;
+ @interface.Ipv4Dhcp = propertiesV4.IsDhcpEnabled;
+ @interface.Ipv4Forwarding = propertiesV4.IsForwardingEnabled;
+ }
+ catch (Exception) { }
+
+ try
+ {
+ var propertiesV6 = ipProperties.GetIPv6Properties();
+ @interface.Index = uint.Parse(propertiesV6.Index.ToString());
+ @interface.Ipv6Mtu = propertiesV6.Mtu;
+ }
+ catch (Exception) { }
+
+ @interface.Gateways = GetAddresses(ipProperties.GatewayAddresses);
+ @interface.Addresses = GetAddresses(ipProperties.UnicastAddresses);
+ @interface.Dns = GetAddresses(ipProperties.DnsAddresses);
+ @interface.Dhcp = GetAddresses(ipProperties.DhcpServerAddresses);
+
+ if (@interface.Index.HasValue)
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ using var searcher = new ManagementObjectSearcher
+ {
+ Scope = new ManagementScope(@"root\cimv2"),
+ Query = new ObjectQuery($"select interfaceindex, guid, physicaladapter, manufacturer from win32_networkadapter where interfaceindex = {@interface.Index}")
+ };
+
+ if (searcher.TryGet(out var collection) is false)
+ {
+ searcher.Query = new ObjectQuery($"select * from win32_networkadapter where interfaceindex = {@interface.Index}");
+
+ if (searcher.TryGet(out collection) is false) throw new InvalidOperationException("WMI Collection NULL");
+ }
+
+ using (collection)
+ {
+ foreach (ManagementObject @object in collection)
+ {
+ var properties = @object.GetPropertyHashes();
+
+ @interface.Manufacturer = @object.GetValue(properties, "manufacturer")?.Trim();
+ @interface.Guid = @object.GetValue(properties, "guid");
+ @interface.Physical = @object.GetValue(properties, "physicaladapter");
+
+ break;
+ }
+ }
+
+ @interface.Routes = QueryInterfaceRoutes(@interface.Index.Value);
+ }
+ }
+
+ interfaces.Add(@interface);
+ }
+
+ return interfaces;
+ }
+
+ private static List QueryInterfaceRoutes(uint interfaceIndex)
+ {
+ using var searcher = new ManagementObjectSearcher
+ {
+ Scope = new ManagementScope(@"root\standardcimv2"),
+ Query = new ObjectQuery($"select addressFamily, state, interfaceindex, routemetric, nexthop, destinationprefix from msft_netroute where interfaceindex = {interfaceIndex}")
+ };
+
+ if (searcher.TryGet(out var collection) is false)
+ {
+ searcher.Query = new ObjectQuery($"select * from msft_netroute where interfaceindex = {interfaceIndex}");
+
+ if (searcher.TryGet(out collection) is false) throw new InvalidOperationException("WMI Collection NULL");
+ }
+
+ var routes = new List();
+
+ using (collection)
+ {
+ foreach (var @object in collection)
+ {
+ var route = new Route
+ {
+ InterfaceIndex = interfaceIndex
+ };
+
+ var properties = @object.GetPropertyHashes();
+
+ if (@object.TryGetValue