Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.14 KB | None | 0 0
  1. //Things you use go here!
  2. //Condoms dont
  3. using System;
  4. using HWIDGrabber;
  5. using System.Windows.Forms;
  6.  
  7. //Just something to point out (even tho u dont see it) it took me more time to center the "//Close brackets" then to add them
  8.  
  9. //Also... Why do i get the feeling that theres more comments then actuall code? :thinking:
  10.  
  11. namespace Ayy_Hook
  12. //Open brackets
  13. {
  14. public partial class Form1 : MetroFramework.Forms.MetroForm
  15. //Open brackets
  16. {
  17. //Save a phrase hwid so it can hold a string or letters and numbers in it
  18. string hwid;
  19.  
  20. //This is the load, its auto generated but visual studio and tbh theres really nothing much i can explain
  21. public Form1()
  22. //Open brackets
  23. {
  24. InitializeComponent();
  25. //Close brackets
  26. }
  27.  
  28. //Basically as soon as you enter form1 it runs this code first then the rest
  29. private void Form1_Load(object sender, EventArgs e)
  30. //Open brackets
  31. {
  32. //Basically make hwid your hwid without the long string (which is found after the equals sign)
  33. hwid = HWDI.GetMachineGuid();
  34.  
  35.  
  36. if (Properties.Settings.Default.Checked == true) //If the checkbox was set true from last launch:
  37. //Open brackets
  38. {
  39. metroTextBox1.Text = Properties.Settings.Default.Username; //Fill-in last username
  40. metroTextBox2.Text = Properties.Settings.Default.Password; //Fill-in last username
  41. metroCheckBox1.Checked = Properties.Settings.Default.Checked; //Check the checkbox
  42. //Close brackets
  43. }
  44. //Close brackets
  45. }
  46.  
  47. //As i was adding comments i relized that i couldve named the buttons and labels what they are supposed to be
  48. //Instead of leaving it as metro label but... Nah... Wayyyyyyy tooooo much work :P
  49. private void metroButton1_Click(object sender, EventArgs e) //What happenes after you click the login button
  50. //Open brackets
  51. {
  52. Properties.Settings.Default.Username = metroTextBox1.Text; //Saves your username
  53. Properties.Settings.Default.Password = metroTextBox2.Text; //Saves your password
  54. Properties.Settings.Default.Checked = metroCheckBox1.Checked; //Saves the checkbox current state (checked or not)
  55. Properties.Settings.Default.Save(); //Execute the saving
  56.  
  57. //This is where the program goes onto yout site with the check.php file in order to check authentication
  58. //Note: If your woundering where the links are, they are in settings.cs which is shown below as Settings.Auth
  59. webBrowser1.Navigate(Settings.Auth + "?username=" + metroTextBox1.Text + " & password=" + metroTextBox2.Text + "&hwid=" + hwid);
  60. //Close brackets
  61. }
  62.  
  63. //This part is the response you get after you visit the site
  64. private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  65. //Open brackets
  66. {
  67. //So if the site responds with p1, it means that your password was correct and it can move on, otherwise it will go to the else statement
  68. if (webBrowser1.DocumentText.Contains("p1"))
  69. //Open brackets
  70. {
  71. //Next we check for your group! As long as you have one of these groups, your all good to go, otherwise it will go to the else statement
  72. //Note: I said else statement and not if else, they are 2 completly different things
  73. //Also the || means and so it will check for all of these groups at once
  74. if (webBrowser1.DocumentText.Contains("g7") || webBrowser1.DocumentText.Contains("g8") || webBrowser1.DocumentText.Contains("g11"))
  75. //Open brackets
  76. {
  77. //And now we have gotten to the final part (for checks).
  78. //This tells the program if your hwid is correct or not.
  79. //h1 means hwid is correct!
  80. if (webBrowser1.DocumentText.Contains("h1"))
  81. //Open brackets
  82. {
  83. //All this does is just closes this form and opens form2. so lemme break it down:
  84. //Makes a variable called form2 which equals to open form2
  85. var form2 = new Form2();
  86. //Overall its just a tricky way to not have to declare an entire function (event handler)
  87. //outside of the current one that handles Form2.Closed event. – KDecker
  88. //Also note: I didnt really know how to explain this but this guy did a good job!
  89. form2.Closed += (s, args) => this.Close();
  90. //This shows form2
  91. form2.Show();
  92. //This closes/hides this form
  93. this.Hide();
  94. //Close brackets
  95. }
  96. //This tells the program that your hwid is incorrect
  97. else if (webBrowser1.DocumentText.Contains("h2"))
  98. //Open brackets
  99. {
  100. //So it gives a error message "Error: Incorrect HWID"
  101. MetroFramework.MetroMessageBox.Show(this, "Error : Incorrect HWID.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
  102. //Close brackets
  103. }
  104. //This tells the program that your a new user and your hwid has just been set
  105. else if (webBrowser1.DocumentText.Contains("h3"))
  106. //Open brackets
  107. {
  108. //So it gives a message saying "Note: Setting new HWID"
  109. MetroFramework.MetroMessageBox.Show(this, "Note: Setting new HWID.", "HWID Reset", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
  110. //Close brackets
  111. }
  112. //Close brackets
  113. }
  114. //Now... Since your group didnt match up, we end up here... at this other... else... statement... (what am i doing with my life *sigh*)
  115. else
  116. //Open brackets
  117. {
  118. //So it gives a error message saying "Error : Incorrect group"
  119. MetroFramework.MetroMessageBox.Show(this, "Error : Incorrect group.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
  120. //Close brackets
  121. }
  122. //Close brackets
  123. }
  124. //And if all else fails, we end up here
  125. else
  126. //Open brackets
  127. {
  128. //And so it FINALLY gives us this error message saying "Error : Incorrect username or password."
  129. MetroFramework.MetroMessageBox.Show(this, "Error : Incorrect username or password.", "HWID Reset", MessageBoxButtons.OK, MessageBoxIcon.Error, 100);
  130. //Close brackets
  131. }
  132. //Close brackets
  133. }
  134.  
  135. private void metroTextBox1_KeyDown(object sender, KeyEventArgs e) //When you press a curtain key down, execute code:
  136. //Open brackets
  137. {
  138. if (e.KeyCode == Keys.Enter) //If you pressed enter in the text box:
  139. //Open brackets
  140. {
  141. metroButton1_Click(this, new EventArgs()); //Activate the login button (aka execute login button code)
  142. //Close brackets
  143. }
  144. //Close brackets
  145. }
  146.  
  147. private void metroTextBox2_KeyDown(object sender, KeyEventArgs e) //When you press a curtain key down, execute code:
  148. //Open brackets
  149. {
  150. if (e.KeyCode == Keys.Enter) //If you pressed enter in the text box:
  151. //Open brackets
  152. {
  153. metroButton1_Click(this, new EventArgs()); //Activate the login button (aka execute login button code)
  154. //Close brackets
  155. }
  156. //Close brackets
  157. }
  158.  
  159. private void metroLabel1_Click(object sender, EventArgs e)
  160. {
  161.  
  162. }
  163. //Close brackets
  164. }
  165. //Close brackets
  166. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement