Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine("#######################");
- List<string> allInfos = new List<string>();
- string getID = identifier("Win32_BaseBoard", "SerialNumber");
- if (getID != "") allInfos.Add(getID);
- getID = identifier("Win32_BaseBoard", "SerialNumber");
- if (getID != "") allInfos.Add(getID);
- getID =identifier("Win32_BIOS", "SerialNumber");
- if (getID != "") allInfos.Add(getID);
- getID =identifier("Win32_Processor", "UniqueId");
- if (getID != "") allInfos.Add(getID);
- getID =identifier("Win32_DiskDrive", "SerialNumber");
- if (getID != "") allInfos.Add(getID);
- getID =identifier("Win32_OperatingSystem", "SerialNumber");
- if (getID != "") allInfos.Add(getID);
- testAllPossibility(allInfos.ToArray());
- Console.WriteLine("#######################");
- Console.ReadKey();
- }
- static string identifier(string wmiclass, string wmiproperty) {
- string result = "";
- ManagementClass mc = new ManagementClass(wmiclass);
- ManagementObjectCollection moc = mc.GetInstances();
- foreach (ManagementObject mo in moc) {
- if (result == "") {
- try {
- result = mo[wmiproperty].ToString();
- } catch { }
- }
- }
- return result;
- }
- static string Hash(string input) {
- using (SHA1Managed sha1 = new SHA1Managed()) {
- var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input));
- var sb = new StringBuilder(hash.Length * 2);
- foreach (byte b in hash) sb.Append(b.ToString("x2"));
- return sb.ToString();
- }
- }
- static void testAllPossibility(string[] text) {
- IEnumerable<string> results = Enumerable.Range(0, 1 << text.Length).Select(e => string.Join(string.Empty, Enumerable.Range(0, text.Length).Select(b => (e & (1 << b)) == 0 ? null : text[b])));
- foreach (string hashage in results) Console.WriteLine(Hash(hashage));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement