diff --git a/dotnetcore.csproj b/dotnetcore.csproj
deleted file mode 100644
index 120e38c..0000000
--- a/dotnetcore.csproj
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- Exe
- net7.0
-
-
-
diff --git a/insight.sln b/insight.sln
index c6e0266..85085b4 100644
--- a/insight.sln
+++ b/insight.sln
@@ -27,15 +27,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Api", "Api", "{35BA5DCB-BEC
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}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Remote", "Remote", "{D4D7BF4A-B2E3-470A-A14C-FC658FF7461D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Remote.Shared", "src\Remote\Insight.Remote.Shared\Insight.Remote.Shared.csproj", "{5C4697BD-BC97-484F-9DB1-CA87E2BEAA4B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Remote.Windows", "src\Remote\Insight.Remote.Windows\Insight.Remote.Windows.csproj", "{AF313B47-3079-407F-91D1-9989C1E1AF2A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Infrastructure.Web", "src\Core\Insight.Infrastructure.Web\Insight.Infrastructure.Web.csproj", "{39B81A0D-A88C-44D3-9624-1A19C78A4310}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Server", "src\Server\Insight.Server\Insight.Server.csproj", "{FCAE9C42-1DCE-4C2E-BAE0-251C147903B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -63,26 +67,30 @@ Global
{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
+ {5C4697BD-BC97-484F-9DB1-CA87E2BEAA4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5C4697BD-BC97-484F-9DB1-CA87E2BEAA4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5C4697BD-BC97-484F-9DB1-CA87E2BEAA4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5C4697BD-BC97-484F-9DB1-CA87E2BEAA4B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AF313B47-3079-407F-91D1-9989C1E1AF2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AF313B47-3079-407F-91D1-9989C1E1AF2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AF313B47-3079-407F-91D1-9989C1E1AF2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AF313B47-3079-407F-91D1-9989C1E1AF2A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {39B81A0D-A88C-44D3-9624-1A19C78A4310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {39B81A0D-A88C-44D3-9624-1A19C78A4310}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {39B81A0D-A88C-44D3-9624-1A19C78A4310}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {39B81A0D-A88C-44D3-9624-1A19C78A4310}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FCAE9C42-1DCE-4C2E-BAE0-251C147903B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FCAE9C42-1DCE-4C2E-BAE0-251C147903B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FCAE9C42-1DCE-4C2E-BAE0-251C147903B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FCAE9C42-1DCE-4C2E-BAE0-251C147903B4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -93,11 +101,12 @@ Global
{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}
+ {5C4697BD-BC97-484F-9DB1-CA87E2BEAA4B} = {D4D7BF4A-B2E3-470A-A14C-FC658FF7461D}
+ {AF313B47-3079-407F-91D1-9989C1E1AF2A} = {D4D7BF4A-B2E3-470A-A14C-FC658FF7461D}
+ {39B81A0D-A88C-44D3-9624-1A19C78A4310} = {88B03853-2215-4E52-8986-0E76602E5F21}
+ {FCAE9C42-1DCE-4C2E-BAE0-251C147903B4} = {038C3821-E554-496D-B585-A3BC193B7913}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F376A326-7590-4E7E-AB9B-76CED8527AB0}
diff --git a/src/Agent/Insight.Agent.Assets/Enums/CategoryEnum.cs b/src/Agent/Insight.Agent.Assets/Enums/CategoryEnum.cs
deleted file mode 100644
index 5ba8cb9..0000000
--- a/src/Agent/Insight.Agent.Assets/Enums/CategoryEnum.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index 2d824d4..0000000
--- a/src/Agent/Insight.Agent.Assets/Enums/DispatchEnum.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-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
deleted file mode 100644
index 49b8e7d..0000000
--- a/src/Agent/Insight.Agent.Assets/Enums/StatusEnum.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-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
deleted file mode 100644
index 540ca66..0000000
--- a/src/Agent/Insight.Agent.Assets/Insight.Agent.Assets.csproj
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
- 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
deleted file mode 100644
index a9e69a6..0000000
--- a/src/Agent/Insight.Agent.Assets/Interfaces/IAgentMessageHandler.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-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
deleted file mode 100644
index ba3ad5c..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Application/Application.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-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
deleted file mode 100644
index 84406f4..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Authentication/Authentication.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-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
deleted file mode 100644
index b231232..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Commands/Commands.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index 369304c..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Console/ConsoleQuery.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-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
deleted file mode 100644
index 5a2f966..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Drive/Drive.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-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
deleted file mode 100644
index edd3b61..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Event/Event.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-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
deleted file mode 100644
index 3c3edf0..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/IAgentMessage.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-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
deleted file mode 100644
index 1c008c5..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Interface/Interface.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-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
deleted file mode 100644
index 63588dc..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Keepalive/Keepalive.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index a86bc5b..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Mainboard/Mainboard.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index bb8e444..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Memory/Memory.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-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
deleted file mode 100644
index 0fe4ee5..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/OperationSystem/OperationSystem.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index 0478fc0..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Printer/Printer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index edd63af..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Processor/Processor.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-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
deleted file mode 100644
index 61aa86d..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Service/Service.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-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
deleted file mode 100644
index 625c4ef..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Session/Session.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index de31591..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Status/Status.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index 6148979..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/StoragePool/StoragePool.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-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
deleted file mode 100644
index 8ec0441..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/SystemInfo/SystemInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-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
deleted file mode 100644
index d0a66db..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Trap/Trap.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index ecc84c1..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Update/Update.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-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
deleted file mode 100644
index 968c4bb..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/User/User.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-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
deleted file mode 100644
index 151d441..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/Videocard/Videocard.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index a91dc44..0000000
--- a/src/Agent/Insight.Agent.Assets/Messages/VirtualMaschine/VirtualMaschine.cs
+++ /dev/null
@@ -1,265 +0,0 @@
-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
deleted file mode 100644
index 4be9391..0000000
--- a/src/Agent/Insight.Agent.Assets/Models/Config.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-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/Constants/Appsettings.cs b/src/Agent/Insight.Agent/Constants/Appsettings.cs
index 9a45fe7..074d6b8 100644
--- a/src/Agent/Insight.Agent/Constants/Appsettings.cs
+++ b/src/Agent/Insight.Agent/Constants/Appsettings.cs
@@ -1,10 +1,9 @@
-namespace Insight.Agent
+namespace Insight.Agent;
+
+public static class Appsettings
{
- 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";
- }
+ 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
index 35aa19b..ded093c 100644
--- a/src/Agent/Insight.Agent/Constants/Deploy.cs
+++ b/src/Agent/Insight.Agent/Constants/Deploy.cs
@@ -1,21 +1,20 @@
-namespace Insight.Agent.Constants
+namespace Insight.Agent.Constants;
+
+public static class Deploy
{
- public static class Deploy
+ public static class Updater
{
- 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");
+ 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
deleted file mode 100644
index c5df5da..0000000
--- a/src/Agent/Insight.Agent/Extensions/Configuration.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index da4f85a..0000000
--- a/src/Agent/Insight.Agent/Extensions/Linux.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-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/Extensions/ServiceExtensions.cs b/src/Agent/Insight.Agent/Extensions/ServiceExtensions.cs
new file mode 100644
index 0000000..a6d644e
--- /dev/null
+++ b/src/Agent/Insight.Agent/Extensions/ServiceExtensions.cs
@@ -0,0 +1,33 @@
+using Insight.Agent.Network;
+using Insight.Agent.Network.Handlers;
+using Insight.Domain.Interfaces;
+using Microsoft.Extensions.DependencyInjection;
+using System.Runtime.Versioning;
+
+namespace Insight.Agent.Extensions;
+
+internal static class ServiceExtensions
+{
+ [SupportedOSPlatform("windows")]
+ internal static IServiceCollection InjectWindowsHandler(this IServiceCollection services)
+ {
+ services.AddSingleton, DriveHandler>();
+ services.AddSingleton, InterfaceHandler>();
+ services.AddSingleton, MainboardHandler>();
+ services.AddSingleton, MemoryHandler>();
+ services.AddSingleton, OperationSystemHandler>();
+ services.AddSingleton, PrinterHandler>();
+ services.AddSingleton, ProcessorHandler>();
+ services.AddSingleton, ServiceHandler>();
+ services.AddSingleton, SessionHandler>();
+ services.AddSingleton, SoftwareHandler>();
+ services.AddSingleton, StoragePoolHandler>();
+ services.AddSingleton, SystemInfoHandler>();
+ services.AddSingleton, UpdateHandler>();
+ services.AddSingleton, UserHandler>();
+ services.AddSingleton, VideocardHandler>();
+ services.AddSingleton, VirtualMaschineHandler>();
+
+ return services;
+ }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Insight.Agent.csproj b/src/Agent/Insight.Agent/Insight.Agent.csproj
index 59ff570..becf45f 100644
--- a/src/Agent/Insight.Agent/Insight.Agent.csproj
+++ b/src/Agent/Insight.Agent/Insight.Agent.csproj
@@ -2,17 +2,20 @@
Exe
- net7.0
+ net8.0
+ latest
Insight.Agent
Insight
agent
- 2023.9.14.0
+ 2023.12.14.0
enable
enable
+ none
+ true
- none
+ none
@@ -20,17 +23,17 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
+
diff --git a/src/Agent/Insight.Agent/Internal/Config.cs b/src/Agent/Insight.Agent/Internal/Config.cs
new file mode 100644
index 0000000..f79bdff
--- /dev/null
+++ b/src/Agent/Insight.Agent/Internal/Config.cs
@@ -0,0 +1,6 @@
+namespace Insight.Agent;
+
+internal sealed class Config
+{
+ public Guid? Serial { get; set; }
+}
\ No newline at end of file
diff --git a/src/Agent/Insight.Agent/Internal/Extensions.cs b/src/Agent/Insight.Agent/Internal/Extensions.cs
new file mode 100644
index 0000000..a9380f8
--- /dev/null
+++ b/src/Agent/Insight.Agent/Internal/Extensions.cs
@@ -0,0 +1,68 @@
+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/Internal/Helpers.cs b/src/Agent/Insight.Agent/Internal/Helpers.cs
new file mode 100644
index 0000000..e0a0a23
--- /dev/null
+++ b/src/Agent/Insight.Agent/Internal/Helpers.cs
@@ -0,0 +1,43 @@
+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/Internals/Extensions.cs b/src/Agent/Insight.Agent/Internals/Extensions.cs
deleted file mode 100644
index 9699249..0000000
--- a/src/Agent/Insight.Agent/Internals/Extensions.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-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
deleted file mode 100644
index 93d7e62..0000000
--- a/src/Agent/Insight.Agent/Internals/Helpers.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-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
index 84678ea..7e6ed26 100644
--- a/src/Agent/Insight.Agent/Network/AgentSession.cs
+++ b/src/Agent/Insight.Agent/Network/AgentSession.cs
@@ -1,57 +1,87 @@
-using Insight.Agent.Interfaces;
-using Insight.Agent.Messages;
+using Insight.Agent.Services;
+using Insight.Domain.Constants;
+using Insight.Domain.Interfaces;
+using Insight.Domain.Network;
+using Insight.Domain.Network.Agent.Messages;
using Microsoft.Extensions.Logging;
using Vaitr.Network;
-namespace Insight.Agent.Network
+namespace Insight.Agent.Network;
+
+public class AgentSession(IEnumerable> handlers, ISerializer serializer, ILogger logger)
+ : TcpSession(serializer, logger)
{
- public class AgentSession : TcpSession
+ private readonly IEnumerable> _handlers = handlers;
+
+ protected override ValueTask OnConnectedAsync(CancellationToken cancellationToken)
{
- private readonly IEnumerable> _handlers;
+ _logger.LogInformation("Agent ({ep?}) connected", RemoteEndPoint);
+ return default;
+ }
- public AgentSession(IEnumerable> handlers, ISerializer serializer, ILogger logger) : base(serializer, logger)
+ 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);
+
+ // catch authentication request
+ if (context.Packet is AuthenticationRequest)
+ await OnAuthenticationAsync(cancellationToken);
+
+ // pass message to handlers
+ foreach (var handler in _handlers)
{
- _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
{
- try
- {
- await handler.HandleAsync(this, context.Packet, cancellationToken);
- }
- catch (Exception ex)
- {
- _logger.LogWarning("Agent ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
- }
+ await handler.HandleAsync(this, context.Packet, cancellationToken);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogWarning("Agent ({ep?}) {ex}", RemoteEndPoint, ex.ToString());
}
}
+ }
- protected override ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
+ protected override ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
+ {
+ _logger.LogInformation("Agent ({ep?}) Heartbeat", RemoteEndPoint);
+ return default;
+ }
+
+ private async ValueTask OnAuthenticationAsync(CancellationToken cancellationToken)
+ {
+ Config? config = null;
+
+ try
{
- _logger.LogInformation("Agent ({ep?}) Heartbeat", RemoteEndPoint);
- return default;
+ config = await Configurator.ReadAsync(Configuration.DefaultConfig, cancellationToken).ConfigureAwait(false);
}
+ catch (Exception ex)
+ {
+ _logger.LogError("Config ({config}) read error ({exception})", Configuration.DefaultConfig, ex);
+ }
+
+ if (config is null)
+ {
+ config = new Config { Serial = Guid.NewGuid() };
+ await Configurator.WriteAsync(config, Configuration.DefaultConfig, cancellationToken).ConfigureAwait(false);
+ }
+
+ await SendAsync(new AuthenticationResponse
+ {
+ Serial = config.Serial ?? throw new InvalidDataException(nameof(config.Serial)),
+ Version = Configuration.Version,
+ Hostname = Configuration.Hostname
+ }, cancellationToken).ConfigureAwait(false);
}
}
\ 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
deleted file mode 100644
index 4247693..0000000
--- a/src/Agent/Insight.Agent/Network/Handlers/AuthenticationHandler.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-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/CustomHandler.cs b/src/Agent/Insight.Agent/Network/Handlers/CustomHandler.cs
new file mode 100644
index 0000000..46e6a1a
--- /dev/null
+++ b/src/Agent/Insight.Agent/Network/Handlers/CustomHandler.cs
@@ -0,0 +1,33 @@
+using Insight.Agent.Services;
+using Insight.Domain.Interfaces;
+using Insight.Domain.Network;
+using Insight.Domain.Network.Agent.Messages;
+
+namespace Insight.Agent.Network.Handlers;
+
+public class CustomHandler(ScriptService scriptService) : IMessageHandler
+{
+ private readonly ScriptService _scriptService = scriptService;
+
+ public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
+ {
+ switch (message)
+ {
+ case Request request:
+ await OnRequestAsync(sender, request, cancellationToken);
+ break;
+ }
+ }
+
+ private async ValueTask OnRequestAsync(AgentSession sender, Request request, CancellationToken cancellationToken)
+ {
+ if (request.RequestData is null) return;
+ var result = await _scriptService.QueryAsync(request.RequestData);
+
+ await sender.SendAsync(new Response(request)
+ {
+ ResponseData = result.HadErrors ? result.Errors : result.Data,
+ ResponseError = result.HadErrors
+ }, cancellationToken);
+ }
+}
\ 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
index 13fafe8..75b7670 100644
--- a/src/Agent/Insight.Agent/Network/Handlers/DriveHandler.cs
+++ b/src/Agent/Insight.Agent/Network/Handlers/DriveHandler.cs
@@ -1,178 +1,182 @@
-using Insight.Agent.Interfaces;
-using Insight.Agent.Messages;
+using Insight.Domain.Interfaces;
+using Insight.Domain.Network;
+using Insight.Domain.Network.Agent.Messages;
using System.Management;
using System.Runtime.Versioning;
-namespace Insight.Agent.Network.Handlers
+namespace Insight.Agent.Network.Handlers;
+
+[SupportedOSPlatform("windows")]
+public class DriveHandler : IMessageHandler
{
- [SupportedOSPlatform("windows")]
- public class DriveHandler : IAgentMessageHandler
+ public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
{
- public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
+ switch (message)
{
- 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())
+ case InventoryRequest:
{
- var drive = new Drive();
+ var result = new Collection();
+ result.AddRange(GetDrives());
- 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);
+ await sender.SendAsync(result, cancellationToken);
+ break;
}
- }
-
- 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;
}
}
+
+ 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 = [];
+
+ 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.Cast())
+ {
+ 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
index 2d6e294..92402ca 100644
--- a/src/Agent/Insight.Agent/Network/Handlers/InterfaceHandler.cs
+++ b/src/Agent/Insight.Agent/Network/Handlers/InterfaceHandler.cs
@@ -1,274 +1,277 @@
-using Insight.Agent.Interfaces;
-using Insight.Agent.Messages;
+using Insight.Domain.Interfaces;
+using Insight.Domain.Network;
+using Insight.Domain.Network.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
+namespace Insight.Agent.Network.Handlers;
+
+[SupportedOSPlatform("windows")]
+public class InterfaceHandler : IMessageHandler
{
- [SupportedOSPlatform("windows")]
- public class InterfaceHandler : IAgentMessageHandler
+ public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
{
- public async ValueTask HandleAsync(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
+ switch (message)
{
- 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
+ case InventoryRequest:
{
- 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
- };
+ var result = new Collection();
+ if (GetInterfaces() is List interfaces) result.AddRange(interfaces);
- try
- {
- var propertiesV4 = ipProperties.GetIPv4Properties();
- @interface.Index = uint.Parse(propertiesV4.Index.ToString());
- @interface.Ipv4Mtu = propertiesV4.Mtu;
- @interface.Ipv4Dhcp = propertiesV4.IsDhcpEnabled;
- @interface.Ipv4Forwarding = propertiesV4.IsForwardingEnabled;
+ await sender.SendAsync(result, cancellationToken);
+ break;
}
- 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