コード例 #1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var builder = new DeviceIdBuilder();

            builder.Formatter = new StringDeviceIdFormatter(new PlainTextDeviceIdComponentEncoder());
            var machineName    = builder.AddProcessorId().ToString();
            var cpu            = builder.AddMachineName().ToString();
            var motherCard     = builder.AddMotherboardSerialNumber().ToString();
            var osInstallation = builder.AddOSInstallationID().ToString();
            var systemDrive    = builder.AddSystemDriveSerialNumber().ToString();

            Console.WriteLine($"----------------------------------------\n" +
                              $"machine name: {machineName}\n" +
                              $"cpu name: {cpu}\n" +
                              $"motherCard name: {motherCard}\n" +
                              $"osInstallation name: {osInstallation}\n" +
                              $"systemDrive name: {systemDrive}\n" +
                              "----------------------------------------");

            Console.ReadLine();
        }
コード例 #2
0
ファイル: Methods.cs プロジェクト: SkyN9ne/OpenBullet2
        public static string GetHWID(BotData data)
        {
            var builder = new DeviceIdBuilder()
                          .AddUserName()
                          .AddMachineName()
                          .AddOSVersion()
                          .AddMacAddress()
                          .AddSystemDriveSerialNumber()
                          .AddOSInstallationID();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                builder
                .AddProcessorId()
                .AddMotherboardSerialNumber()
                .AddSystemUUID();
            }

            var hwid = builder.ToString();

            data.Logger.LogHeader();
            data.Logger.Log($"Got HWID {hwid}", LogColors.DeepChampagne);
            return(hwid);
        }
コード例 #3
0
        public SRClient GetClientDevice()
        {
            DeviceIdBuilder cDeviceId = new DeviceIdBuilder();

            cDeviceId.AddProcessorId();
            cDeviceId.AddMachineName();
            cDeviceId.AddOSVersion();
            cDeviceId.AddSystemUUID();
            cDeviceId.AddUserName();

            // DeviceIdComponent dc = new DeviceIdComponent("test", );
            var wmi = new ManagementObjectSearcher("select * from Win32_OperatingSystem")
                      .Get()
                      .Cast <ManagementObject>()
                      .First();
            var cpu = new ManagementObjectSearcher("select * from Win32_Processor")
                      .Get()
                      .Cast <ManagementObject>()
                      .First();

            var cMachineName    = Environment.MachineName;
            var cExePath        = Environment.CommandLine;
            var cOSVersion      = Environment.OSVersion;
            var cProcessorID    = new WmiDeviceIdComponent("ProcessorId", "Win32_Processor", "ProcessorId").GetValue();
            var cProcessorCount = System.Environment.ProcessorCount;
            var cUUID           = new WmiDeviceIdComponent("SystemUUID", "Win32_ComputerSystemProduct", "UUID").GetValue();
            var cNetwork        = new NetworkAdapterDeviceIdComponent(false, false).GetValue();

            var c = new SRClient();

            c.MachineName = cMachineName;
            c.DeviceID    = cDeviceId.ToString();
            c.FirstRun    = DateTime.Now;
            c.LastActive  = DateTime.Now;
            c.ExePath     = cExePath;
            c.UUID        = cUUID;

            var cOS = new ClientOS();

            cOS.Name            = ((string)wmi["Caption"]).Trim();;
            cOS.Build           = ((string)wmi["BuildNumber"]).StrToInt();
            cOS.Version         = (string)wmi["Version"];
            cOS.SerialNumber    = (string)wmi["SerialNumber"];
            cOS.Architecture    = (string)wmi["OSArchitecture"];
            cOS.MaxProcessCount = (uint)wmi["MaxNumberOfProcesses"];
            cOS.MaxProcessRAM   = (ulong)wmi["MaxProcessMemorySize"];
            c.OS = new List <ClientOS>()
            {
                cOS
            };

            var cCPU = new ClientCPU();

            cCPU.ID          = (string)cpu["ProcessorId"];
            cCPU.Name        = (string)cpu["Name"];
            cCPU.Description = (string)cpu["Caption"];
            // cCPU.Socket = (string)cpu["SocketDesignation"];
            // cCPU.AddressWidth = (ushort)cpu["AddressWidth"];
            // cCPU.DataWidth = (ushort)cpu["DataWidth"];
            // cCPU.Architecture = (ushort)cpu["Architecture"];
            // cCPU.SpeedMHz = (uint)cpu["MaxClockSpeed"];
            // cCPU.BusSpeedMHz = (uint)cpu["ExtClock"];
            // cCPU.L2Cache = (uint)cpu["L2CacheSize"] * (ulong)1024;
            // cCPU.L3Cache = (uint)cpu["L3CacheSize"] * (ulong)1024;
            // cCPU.Cores = (uint)cpu["NumberOfCores"];
            // cCPU.Threads = (uint)cpu["NumberOfLogicalProcessors"];
            c.CPU = new List <ClientCPU>()
            {
                cCPU
            };

            // var js = JsonConvert.SerializeObject(c);
            // Debug.WriteLine(js);
            return(c);
        }