public void GetOperatingSystemInformation() { if (string.IsNullOrEmpty(ServerOperatingSystem.Name)) { var wmi = new ManagementObjectSearcher("select * from Win32_OperatingSystem") .Get() .Cast <ManagementObject>() .First(); ServerOperatingSystem.Name = ((string)wmi["Caption"]).Trim(); ServerOperatingSystem.Version = (string)wmi["Version"]; ServerOperatingSystem.MaxProcessCount = (uint)wmi["MaxNumberOfProcesses"]; ServerOperatingSystem.MaxProcessRAM = (ulong)wmi["MaxProcessMemorySize"]; ServerOperatingSystem.Architecture = (string)wmi["OSArchitecture"]; ServerOperatingSystem.SerialNumber = (string)wmi["SerialNumber"]; ServerOperatingSystem.Build = (string)wmi["BuildNumber"]; } serializator.Serialize(client, packet.endpoint, packet.syncKey, ServerOperatingSystem.ToObject()); }
private async void SendData() { try { var data = new { ServerInfo = ServerOperatingSystem.ToObject(), SystemInfo = SystemInformation.ToObject(), UlteriusVersion = Assembly.GetExecutingAssembly().GetName().Version, GpuInfo = GetGpuInformation(), NetworkInformation = NetworkInformation.ToObject(), CpuInfo = CpuInformation.ToObject() }; var json = JsonConvert.SerializeObject(data); var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("guid", GetMachineGuid()), new KeyValuePair <string, string>("results", json) }); using (var client = new HttpClient()) { client.Timeout = new TimeSpan(0, 0, 0, 5); var result = await client.PostAsync("https://api.ulterius.io/hardware/", content); if (result.IsSuccessStatusCode) { Console.WriteLine("Hardware Survery Completed"); File.WriteAllText(results, "true"); } } } catch (Exception) { //just fail } }
public void GetOperatingSystemInformation() { _builder.WriteMessage(ServerOperatingSystem.ToObject()); }