Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1591618c2c | |||
| 3c9ccaafeb | |||
|
|
1e05d4576d | ||
|
|
283fa1abc2 | ||
|
|
26c741ad03 | ||
|
|
450a6f2796 | ||
|
|
febc4d9488 |
595 changed files with 27106 additions and 15577 deletions
|
|
@ -1,8 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
28
insight.sln
28
insight.sln
|
|
@ -31,11 +31,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Insight.Server", "src\Serve
|
|||
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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
@ -71,18 +73,18 @@ Global
|
|||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -95,9 +97,9 @@ Global
|
|||
{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}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F376A326-7590-4E7E-AB9B-76CED8527AB0}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
namespace Insight.Agent.Enums
|
||||
{
|
||||
public enum DispatchEnum
|
||||
{
|
||||
Pending = 1,
|
||||
Failure = 2,
|
||||
Success = 3,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
namespace Insight.Agent.Enums
|
||||
{
|
||||
public enum StatusEnum
|
||||
{
|
||||
Information = 1,
|
||||
Warning = 2,
|
||||
Error = 3
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>Insight.Agent.Assets</AssemblyName>
|
||||
<RootNamespace>Insight.Agent</RootNamespace>
|
||||
<Product>Insight</Product>
|
||||
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||
<FileVersion>2025.2.24.0</FileVersion>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Vaitr.Network.MemoryPack" Version="2025.2.24" />
|
||||
<PackageReference Include="Vaitr.Snmp" Version="2024.5.15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Core\Insight.Domain\Insight.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
using Insight.Agent.Messages;
|
||||
|
||||
namespace Insight.Agent.Interfaces
|
||||
{
|
||||
public partial interface IAgentMessageHandler<TSender>
|
||||
{
|
||||
ValueTask HandleAsync<TMessage>(TSender sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Application>, IAgentMessage { }
|
||||
|
||||
}
|
||||
|
|
@ -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 { }
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using MemoryPack;
|
||||
|
||||
namespace Insight.Agent.Messages
|
||||
{
|
||||
[MemoryPackUnion(2000, typeof(GetInventory))]
|
||||
public partial interface IAgentMessage { }
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class GetInventory : IAgentMessage { }
|
||||
}
|
||||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Volume>? Volumes { get; set; }
|
||||
}
|
||||
|
||||
[MemoryPackable(GenerateType.Collection)]
|
||||
public partial class DriveList : List<Drive>, 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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
using MemoryPack;
|
||||
|
||||
namespace Insight.Agent.Messages
|
||||
{
|
||||
[MemoryPackable]
|
||||
public partial interface IAgentMessage { }
|
||||
}
|
||||
|
|
@ -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<Unicast>? Addresses { get; set; }
|
||||
|
||||
[MemoryPackOrder(23)]
|
||||
public List<IPAddress2>? Gateways { get; set; }
|
||||
|
||||
[MemoryPackOrder(24)]
|
||||
public List<IPAddress2>? Dns { get; set; }
|
||||
|
||||
[MemoryPackOrder(25)]
|
||||
public List<IPAddress2>? Dhcp { get; set; }
|
||||
|
||||
[MemoryPackOrder(26)]
|
||||
public List<Route>? Routes { get; set; }
|
||||
}
|
||||
|
||||
[MemoryPackable(GenerateType.Collection)]
|
||||
public partial class InterfaceList : List<Interface>, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using MemoryPack;
|
||||
|
||||
namespace Insight.Agent.Messages
|
||||
{
|
||||
[MemoryPackUnion(0, typeof(Keepalive))]
|
||||
public partial interface IAgentMessage { }
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class Keepalive : IAgentMessage { }
|
||||
}
|
||||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Memory>, 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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Printer>, IAgentMessage { }
|
||||
}
|
||||
|
|
@ -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<Processor>, IAgentMessage { }
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class ProcessorMetric : IAgentMessage
|
||||
{
|
||||
[MemoryPackOrder(0)]
|
||||
public DateTime? Timestamp { get; set; }
|
||||
|
||||
[MemoryPackOrder(1)]
|
||||
public float? ProcessorUsagePercentage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Service>, IAgentMessage { }
|
||||
}
|
||||
|
|
@ -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<Session>, IAgentMessage { }
|
||||
}
|
||||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<OperationalState>? 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<PhysicalDisk>? PhysicalDisks { get; set; }
|
||||
|
||||
[MemoryPackOrder(14)]
|
||||
public List<VirtualDisk>? 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<StoragePool>, 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<OperationalState>? States { get; set; }
|
||||
|
||||
[MemoryPackOrder(8)]
|
||||
public HealthState? Health { get; set; }
|
||||
|
||||
[MemoryPackOrder(9)]
|
||||
public List<SupportedUsagesEnum>? 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<OperationalState>? 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<KeyValuePair<string, string?>>? Data { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Update>? Installed { get; set; }
|
||||
|
||||
[MemoryPackOrder(1)]
|
||||
public List<Update>? Pending { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Group>? Groups { get; set; }
|
||||
}
|
||||
|
||||
[MemoryPackable(GenerateType.Collection)]
|
||||
public partial class UserList : List<User>, 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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Videocard>, IAgentMessage { }
|
||||
}
|
||||
|
|
@ -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<VirtualMaschineConfiguration>? 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<VirtualMaschine>, 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<VirtualMaschineConfiguration>? 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
namespace Insight.Agent.Models
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public Guid? Serial { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
namespace Insight.Agent
|
||||
{
|
||||
namespace Insight.Agent;
|
||||
|
||||
public static class Appsettings
|
||||
{
|
||||
public const string Api = "api";
|
||||
|
|
@ -7,4 +7,3 @@
|
|||
public const string ServerPort = "server.port";
|
||||
public const string TrapPort = "trap.port";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
namespace Insight.Agent.Constants
|
||||
{
|
||||
namespace Insight.Agent.Constants;
|
||||
|
||||
public static class Deploy
|
||||
{
|
||||
public static class Updater
|
||||
|
|
@ -18,4 +18,3 @@
|
|||
public static Uri GetUpdateHref(Uri api, string appName)
|
||||
=> new($"{api.AbsoluteUri}/update/{appName.ToLower()}/windows");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Insight.Agent.Extensions
|
||||
{
|
||||
namespace Insight.Agent.Extensions;
|
||||
|
||||
public static class ConfigurationExtensions
|
||||
{
|
||||
public static IConfigurationBuilder Defaults(this IConfigurationBuilder configuration)
|
||||
|
|
@ -11,4 +11,3 @@ namespace Insight.Agent.Extensions
|
|||
return configuration.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Insight.Agent.Extensions
|
||||
{
|
||||
namespace Insight.Agent.Extensions;
|
||||
|
||||
public static class Linux
|
||||
{
|
||||
[SupportedOSPlatform("linux")]
|
||||
|
|
@ -29,4 +29,3 @@ namespace Insight.Agent.Extensions
|
|||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,16 +3,12 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RootNamespace>Insight.Agent</RootNamespace>
|
||||
<Product>Insight</Product>
|
||||
<AssemblyName>agent</AssemblyName>
|
||||
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||
<FileVersion>2025.2.24.0</FileVersion>
|
||||
<AssemblyVersion>2023.12.14.0</AssemblyVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
|
@ -27,14 +23,15 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.10" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<PackageReference Include="System.Management" Version="7.0.2" />
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.7" />
|
||||
<PackageReference Include="Vaitr.Snmp" Version="2023.3.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Insight.Agent.Assets\Insight.Agent.Assets.csproj" />
|
||||
<ProjectReference Include="..\..\Core\Insight.Domain\Insight.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Management;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Insight.Agent
|
||||
{
|
||||
namespace Insight.Agent;
|
||||
|
||||
public static class ManagmentExtensions
|
||||
{
|
||||
[SupportedOSPlatform("windows")]
|
||||
|
|
@ -66,4 +66,3 @@ namespace Insight.Agent
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
using System.ServiceProcess;
|
||||
using System.Text;
|
||||
|
||||
namespace Insight.Agent
|
||||
{
|
||||
namespace Insight.Agent;
|
||||
|
||||
internal class Helpers
|
||||
{
|
||||
internal static string? EscapeWql(string text)
|
||||
|
|
@ -41,4 +41,3 @@ namespace Insight.Agent
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
6
src/Agent/Insight.Agent/Models/Config.cs
Normal file
6
src/Agent/Insight.Agent/Models/Config.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
namespace Insight.Agent.Models;
|
||||
|
||||
public class Config
|
||||
{
|
||||
public Guid? Serial { get; set; }
|
||||
}
|
||||
|
|
@ -1,17 +1,37 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Net.Sockets;
|
||||
using Vaitr.Network;
|
||||
|
||||
namespace Insight.Agent.Network;
|
||||
|
||||
public class AgentSession(IEnumerable<IAgentMessageHandler<AgentSession>> handlers, Socket socket, Stream stream, TcpConnectionOptions options, MemPackSerializer serializer, ILogger<AgentSession> logger)
|
||||
: TcpSession<MemPackSerializer, IAgentMessage>(socket, stream, options, serializer, logger)
|
||||
public class AgentSession : TcpSession<IMessage>
|
||||
{
|
||||
private readonly IEnumerable<IAgentMessageHandler<AgentSession>> _handlers = handlers;
|
||||
private readonly IEnumerable<IMessageHandler<AgentSession>> _handlers;
|
||||
|
||||
protected override async ValueTask OnReceivedAsync(PacketContext<IAgentMessage> context, CancellationToken cancellationToken)
|
||||
public AgentSession(IEnumerable<IMessageHandler<AgentSession>> handlers, ISerializer<IMessage> serializer, ILogger<AgentSession> 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<IMessage> context, CancellationToken cancellationToken)
|
||||
{
|
||||
return base.OnSentAsync(context, cancellationToken);
|
||||
}
|
||||
|
||||
protected override async ValueTask OnReceivedAsync(IPacketContext<IMessage> context, CancellationToken cancellationToken)
|
||||
{
|
||||
await base.OnReceivedAsync(context, cancellationToken);
|
||||
|
||||
|
|
@ -19,7 +39,7 @@ public class AgentSession(IEnumerable<IAgentMessageHandler<AgentSession>> handle
|
|||
{
|
||||
try
|
||||
{
|
||||
await handler.HandleAsync(this, context.Data, cancellationToken);
|
||||
await handler.HandleAsync(this, context.Packet, cancellationToken);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -27,4 +47,10 @@ public class AgentSession(IEnumerable<IAgentMessageHandler<AgentSession>> handle
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override ValueTask OnHeartbeatAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("Agent ({ep?}) Heartbeat", RemoteEndPoint);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,19 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Agent.Models;
|
||||
using Insight.Agent.Models;
|
||||
using Insight.Agent.Services;
|
||||
using Insight.Domain.Constants;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
public class AuthenticationHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public class AuthenticationHandler : IAgentMessageHandler<AgentSession>
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
switch (message)
|
||||
{
|
||||
if (message is AuthenticationRequest)
|
||||
case AuthenticationRequest:
|
||||
{
|
||||
Config? config = null;
|
||||
|
||||
|
|
@ -26,12 +29,14 @@ namespace Insight.Agent.Network.Handlers
|
|||
await Configurator.WriteAsync(config, Configuration.DefaultConfig, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await sender.SendAsync(new Authentication
|
||||
await sender.SendAsync(new AuthenticationResponse
|
||||
{
|
||||
Serial = config.Serial ?? throw new InvalidDataException(nameof(config.Serial)),
|
||||
Version = Configuration.Version,
|
||||
Hostname = Configuration.Hostname
|
||||
}, cancellationToken);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
src/Agent/Insight.Agent/Network/Handlers/CustomHandler.cs
Normal file
40
src/Agent/Insight.Agent/Network/Handlers/CustomHandler.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using Insight.Agent.Services;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
public class CustomHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
private readonly ScriptService _scriptService;
|
||||
private readonly ILogger<CustomHandler> _logger;
|
||||
|
||||
public CustomHandler(ScriptService scriptService, ILogger<CustomHandler> logger)
|
||||
{
|
||||
_scriptService = scriptService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async ValueTask HandleAsync<TMessage>(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)
|
||||
{
|
||||
var result = await _scriptService.QueryAsync(request.RequestData);
|
||||
|
||||
await sender.SendAsync(new Response(request)
|
||||
{
|
||||
ResponseData = result.HadErrors ? result.Errors : result.Data,
|
||||
ResponseError = result.HadErrors
|
||||
}, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,26 @@
|
|||
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 : IAgentMessageHandler<AgentSession>
|
||||
public class DriveHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new DriveList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Drive>();
|
||||
result.AddRange(GetDrives());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,4 +180,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return volumes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +1,29 @@
|
|||
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 : IAgentMessageHandler<AgentSession>
|
||||
public class InterfaceHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new InterfaceList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Interface>();
|
||||
result.AddRange(GetInterfaces());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -271,4 +275,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,21 @@
|
|||
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 MainboardHandler : IAgentMessageHandler<AgentSession>
|
||||
public class MainboardHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
case InventoryRequest:
|
||||
await sender.SendAsync(GetMainboard(), cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,4 +86,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return mainboard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,26 @@
|
|||
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 MemoryHandler : IAgentMessageHandler<AgentSession>
|
||||
public class MemoryHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new MemoryList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Memory>();
|
||||
result.AddRange(GetMemory());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,4 +125,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
// return metric;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,24 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Win32;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
public class OperationSystemHandler : IAgentMessageHandler<AgentSession>
|
||||
public class OperationSystemHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
case InventoryRequest:
|
||||
await sender.SendAsync(GetOperatingSystem(), cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,4 +91,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return os;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,26 @@
|
|||
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 PrinterHandler : IAgentMessageHandler<AgentSession>
|
||||
public class PrinterHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new PrinterList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Printer>();
|
||||
result.AddRange(GetPrinters());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,4 +62,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return printers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,26 @@
|
|||
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 ProcessorHandler : IAgentMessageHandler<AgentSession>
|
||||
public class ProcessorHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new ProcessorList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Processor>();
|
||||
result.AddRange(GetProcessors());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,4 +145,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
// return metric;
|
||||
//}
|
||||
}
|
||||
}
|
||||
44
src/Agent/Insight.Agent/Network/Handlers/ProxyHandler.cs
Normal file
44
src/Agent/Insight.Agent/Network/Handlers/ProxyHandler.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using Insight.Agent.Services;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
public class ProxyHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
private readonly ScriptService _scriptService;
|
||||
private readonly ILogger<ProxyHandler> _logger;
|
||||
|
||||
public ProxyHandler(ScriptService scriptService, ILogger<ProxyHandler> logger)
|
||||
{
|
||||
_scriptService = scriptService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case Proxy<Request> proxyRequest:
|
||||
await OnProxyRequestAsync(sender, proxyRequest, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async ValueTask OnProxyRequestAsync(AgentSession sender, Proxy<Request> proxyRequest, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await _scriptService.QueryAsync(proxyRequest.Message.RequestData);
|
||||
|
||||
await sender.SendAsync(new Proxy<Response>()
|
||||
{
|
||||
ProxyId = proxyRequest.ProxyId,
|
||||
Message = new Response(proxyRequest.Message)
|
||||
{
|
||||
ResponseData = result.HadErrors ? result.Errors : result.Data,
|
||||
ResponseError = result.HadErrors
|
||||
}
|
||||
}, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,27 @@
|
|||
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;
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
public class ServiceHandler : IAgentMessageHandler<AgentSession>
|
||||
public class ServiceHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new ServiceList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Service>();
|
||||
result.AddRange(GetServices());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,4 +120,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return services.OrderBy(x => x.Name).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,31 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
public class SessionHandler : IAgentMessageHandler<AgentSession>
|
||||
public class SessionHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new SessionList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Session>();
|
||||
result.AddRange(GetSessions());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Session> GetSessions()
|
||||
{
|
||||
var query = NativeMethods.GetSessions();
|
||||
|
||||
var sessions = new List<Session>();
|
||||
|
||||
foreach (var s in NativeMethods.GetSessions())
|
||||
|
|
@ -249,4 +252,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +1,35 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Win32;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
internal class SoftwareHandler : IAgentMessageHandler<AgentSession>
|
||||
internal class SoftwareHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
case InventoryRequest:
|
||||
{
|
||||
var x64 = Task.Run(() => ApplicationRegistryQuery(RegistryView.Registry64), cancellationToken);
|
||||
var x86 = Task.Run(() => ApplicationRegistryQuery(RegistryView.Registry32), cancellationToken);
|
||||
|
||||
await Task.WhenAll(x64, x86).ConfigureAwait(false);
|
||||
|
||||
var result = new ApplicationList();
|
||||
var result = new Collection<Application>();
|
||||
result.AddRange(x64.Result);
|
||||
result.AddRange(x86.Result.Where(p => result.All(app => p.Name != app.Name && p.Version != app.Version)));
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -116,4 +121,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return apps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,29 @@
|
|||
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;
|
||||
using static Insight.Agent.Messages.PhysicalDisk;
|
||||
using static Insight.Agent.Messages.StoragePool;
|
||||
using static Insight.Agent.Messages.VirtualDisk;
|
||||
using static Insight.Domain.Network.Agent.Messages.PhysicalDisk;
|
||||
using static Insight.Domain.Network.Agent.Messages.StoragePool;
|
||||
using static Insight.Domain.Network.Agent.Messages.VirtualDisk;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
[SupportedOSPlatform("windows")]
|
||||
public class StoragePoolHandler : IAgentMessageHandler<AgentSession>
|
||||
public class StoragePoolHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new StoragePoolList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<StoragePool>();
|
||||
result.AddRange(GetStoragePool());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -305,4 +310,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return disks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,23 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Win32;
|
||||
using System.Collections;
|
||||
using System.Management;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
public class SystemInfoHandler : IAgentMessageHandler<AgentSession>
|
||||
public class SystemInfoHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
case InventoryRequest:
|
||||
await sender.SendAsync(GetSystem(), cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -172,4 +175,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
Windows8AndUp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +1,29 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text.RegularExpressions;
|
||||
using WUApiLib;
|
||||
using static Insight.Agent.Messages.Update;
|
||||
using static Insight.Domain.Network.Agent.Messages.Update;
|
||||
using UpdateCollection = Insight.Domain.Network.Agent.Messages.UpdateCollection;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
[SupportedOSPlatform("windows")]
|
||||
public class UpdateHandler : IAgentMessageHandler<AgentSession>
|
||||
public class UpdateHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
await sender.SendAsync(GetUpdates(), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
private static UpdateList GetUpdates()
|
||||
{
|
||||
return new UpdateList
|
||||
case InventoryRequest:
|
||||
await sender.SendAsync(new UpdateCollection
|
||||
{
|
||||
Installed = QueryInstalledUpdates(),
|
||||
Pending = QueryPendingUpdates()
|
||||
};
|
||||
}, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Update> QueryInstalledUpdates()
|
||||
|
|
@ -127,4 +126,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return updates;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,26 @@
|
|||
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 UserHandler : IAgentMessageHandler<AgentSession>
|
||||
public class UserHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new UserList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<User>();
|
||||
result.AddRange(GetUsers());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,4 +190,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
public string? UserName { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,26 @@
|
|||
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 VideocardHandler : IAgentMessageHandler<AgentSession>
|
||||
public class VideocardHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new VideocardList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<Videocard>();
|
||||
result.AddRange(GetVideocards());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,4 +66,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return videocards;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,28 @@
|
|||
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;
|
||||
using static Insight.Agent.Messages.VirtualMaschine;
|
||||
using static Insight.Agent.Messages.VirtualMaschineConfiguration;
|
||||
using static Insight.Domain.Network.Agent.Messages.VirtualMaschine;
|
||||
using static Insight.Domain.Network.Agent.Messages.VirtualMaschineConfiguration;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers
|
||||
{
|
||||
[SupportedOSPlatform("windows")]
|
||||
public class VirtualMaschineHandler : IAgentMessageHandler<AgentSession>
|
||||
public class VirtualMaschineHandler : IMessageHandler<AgentSession>
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
if (message is GetInventory)
|
||||
switch (message)
|
||||
{
|
||||
var result = new VirtualMaschineList();
|
||||
case InventoryRequest:
|
||||
{
|
||||
var result = new Collection<VirtualMaschine>();
|
||||
result.AddRange(GetVirtualMaschines());
|
||||
|
||||
await sender.SendAsync(result, cancellationToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -356,4 +361,3 @@ namespace Insight.Agent.Network.Handlers
|
|||
return vms;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
using Insight.Agent.Extensions;
|
||||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Agent.Network;
|
||||
using Insight.Agent.Network.Handlers;
|
||||
using Insight.Agent.Services;
|
||||
using Insight.Domain.Constants;
|
||||
using Insight.Domain.Interfaces;
|
||||
using Insight.Domain.Network;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Vaitr.Network;
|
||||
using Vaitr.Network.Hosting;
|
||||
|
||||
namespace Insight.Agent.Windows;
|
||||
|
||||
namespace Insight.Agent.Windows
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
|
|
@ -43,50 +44,51 @@ namespace Insight.Agent.Windows
|
|||
|
||||
builder.ConfigureServices((host, services) =>
|
||||
{
|
||||
// SERVICES
|
||||
// HOST-SERVICES
|
||||
services.AddHostedService<UpdateService>();
|
||||
services.AddHostedService<TrapService>();
|
||||
|
||||
// SERVICES (WINDOWS)
|
||||
if (OperatingSystem.IsWindows()) services.AddHostedService<EventService>();
|
||||
if (OperatingSystem.IsWindows()) services.AddSingleton<ScriptService>();
|
||||
|
||||
// AGENT NETWORKING
|
||||
services.UseHostedTcpClient<AgentSession, MemPackSerializer, IAgentMessage>(options =>
|
||||
services.UseHostedClient<AgentSession, IMessage>(options =>
|
||||
{
|
||||
options.Host = host.Configuration.GetValue<string?>(Appsettings.ServerHost) ?? throw new Exception($"{Appsettings.ServerHost} value not set (appsettings)");
|
||||
options.Port = host.Configuration.GetValue<int?>(Appsettings.ServerPort) ?? throw new Exception($"{Appsettings.ServerPort} value not set (appsettings)");
|
||||
options.Buffer = 1024 * 1024;
|
||||
options.KeepAlive = 10000;
|
||||
options.Keepalive = 10000;
|
||||
options.Timeout = 30000;
|
||||
options.Parallelism = 0;
|
||||
options.Compression = Compression.None;
|
||||
options.Encryption = Encryption.Tls12;
|
||||
options.SslPolicy = SslPolicy.None;
|
||||
|
||||
//options.InputRateLimit = 1024 * 1024 * 100;
|
||||
//options.OutputRateLimit = 1024 * 1024 * 100;
|
||||
options.Compression = true;
|
||||
options.Encryption = Encryption.Tls12;
|
||||
|
||||
options.UseSerializer<AgentSession, IMessage, MemPackSerializer<IMessage>>();
|
||||
});
|
||||
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, AuthenticationHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, DriveHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, InterfaceHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, MainboardHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, MemoryHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, OperationSystemHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, PrinterHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, ProcessorHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, ServiceHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, SessionHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, SoftwareHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, StoragePoolHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, SystemInfoHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, UpdateHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, UserHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, VideocardHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, VirtualMaschineHandler>();
|
||||
services.AddSingleton<IAgentMessageHandler<AgentSession>, ConsoleHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, CustomHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, ProxyHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, AuthenticationHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, DriveHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, InterfaceHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, MainboardHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, MemoryHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, OperationSystemHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, PrinterHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, ProcessorHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, ServiceHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, SessionHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, SoftwareHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, StoragePoolHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, SystemInfoHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, UpdateHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, UserHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, VideocardHandler>();
|
||||
services.AddSingleton<IMessageHandler<AgentSession>, VirtualMaschineHandler>();
|
||||
|
||||
|
||||
// GLOBAL DEPENDENCIES
|
||||
//services.AddSingleton<Bus>();
|
||||
services.AddTransient(provider => new HttpClient(new HttpClientHandler
|
||||
{
|
||||
ClientCertificateOptions = ClientCertificateOption.Manual,
|
||||
|
|
@ -98,4 +100,3 @@ namespace Insight.Agent.Windows
|
|||
await host.RunAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Insight.Agent.Services
|
||||
{
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
[SupportedOSPlatform("linux")]
|
||||
public partial class CollectorService
|
||||
{
|
||||
|
|
@ -14,4 +14,3 @@ namespace Insight.Agent.Services
|
|||
Logger = logger ?? NullLogger<CollectorService>.Instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Text.Json;
|
||||
|
||||
namespace Insight.Agent.Services
|
||||
{
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
public static class Configurator
|
||||
{
|
||||
public static async ValueTask<TConfig> ReadAsync<TConfig>(string file, CancellationToken cancellationToken = default)
|
||||
|
|
@ -94,4 +94,3 @@ namespace Insight.Agent.Services
|
|||
await File.WriteAllTextAsync(file, json, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,25 @@
|
|||
using Insight.Agent.Messages;
|
||||
using Insight.Agent.Network;
|
||||
using Insight.Agent.Network;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Threading.Channels;
|
||||
using Vaitr.Network;
|
||||
using static Insight.Agent.Messages.Event;
|
||||
using static Insight.Domain.Network.Agent.Messages.Event;
|
||||
using EventLevel = System.Diagnostics.Tracing.EventLevel;
|
||||
|
||||
namespace Insight.Agent.Services
|
||||
{
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
internal class EventService : BackgroundService
|
||||
{
|
||||
private readonly Channel<Event> _queue;
|
||||
private readonly TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> _pool;
|
||||
private readonly ISessionPool<AgentSession, IMessage> _pool;
|
||||
private readonly ILogger<EventService> _logger;
|
||||
|
||||
public EventService(TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> pool, ILogger<EventService> logger)
|
||||
public EventService(ISessionPool<AgentSession, IMessage> pool, ILogger<EventService> logger)
|
||||
{
|
||||
_pool = pool;
|
||||
_logger = logger;
|
||||
|
|
@ -167,4 +168,3 @@ namespace Insight.Agent.Services
|
|||
catch (Exception) { } // app crash
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +1,19 @@
|
|||
using Insight.Agent.Interfaces;
|
||||
using Insight.Agent.Messages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
|
||||
namespace Insight.Agent.Network.Handlers;
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
public class ConsoleHandler : IAgentMessageHandler<AgentSession>
|
||||
public class ScriptService
|
||||
{
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IAgentMessage
|
||||
private readonly ILogger<ScriptService> _logger;
|
||||
|
||||
public ScriptService(ILogger<ScriptService> logger)
|
||||
{
|
||||
if (message is ConsoleQueryRequest consoleQueryRequest)
|
||||
{
|
||||
await OnConsoleQueryRequestAsync(sender, consoleQueryRequest, cancellationToken);
|
||||
}
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
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<QueryResult> QueryScriptAsync(string query)
|
||||
public async Task<QueryResult> QueryAsync(string query)
|
||||
{
|
||||
var result = new QueryResult();
|
||||
var errors = new List<string>();
|
||||
|
|
@ -44,7 +27,7 @@ public class ConsoleHandler : IAgentMessageHandler<AgentSession>
|
|||
using var ps = PowerShell.Create(runspace);
|
||||
ps.AddScript("Set-ExecutionPolicy unrestricted -Scope Process");
|
||||
ps.AddScript(query);
|
||||
ps.AddCommand("ConvertTo-Json"); // -Depth 10
|
||||
//ps.AddCommand("ConvertTo-Json"); // -Depth 10
|
||||
|
||||
result.Query = query;
|
||||
|
||||
|
|
@ -57,7 +40,15 @@ public class ConsoleHandler : IAgentMessageHandler<AgentSession>
|
|||
}
|
||||
else
|
||||
{
|
||||
result.Data = queryResult[0].ToString();
|
||||
var newLine = false;
|
||||
|
||||
foreach (var data in queryResult)
|
||||
{
|
||||
if (newLine) result.Data += "\n";
|
||||
else newLine = true;
|
||||
|
||||
result.Data += data.ToString();
|
||||
}
|
||||
|
||||
//if (string.IsNullOrWhiteSpace(jsonString)) return result;
|
||||
|
||||
|
|
@ -100,7 +91,6 @@ public class ConsoleHandler : IAgentMessageHandler<AgentSession>
|
|||
result.Errors = string.Join("\n", errors);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class QueryResult
|
||||
{
|
||||
|
|
@ -109,3 +99,4 @@ public class QueryResult
|
|||
public string? Data { get; set; }
|
||||
public string? Errors { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using Insight.Agent.Messages;
|
||||
using Insight.Agent.Network;
|
||||
using Insight.Agent.Network;
|
||||
using Insight.Domain.Network;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -9,19 +10,18 @@ using System.Net.Sockets;
|
|||
using System.Threading.Channels;
|
||||
using Vaitr.Network;
|
||||
|
||||
namespace Insight.Agent.Services
|
||||
{
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
public class TrapService : BackgroundService
|
||||
{
|
||||
private static IPEndPoint EndpointCache { get; } = new(IPAddress.Any, 0);
|
||||
private readonly Channel<Trap> _queue;
|
||||
|
||||
|
||||
private readonly int _port;
|
||||
private readonly TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> _pool;
|
||||
private readonly ISessionPool<AgentSession, IMessage> _pool;
|
||||
private readonly ILogger<TrapService> _logger;
|
||||
|
||||
public TrapService(TcpSessionPool<AgentSession, MemPackSerializer, IAgentMessage> pool, IConfiguration configuration, ILogger<TrapService> logger)
|
||||
public TrapService(ISessionPool<AgentSession, IMessage> pool, IConfiguration configuration, ILogger<TrapService> logger)
|
||||
{
|
||||
_port = configuration.GetValue<int?>(Appsettings.TrapPort) ?? throw new Exception($"{Appsettings.TrapPort} value not set (appsettings)");
|
||||
_pool = pool;
|
||||
|
|
@ -197,4 +197,3 @@ namespace Insight.Agent.Services
|
|||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,8 +10,8 @@ using System.Runtime.Versioning;
|
|||
using System.ServiceProcess;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Insight.Agent.Services
|
||||
{
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
internal class UpdateService : BackgroundService
|
||||
{
|
||||
private readonly Uri _uri;
|
||||
|
|
@ -357,4 +357,3 @@ namespace Insight.Agent.Services
|
|||
public List<string> UpdateErrors { get; } = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
using Insight.Agent.Extensions;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Insight.Agent.Services
|
||||
{
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
public partial class CollectorService
|
||||
{
|
||||
public OperationSystem? GetOperatingSystem()
|
||||
|
|
@ -103,4 +103,3 @@ namespace Insight.Agent.Services
|
|||
return os;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
using Insight.Agent.Extensions;
|
||||
using Insight.Agent.Messages;
|
||||
using Insight.Domain.Network.Agent.Messages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Insight.Agent.Services
|
||||
{
|
||||
namespace Insight.Agent.Services;
|
||||
|
||||
public partial class CollectorService
|
||||
{
|
||||
public List<Session>? GetSessions()
|
||||
|
|
@ -47,4 +47,3 @@ namespace Insight.Agent.Services
|
|||
return sessions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
using Insight.Domain.Constants;
|
||||
|
||||
namespace Insight.Api
|
||||
{
|
||||
namespace Insight.Api;
|
||||
|
||||
public static class Locations
|
||||
{
|
||||
public static DirectoryInfo UpdatesPath { get; } = new DirectoryInfo($"{Configuration.AppDirectory?.FullName}/files/updates");
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,8 @@ using Insight.Infrastructure.Services;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Insight.Api.Controllers
|
||||
{
|
||||
namespace Insight.Api.Controllers;
|
||||
|
||||
[ApiController, Route("api/accounts")]
|
||||
public class AccountController : ControllerBase
|
||||
{
|
||||
|
|
@ -73,4 +73,3 @@ namespace Insight.Api.Controllers
|
|||
return Ok(model.Email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Insight.Api.Controllers
|
||||
{
|
||||
namespace Insight.Api.Controllers;
|
||||
|
||||
[ApiController, Route("api/agents")]
|
||||
public class AgentController : ControllerBase
|
||||
{
|
||||
|
|
@ -41,4 +41,3 @@ namespace Insight.Api.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Insight.Api.Controllers
|
||||
{
|
||||
namespace Insight.Api.Controllers;
|
||||
|
||||
[ApiController, Route("api/customers")]
|
||||
public class CustomerController : ControllerBase
|
||||
{
|
||||
|
|
@ -41,4 +41,3 @@ namespace Insight.Api.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Insight.Api.Controllers
|
||||
{
|
||||
namespace Insight.Api.Controllers;
|
||||
|
||||
[ApiController, Route("api/hosts")]
|
||||
public class HostController : ControllerBase
|
||||
{
|
||||
|
|
@ -41,4 +41,3 @@ namespace Insight.Api.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,8 +8,8 @@ using MongoDB.Driver;
|
|||
using System.Text.Json.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Insight.Api.Controllers
|
||||
{
|
||||
namespace Insight.Api.Controllers;
|
||||
|
||||
[ApiController, Route("api/inventory")]
|
||||
public class InventoryController : ControllerBase
|
||||
{
|
||||
|
|
@ -70,4 +70,3 @@ namespace Insight.Api.Controllers
|
|||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Insight.Server.Controllers
|
||||
{
|
||||
namespace Insight.Server.Controllers;
|
||||
|
||||
[ApiController, Route("api/setup")]
|
||||
public class SetupController : ControllerBase
|
||||
{
|
||||
|
|
@ -27,4 +27,3 @@ namespace Insight.Server.Controllers
|
|||
return File(await System.IO.File.ReadAllBytesAsync(files.OrderBy(p => p.LastWriteTime).First().FullName, cancellationToken), "application/zip", "setup-win64.zip");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ using Insight.Infrastructure.Services;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Insight.Api.Controllers
|
||||
{
|
||||
namespace Insight.Api.Controllers;
|
||||
|
||||
[ApiController, Route("api/token", Order = 0)]
|
||||
public class TokenController : ControllerBase
|
||||
{
|
||||
|
|
@ -82,4 +82,3 @@ namespace Insight.Api.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
using Insight.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Insight.Server.Controllers
|
||||
{
|
||||
namespace Insight.Server.Controllers;
|
||||
|
||||
[ApiController, Route("api/update")]
|
||||
public class UpdateController : ControllerBase
|
||||
{
|
||||
|
|
@ -90,4 +90,3 @@ namespace Insight.Server.Controllers
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
using Microsoft.OpenApi.Models;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Insight.Api.Hosting
|
||||
{
|
||||
namespace Insight.Api.Hosting;
|
||||
|
||||
public static class ServiceExtensions
|
||||
{
|
||||
internal static IServiceCollection AddSwaggerServices(this IServiceCollection services, IConfiguration configuration)
|
||||
|
|
@ -56,4 +56,3 @@ namespace Insight.Api.Hosting
|
|||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,13 +4,10 @@
|
|||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Product>Insight</Product>
|
||||
<AssemblyName>api</AssemblyName>
|
||||
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||
<FileVersion>2025.2.24.0</FileVersion>
|
||||
<AssemblyVersion>2023.12.14.0</AssemblyVersion>
|
||||
<RootNamespace>Insight.Api</RootNamespace>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<UserSecretsId>4ae1d3bf-869e-4963-8a19-35634507d3b3</UserSecretsId>
|
||||
|
||||
<PublishAot>false</PublishAot>
|
||||
|
|
@ -33,17 +30,10 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.13" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||
<!--Unix Serilog stuff-->
|
||||
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />
|
||||
<PackageReference Include="System.IO" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Insight.Api.Models
|
||||
{
|
||||
namespace Insight.Api.Models;
|
||||
|
||||
public class RegistrationModel
|
||||
{
|
||||
public string? FirstName { get; set; }
|
||||
|
|
@ -20,4 +20,3 @@ namespace Insight.Api.Models
|
|||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string? ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ using Insight.Domain.Constants;
|
|||
using Insight.Infrastructure;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
|
||||
namespace Insight.Api
|
||||
{
|
||||
public class Program
|
||||
namespace Insight.Api;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
|
|
@ -96,4 +96,3 @@ namespace Insight.Api
|
|||
await app.RunAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"AllowedHosts": "*",
|
||||
"Urls": "http://127.0.0.1:5000",
|
||||
"database": "mongodb://10.22.70.40:32768",
|
||||
"database": "mongodb://db.insight.local:27017",
|
||||
"jwt.key": "x5dcaE8fiBmHfgsNrwIEtSWzZkz6gpouzKOIgEiVjxJnW28V1aUnYXF19IcnF5x",
|
||||
"jwt.exp": 3600,
|
||||
"jwt.audience": "http://127.0.0.1:5000",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Insight.Domain.Constants
|
||||
{
|
||||
namespace Insight.Domain.Constants;
|
||||
|
||||
public static class Configuration
|
||||
{
|
||||
public static string Hostname => Dns.GetHostEntry("localhost").HostName;
|
||||
|
|
@ -10,4 +10,3 @@ namespace Insight.Domain.Constants
|
|||
public static DirectoryInfo? AppDirectory => string.IsNullOrWhiteSpace(Environment.ProcessPath) ? null : new DirectoryInfo(Environment.ProcessPath).Parent;
|
||||
public static string DefaultConfig => Path.Combine(AppDirectory?.FullName ?? string.Empty, "config.json");
|
||||
}
|
||||
}
|
||||
13
src/Core/Insight.Domain/Enums/CategoryEnum.cs
Normal file
13
src/Core/Insight.Domain/Enums/CategoryEnum.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
namespace Insight.Domain.Enums;
|
||||
|
||||
public enum CategoryEnum
|
||||
{
|
||||
Network = 1,
|
||||
System = 2,
|
||||
Application = 3,
|
||||
Security = 4,
|
||||
Monitoring = 5,
|
||||
Task = 6,
|
||||
Printer = 7,
|
||||
RDP = 8
|
||||
}
|
||||
8
src/Core/Insight.Domain/Enums/DispatchEnum.cs
Normal file
8
src/Core/Insight.Domain/Enums/DispatchEnum.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace Insight.Domain.Enums;
|
||||
|
||||
public enum DispatchEnum
|
||||
{
|
||||
Pending = 1,
|
||||
Failure = 2,
|
||||
Success = 3,
|
||||
}
|
||||
8
src/Core/Insight.Domain/Enums/RemoteControlMode.cs
Normal file
8
src/Core/Insight.Domain/Enums/RemoteControlMode.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace Insight.Domain.Enums;
|
||||
|
||||
public enum RemoteControlMode
|
||||
{
|
||||
Unknown,
|
||||
Unattended,
|
||||
Attended
|
||||
}
|
||||
7
src/Core/Insight.Domain/Enums/SessionEndReasons.cs
Normal file
7
src/Core/Insight.Domain/Enums/SessionEndReasons.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
namespace Insight.Domain.Enums;
|
||||
|
||||
public enum SessionEndReasons
|
||||
{
|
||||
Logoff = 1,
|
||||
SystemShutdown = 2
|
||||
}
|
||||
14
src/Core/Insight.Domain/Enums/SessionSwitchReason.cs
Normal file
14
src/Core/Insight.Domain/Enums/SessionSwitchReason.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
namespace Insight.Domain.Enums;
|
||||
|
||||
public enum SessionSwitchReason
|
||||
{
|
||||
ConsoleConnect = 1,
|
||||
ConsoleDisconnect = 2,
|
||||
RemoteConnect = 3,
|
||||
RemoteDisconnect = 4,
|
||||
SessionLogon = 5,
|
||||
SessionLogoff = 6,
|
||||
SessionLock = 7,
|
||||
SessionUnlock = 8,
|
||||
SessionRemoteControl = 9
|
||||
}
|
||||
8
src/Core/Insight.Domain/Enums/StatusEnum.cs
Normal file
8
src/Core/Insight.Domain/Enums/StatusEnum.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace Insight.Domain.Enums;
|
||||
|
||||
public enum StatusEnum
|
||||
{
|
||||
Information = 1,
|
||||
Warning = 2,
|
||||
Error = 3
|
||||
}
|
||||
|
|
@ -6,12 +6,14 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>Insight.Domain</RootNamespace>
|
||||
<Product>Insight</Product>
|
||||
<AssemblyVersion>2025.2.24.0</AssemblyVersion>
|
||||
<FileVersion>2025.2.24.0</FileVersion>
|
||||
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<AssemblyVersion>2023.12.14.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Vaitr.Bus" Version="2023.12.13" />
|
||||
<PackageReference Include="Vaitr.Network" Version="2023.12.14" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
8
src/Core/Insight.Domain/Interfaces/IMessageHandler.cs
Normal file
8
src/Core/Insight.Domain/Interfaces/IMessageHandler.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
using Insight.Domain.Network;
|
||||
|
||||
namespace Insight.Domain.Interfaces;
|
||||
|
||||
public partial interface IMessageHandler<TSender>
|
||||
{
|
||||
ValueTask HandleAsync<TMessage>(TSender sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage;
|
||||
}
|
||||
148
src/Core/Insight.Domain/Models/Result.cs
Normal file
148
src/Core/Insight.Domain/Models/Result.cs
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
using MessagePack;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RemoteControl.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// Describes the success or failure of any kind of operation.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// For serialization only.
|
||||
/// </summary>
|
||||
[SerializationConstructor]
|
||||
[JsonConstructor]
|
||||
public Result() { }
|
||||
|
||||
public Result(bool isSuccess, string reason = "", Exception? exception = null)
|
||||
{
|
||||
if (!isSuccess && exception is null && string.IsNullOrWhiteSpace(reason))
|
||||
{
|
||||
throw new ArgumentException("A reason or exception must be supplied for an unsuccessful result.");
|
||||
}
|
||||
|
||||
IsSuccess = isSuccess;
|
||||
Exception = exception;
|
||||
Reason = reason;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Exception? Exception { get; init; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
[MemberNotNullWhen(true, nameof(Exception))]
|
||||
public bool HadException => Exception is not null;
|
||||
|
||||
[DataMember]
|
||||
public bool IsSuccess { get; init; }
|
||||
|
||||
[DataMember]
|
||||
public string Reason { get; init; } = string.Empty;
|
||||
|
||||
|
||||
public static Result Fail(string reason)
|
||||
{
|
||||
return new Result(false, reason);
|
||||
}
|
||||
|
||||
public static Result Fail(Exception ex)
|
||||
{
|
||||
return new Result(false, string.Empty, ex);
|
||||
}
|
||||
|
||||
public static Result<T> Fail<T>(string reason)
|
||||
{
|
||||
return new Result<T>(reason);
|
||||
}
|
||||
|
||||
public static Result<T> Fail<T>(Exception ex)
|
||||
{
|
||||
return new Result<T>(ex);
|
||||
}
|
||||
|
||||
public static Result Ok()
|
||||
{
|
||||
return new Result(true);
|
||||
}
|
||||
|
||||
public static Result<T> Ok<T>(T value)
|
||||
{
|
||||
return new Result<T>(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes the success or failure of any kind of operation.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class Result<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a successful result with the given value.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public Result(T value)
|
||||
{
|
||||
IsSuccess = true;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an unsuccessful result with the given exception.
|
||||
/// </summary>
|
||||
/// <param name="exception"></param>
|
||||
public Result(Exception exception)
|
||||
{
|
||||
IsSuccess = false;
|
||||
Exception = exception;
|
||||
Reason = exception.Message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an unsuccessful result with the given reason.
|
||||
/// </summary>
|
||||
/// <param name="errorMessage"></param>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public Result(string reason)
|
||||
{
|
||||
IsSuccess = false;
|
||||
Reason = reason;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For serialization only.
|
||||
/// </summary>
|
||||
[SerializationConstructor]
|
||||
[JsonConstructor]
|
||||
public Result() { }
|
||||
|
||||
public Result(Exception? exception, bool isSuccess, string reason, T? value)
|
||||
{
|
||||
Exception = exception;
|
||||
IsSuccess = isSuccess;
|
||||
Reason = reason;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public Exception? Exception { get; init; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
[MemberNotNullWhen(true, nameof(Exception))]
|
||||
public bool HadException => Exception is not null;
|
||||
|
||||
[DataMember]
|
||||
[MemberNotNullWhen(true, nameof(Value))]
|
||||
public bool IsSuccess { get; init; }
|
||||
|
||||
[DataMember]
|
||||
public string Reason { get; init; } = string.Empty;
|
||||
|
||||
[DataMember]
|
||||
public T? Value { get; init; }
|
||||
}
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Insight.Domain.Models
|
||||
{
|
||||
namespace Insight.Domain.Models;
|
||||
|
||||
public class TokenRequest
|
||||
{
|
||||
[JsonPropertyName("username"), EmailAddress, Required]
|
||||
public string Username { get; set; }
|
||||
public string? Username { get; set; }
|
||||
|
||||
[JsonPropertyName("password"), DataType(DataType.Password), Required]
|
||||
public string Password { get; set; }
|
||||
public string? Password { get; set; }
|
||||
|
||||
[JsonPropertyName("code"), DataType(DataType.Text)]
|
||||
public string? Code { get; set; }
|
||||
|
|
@ -18,19 +18,19 @@ namespace Insight.Domain.Models
|
|||
public class TokenResponse
|
||||
{
|
||||
[JsonPropertyName("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
public string? AccessToken { get; set; }
|
||||
|
||||
[JsonPropertyName("expires_in")]
|
||||
public int ExpireInSeconds { get; set; }
|
||||
|
||||
[JsonPropertyName("refresh_token")]
|
||||
public string RefreshToken { get; set; }
|
||||
public string? RefreshToken { get; set; }
|
||||
}
|
||||
|
||||
public class TokenRevokeRequest
|
||||
{
|
||||
[JsonPropertyName("token"), Required]
|
||||
public string Token { get; set; }
|
||||
public string? Token { get; set; }
|
||||
|
||||
[JsonPropertyName("reason")]
|
||||
public string? Reason { get; set; }
|
||||
|
|
@ -45,11 +45,10 @@ namespace Insight.Domain.Models
|
|||
public class TokenRefreshRequest
|
||||
{
|
||||
[JsonPropertyName("token"), Required]
|
||||
public string Token { get; set; }
|
||||
public string? Token { get; set; }
|
||||
|
||||
public TokenRefreshRequest(string token)
|
||||
{
|
||||
Token = token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
namespace Insight.Domain.Models
|
||||
{
|
||||
namespace Insight.Domain.Models;
|
||||
|
||||
public class UpdateResponse
|
||||
{
|
||||
public Version? Version { get; set; }
|
||||
public Uri? Uri { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
using MemoryPack;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Insight.Domain.Network.Agent.Messages;
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class Application : IMessage
|
||||
{
|
||||
[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; }
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using MemoryPack;
|
||||
|
||||
namespace Insight.Domain.Network.Agent.Messages;
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class AuthenticationRequest : IMessage { }
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class AuthenticationResponse : IMessage
|
||||
{
|
||||
[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
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
using MemoryPack;
|
||||
|
||||
namespace Insight.Domain.Network.Agent.Messages;
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class InventoryRequest : IMessage { }
|
||||
95
src/Core/Insight.Domain/Network/Agent/Messages/Drive.cs
Normal file
95
src/Core/Insight.Domain/Network/Agent/Messages/Drive.cs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
using MemoryPack;
|
||||
|
||||
namespace Insight.Domain.Network.Agent.Messages;
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class Drive : IMessage
|
||||
{
|
||||
[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<Volume>? Volumes { get; set; }
|
||||
}
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class Volume : IMessage
|
||||
{
|
||||
[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; }
|
||||
}
|
||||
37
src/Core/Insight.Domain/Network/Agent/Messages/Event.cs
Normal file
37
src/Core/Insight.Domain/Network/Agent/Messages/Event.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using MemoryPack;
|
||||
|
||||
namespace Insight.Domain.Network.Agent.Messages;
|
||||
|
||||
[MemoryPackable]
|
||||
public partial class Event : IMessage
|
||||
{
|
||||
[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
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue