Advertisement
Guest User

Untitled

a guest
Nov 1st, 2018
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. Console.WriteLine("#######################");
  2. List<string> allInfos = new List<string>();
  3. string getID = identifier("Win32_BaseBoard", "SerialNumber");
  4. if (getID != "") allInfos.Add(getID);
  5. getID = identifier("Win32_BaseBoard", "SerialNumber");
  6. if (getID != "") allInfos.Add(getID);
  7. getID =identifier("Win32_BIOS", "SerialNumber");
  8. if (getID != "") allInfos.Add(getID);
  9. getID =identifier("Win32_Processor", "UniqueId");
  10. if (getID != "") allInfos.Add(getID);
  11. getID =identifier("Win32_DiskDrive", "SerialNumber");
  12. if (getID != "") allInfos.Add(getID);
  13. getID =identifier("Win32_OperatingSystem", "SerialNumber");
  14. if (getID != "") allInfos.Add(getID);
  15.  
  16. testAllPossibility(allInfos.ToArray());
  17. Console.WriteLine("#######################");
  18. Console.ReadKey();
  19. }
  20.  
  21. static string identifier(string wmiclass, string wmiproperty) {
  22. string result = "";
  23. ManagementClass mc = new ManagementClass(wmiclass);
  24. ManagementObjectCollection moc = mc.GetInstances();
  25.  
  26. foreach (ManagementObject mo in moc) {
  27. if (result == "") {
  28. try {
  29. result = mo[wmiproperty].ToString();
  30. } catch { }
  31. }
  32. }
  33. return result;
  34. }
  35.  
  36. static string Hash(string input) {
  37. using (SHA1Managed sha1 = new SHA1Managed()) {
  38. var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input));
  39. var sb = new StringBuilder(hash.Length * 2);
  40.  
  41. foreach (byte b in hash) sb.Append(b.ToString("x2"));
  42. return sb.ToString();
  43. }
  44. }
  45.  
  46. static void testAllPossibility(string[] text) {
  47. 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])));
  48. foreach (string hashage in results) Console.WriteLine(Hash(hashage));
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement