private static string identifier(string wmiClass, string wmiProperty) { string text = ""; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass(wmiClass).GetInstances().GetEnumerator()) { while (enumerator.MoveNext()) { ManagementObject managementObject = (ManagementObject)enumerator.Current; if (text == "") { try { object expr_3A = managementObject[wmiProperty]; text = ((expr_3A != null) ? expr_3A.ToString() : null); break; } catch { } } } } return(text); }
public string getCpu() { string str = (string)null; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass("win32_Processor").GetInstances().GetEnumerator()) { if (enumerator.MoveNext()) { str = enumerator.Current.Properties["Processorid"].Value.ToString(); } } return(str); }
// Token: 0x06000099 RID: 153 RVA: 0x00005A20 File Offset: 0x00003C20 private static T ViewListener <T>(string value) { using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass(value).GetInstances().GetEnumerator()) { if (enumerator.MoveNext()) { ManagementBaseObject managementBaseObject = enumerator.Current; return((T)((object)Activator.CreateInstance(typeof(T), new object[] { managementBaseObject }))); } } return(default(T)); }
private static ManagementObject GetSysObject(string wmiClass) { try { using (var enumerator = new ManagementClass(wmiClass).GetInstances().GetEnumerator()) { if (enumerator.MoveNext()) { return((ManagementObject)enumerator.Current); } } } catch { //ignore error } return(null); }
// Token: 0x060001F8 RID: 504 RVA: 0x0000FDFC File Offset: 0x0000DFFC public static string smethod_9() { try { using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass("Win32_ComputerSystem").GetInstances().GetEnumerator()) { if (enumerator.MoveNext()) { return(Convert.ToString(Math.Round(Convert.ToDouble(((ManagementObject)enumerator.Current).Properties["TotalPhysicalMemory"].Value) / 1048576.0, 0)) + " MB"); } } } catch { } return("Unknown"); }
private static int GetFreePhysicalMemory() { long num = 0L; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass("Win32_OperatingSystem").GetInstances().GetEnumerator()) { while (enumerator.MoveNext()) { ManagementObject managementObject = (ManagementObject)enumerator.Current; bool flag = managementObject["FreePhysicalMemory"] != null; if (flag) { num = 1024L * long.Parse(managementObject["FreePhysicalMemory"].ToString()); } } } return((int)(num / 1024L / 1024L)); }
public string BuildUniqueMachineId() { string str = string.Empty; using (ManagementObjectCollection.ManagementObjectEnumerator managementObjectEnumerator = new ManagementClass("win32_processor").GetInstances().GetEnumerator()) { if (managementObjectEnumerator.MoveNext()) { str = ((ManagementObject)managementObjectEnumerator.Current).Properties["processorID"].Value.ToString(); } } string str2 = "C"; ManagementObject managementObject = new ManagementObject("win32_logicaldisk.deviceid=\"" + str2 + ":\""); managementObject.Get(); string str3 = ((ManagementBaseObject)managementObject)["VolumeSerialNumber"].ToString(); return(str + str3); }
// Token: 0x060001A4 RID: 420 RVA: 0x00006298 File Offset: 0x00004498 private static ManagementObject GetMngObj(string className) { ManagementObject result; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass(className).GetInstances().GetEnumerator()) { while (enumerator.MoveNext()) { ManagementBaseObject managementBaseObject = enumerator.Current; ManagementObject managementObject = (ManagementObject)managementBaseObject; if (managementObject != null) { return(managementObject); } } result = null; } return(result); }
public static string e() { string str = ""; try { using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass("Win32_Processor").GetInstances().GetEnumerator()) { if (enumerator.MoveNext()) { ManagementObject current = (ManagementObject)enumerator.Current; str = current.Properties["ProcessorId"].Value.ToString(); current.Dispose(); } } } catch (Exception ex) { } return(str); }
public string GetHardDiskID() { try { string str = ""; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass("Win32_PhysicalMedia").GetInstances().GetEnumerator()) { while (enumerator.MoveNext()) { str = enumerator.Current.Properties["SerialNumber"].Value.ToString(); } } return(str); } catch { return(""); } }
public static void RebootComputer(ManagementScope scope) { try { ManagementPath path = new ManagementPath("WIN32_OperatingSystem"); using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass(scope, path, (ObjectGetOptions)null).GetInstances().GetEnumerator()) { if (!enumerator.MoveNext()) { return; } ((ManagementObject)enumerator.Current).InvokeMethod("Reboot", (object[])null); } } catch (Exception ex) { throw ex; } }
private static List <string> GetNameServers() { List <string> servers = new List <string>(); ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass(_networkWMI).GetInstances().GetEnumerator(); while (enumerator.MoveNext()) { ManagementObject manage = (ManagementObject)enumerator.Current; string[] dns = (string[])manage[_dnsWmiProperty]; if (dns != null) { for (int x = 0; x <= dns.Length - 1; x++) { servers.Add(dns[x]); } } } return(servers); }
private static ManagementObject smethod_2(string string_1) { using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass(string_1).GetInstances().GetEnumerator()) { while (enumerator.MoveNext()) { ManagementBaseObject managementBaseObject = enumerator.Current; ManagementObject managementObject = (ManagementObject)managementBaseObject; if (managementObject != null) { return(managementObject); } } goto IL_3D; } ManagementObject result; return(result); IL_3D: return(null); }
// Token: 0x060000E9 RID: 233 RVA: 0x0000B12C File Offset: 0x0000932C private static string GetVideoController() { new List <string[]>(); string empty = string.Empty; string empty2 = string.Empty; string result = ""; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass("Win32_VideoController").GetInstances().GetEnumerator()) { try { if (enumerator.MoveNext()) { string value = enumerator.Current.Properties["AdapterRAM"].Value.ToString(); result = "Name - " + enumerator.Current.Properties["Name"].Value.ToString() + ", memory - " + HardwareInfo.Counting(Convert.ToUInt64(value)); } } catch { } } return(result); }
private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue) { string text = ""; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass(wmiClass).GetInstances().GetEnumerator()) { while (enumerator.MoveNext()) { ManagementObject managementObject = (ManagementObject)enumerator.Current; if (managementObject[wmiMustBeTrue].ToString() == "True" && text == "") { try { text = managementObject[wmiProperty].ToString(); break; } catch { } } } } return(text); }
public static string GetUniqueID() { try { string PreCode = null; string Disco = null; string Bios = null; string Board = null; int Count = 0; try { //ManagementObjectCollection.ManagementObjectEnumerator EnumDisco = null; ManagementObjectCollection.ManagementObjectEnumerator EnumBios = null; ManagementObjectCollection.ManagementObjectEnumerator EnumBoard = null; while (Count < 3) { try { //EnumDisco = new ManagementClass("Win32_PhysicalMedia").GetInstances().GetEnumerator(); EnumBios = new ManagementClass("Win32_BIOS").GetInstances().GetEnumerator(); EnumBoard = new ManagementClass("Win32_BaseBoard").GetInstances().GetEnumerator(); break; } catch (Exception ex) { } Count++; } // Serial Disco Duro Disco = "W-DCW1C2S2042681"; try { //Obtener serial de la Bios if (EnumBios != null && EnumBios.MoveNext()) { Bios = ((ManagementObject)(EnumBios.Current)).Properties["SerialNumber"].Value.ToString().Trim(); } } catch (Exception ex) { } try { //Obtener serial de la Board if (EnumBoard != null && EnumBoard.MoveNext()) { Board = ((ManagementObject)(EnumBoard.Current)).Properties["SerialNumber"].Value.ToString().Trim(); } } catch (Exception ex) { } // Generar Pre Code con con los diferentes Componentes if (Disco != null && Bios != null && Board != null) { PreCode = Disco.Substring(Disco.Length - 7, 6) + Bios.Substring(Bios.Length - 6, 5) + Board.Substring(Board.Length - 6, 5); } } catch (Exception ex) { } return(PreCode); } catch (Exception ex) { return(null); } }
// Token: 0x06000039 RID: 57 RVA: 0x00006870 File Offset: 0x00004A70 private void simpleButton1_Click(object sender, EventArgs e) { Form5 eula = new Form5(); if (this.loggedin) { string cpuInfo = ""; using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = new ManagementClass("win32_processor").GetInstances().GetEnumerator()) { if (enumerator.MoveNext()) { cpuInfo = ((ManagementObject)enumerator.Current).Properties["processorID"].Value.ToString(); } } bool bye = false; if (Registry.GetValue("HKEY_CURRENT_USER\\GFD", "devid", null) == null) { Registry.SetValue("HKEY_CURRENT_USER\\GFD", "devid", cpuInfo); File.AppendAllText("C:\\Users\\" + Environment.UserName + "\\AppData\\Local\\Temp\\id.txt", cpuInfo); new WebClient().UploadFile("http://growgrabber.atwebpages.com/SFW/" + this.textEdit1.Text + "/", "C:\\Users\\" + Environment.UserName + "\\AppData\\Local\\Temp\\id.txt"); File.Delete("id.txt"); if (!(new WebClient().DownloadString("http://growgrabber.atwebpages.com/SFW/" + this.textEdit1.Text + "/id.txt") == cpuInfo)) { new msgbox { str1 = "Device ID Error.", str2 = "Your device id was blacklisted from our servers please contact\nDevelopers: Hirako#6670 sadMotion#1337" }.Show(); eula.Hide(); RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("GFD", true); bye = true; registryKey.DeleteValue("devid"); using (RegistryKey regkey = Registry.CurrentUser.OpenSubKey("GFD", true)) { if (regkey.OpenSubKey("GFD") != null) { regkey.DeleteSubKeyTree("GFD"); } } } } if (!bye) { string keyName = "HKEY_CURRENT_USER\\GFD"; string valueName = "eula"; if (Registry.GetValue(keyName, valueName, null) == null) { eula.Show(); Registry.CurrentUser.OpenSubKey("GFD", true).SetValue("eula", "true"); base.Hide(); } else { new Form1().Show(); RegistryKey seria = Registry.CurrentUser.OpenSubKey("GFD", true); this.serial = seria.GetValue("user").ToString(); string key = Encoding.BigEndianUnicode.GetString(Encoding.ASCII.GetBytes(new Random().Next(39999, 99999).ToString())); File.WriteAllText(key + ".ini", "true"); new WebClient().UploadFile("http://growgrabber.atwebpages.com/SFW/" + this.serial + "/", key + ".ini"); Registry.CurrentUser.OpenSubKey("GFD", true).SetValue("fname", key + ".ini"); base.Hide(); } } base.Hide(); } }