Advertisement
Dgame321

Untitled

Dec 17th, 2019
7,524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using Leaf.xNet;
  5. using System.IO;
  6. using Microsoft.Win32;
  7. using MegaSkin.Forms;
  8.  
  9. namespace MegaSkin.Pages
  10. {
  11. public partial class Login : UserControl
  12. {
  13. public static bool isValid;
  14.  
  15. public Login()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void Login_Load(object sender, EventArgs e)
  21. {
  22. StatusLB.Text = null;
  23.  
  24. if (File.Exists("info.MegaSkin"))
  25. {
  26. try
  27. {
  28. string Line = File.ReadAllText("info.MegaSkin");
  29.  
  30. if (Line.Contains(":"))
  31. {
  32. string username = Line.Split(':')[0].ToString().Replace(" ", "");
  33. string password = Line.Split(':')[1].ToString().Replace(" ", "");
  34.  
  35. UsernameTXT.Text = username;
  36. PasswordTXT.Text = password;
  37. }
  38. }
  39. catch (Exception)
  40. {
  41. Environment.Exit(0);
  42. }
  43. }
  44. }
  45.  
  46. private void LoginBTN_Click(object sender, EventArgs e)
  47. {
  48. StatusLB.Text = "Please Wait...";
  49. Program.CheckDebugger();
  50. DoLogin();
  51. }
  52.  
  53. private void DoLogin()
  54. {
  55. using (HttpRequest req = new HttpRequest())
  56. {
  57. try
  58. {
  59. req.Proxy = null;
  60. string data = req.Get("https://pastebin.com/raw/s3V6Wuwj", null).ToString();
  61.  
  62. if (data.Contains($"{UsernameTXT.Text}:{PasswordTXT.Text}:{HWID()}"))
  63. {
  64. if (SaveLoginInfo.Checked == true)
  65. {
  66. if (File.Exists("info.MegaSkin")) File.Delete("info.MegaSkin");
  67. File.AppendAllText(string.Concat("info.MegaSkin"), string.Concat($"{UsernameTXT.Text}:{PasswordTXT.Text}"));
  68. }
  69.  
  70. Main.form.MainMenuBTN.Text = " Main";
  71. Main.form.MainMenuBTN.Enabled = true;
  72. Main.form.StatsMenuBTN.Enabled = true;
  73. Main.form.SettingsMenuBTN.Enabled = true;
  74. Main.form.AboutMenuBTN.Enabled = true;
  75.  
  76. Main.form.MenuHolderPanel.Controls.Clear();
  77. Main.form.MenuHolderPanel.Controls.Add(new Home());
  78. Main.form.MenuHolderPanel.BringToFront();
  79. }
  80. else if (data.Contains($"{UsernameTXT.Text}:{PasswordTXT.Text}"))
  81. {
  82. Clipboard.SetText(HWID());
  83. StatusLB.Text = "Invalid HWID. Your HWID is copied to your clipboard.";
  84. }
  85. else
  86. {
  87. StatusLB.Text = "Invalid login credentials";
  88. }
  89. }
  90. catch (Exception)
  91. {
  92. StatusLB.Text = "An error occurred.";
  93. }
  94. }
  95. }
  96.  
  97. private string HWID()
  98. {
  99. string location = @"SOFTWARE\Microsoft\Cryptography";
  100. string name = "MachineGuid";
  101.  
  102. using (RegistryKey localMachineX64View = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
  103. {
  104. using (RegistryKey rk = localMachineX64View.OpenSubKey(location))
  105. {
  106. if (rk == null) throw new KeyNotFoundException(string.Format("Key Not Found: {0}", location));
  107.  
  108. object machineGuid = rk.GetValue(name);
  109. if (machineGuid == null) throw new IndexOutOfRangeException(string.Format("Index Not Found: {0}", name));
  110.  
  111. return machineGuid.ToString();
  112. }
  113. }
  114. }
  115. }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement