Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.39 KB | None | 0 0
  1. private void buttonLogin_Click(object sender, EventArgs e)
  2. {
  3. #region Submit Info
  4.  
  5. var usernameText = textBoxUserName.Text.Trim();
  6. var passwordText = textBoxPassword.Text.Trim();
  7. Login.UserName = usernameText;
  8. Login.TimeStampCode = (Int32) DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
  9.  
  10. if (Login.AccceptNextLogin > DateTime.Now)
  11. {
  12. MessageBox.Show(
  13. "Too many fail attept, please verify your User Name and Password" +
  14. "\n\nWait " + Math.Ceiling((Login.AccceptNextLogin - DateTime.Now).TotalSeconds) +
  15. " seconds and click \"Login\" button again..."
  16. + "\n\nClick \"Forgot Password?\" to reset your password.",
  17. "TuanHA Firehack/EasyWoWToolbox", MessageBoxButtons.OK,
  18. MessageBoxIcon.Exclamation);
  19. return;
  20. }
  21.  
  22. var url =
  23. $"&username={Login.Base64Encode(usernameText)}&password={Login.Base64Encode(passwordText)}&rdc={Login.TimeStampCode}";
  24. url = "http://www.tuanha.biz/index.php?option=com_bookpro&task=auth" + url;
  25.  
  26. Console.WriteLine("");
  27. Console.WriteLine($"url: {url}");
  28.  
  29. var http = (HttpWebRequest) WebRequest.Create(url);
  30. var response = http.GetResponse();
  31. var stream = response.GetResponseStream();
  32. var sr = new StreamReader(stream);
  33. var content = sr.ReadToEnd();
  34. Console.WriteLine("");
  35. Console.WriteLine($"content: {content}");
  36.  
  37. var contentProcessed = content.Replace("{", "");
  38. contentProcessed = contentProcessed.Replace("}", "");
  39.  
  40. //Console.WriteLine("");
  41. var listProduct = contentProcessed.Split(',');
  42. var dictProduct = new Dictionary<string, int>();
  43. foreach (var product in listProduct)
  44. {
  45. //Console.WriteLine($"listProduct: {product}");
  46. try
  47. {
  48. string productMD5 = product.Split(':')[0];
  49. productMD5 = productMD5.Replace("\"", "");
  50. Int32 expireDate = Convert.ToInt32(product.Split(':')[1]);
  51. if (!string.IsNullOrEmpty(productMD5)
  52. && expireDate > Login.TimeStampCode)
  53. {
  54. dictProduct.Add(productMD5, expireDate);
  55. }
  56. }
  57. catch (Exception ex)
  58. {
  59. Console.WriteLine($"");
  60. Console.WriteLine($"{ex.Message}");
  61. }
  62. }
  63.  
  64. #endregion
  65.  
  66. #region Login Fail or No active subscriptions
  67.  
  68. if (content.Contains("incorectUsesrnameorPassword")
  69. || content.Contains("NoActiveSubcription")
  70. || dictProduct.Count < 1)
  71. {
  72. Login.FailLoginAttempt = Login.FailLoginAttempt + 1;
  73. Login.CustomerMode = false;
  74. var message = "";
  75.  
  76. if (Login.FailLoginAttempt > 5)
  77. {
  78. Login.AccceptNextLogin = DateTime.Now + TimeSpan.FromSeconds(Login.FailLoginAttempt);
  79.  
  80. message = "Too many fail login attempt. Please try again in " +
  81. Login.FailLoginAttempt + " seconds" +
  82. "\n\nMake sure you have active subscription for TuanHA Firehack/EasyWoWToolbox" +
  83. " and use login info for tuanha.biz" +
  84. "\n\nDo you want to visit tuanha.biz to reset your Username and Password?";
  85.  
  86.  
  87. if (MessageBox.Show(message, "TuanHA Firehack/EasyWoWToolbox",
  88. MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
  89. {
  90. Process.Start("http://www.tuanha.biz/index.php?option=com_bookpro&view=login");
  91. }
  92. }
  93. else if (content.Contains("incorectUsesrnameorPassword"))
  94. {
  95. message = "Incorect Username or Password. " +
  96. "\n\nDo you want to visit tuanha.biz to reset your Username and Password?";
  97. if (MessageBox.Show(message, "TuanHA Firehack/EasyWoWToolbox",
  98. MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
  99. {
  100. Process.Start("http://www.tuanha.biz/index.php?option=com_bookpro&view=login");
  101. }
  102. }
  103. else
  104. {
  105. message = "You have no active subscriptions. " +
  106. "\n\nDo you want to visit tuanha.biz and buy subcription?";
  107. if (MessageBox.Show(message, "TuanHA Firehack/EasyWoWToolbox",
  108. MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
  109.  
  110. {
  111. Process.Start("http://www.tuanha.biz/index.php?option=com_bookpro&view=products&Itemid=242");
  112. }
  113. }
  114.  
  115.  
  116. textBoxPassword.Text = "";
  117. return;
  118. }
  119.  
  120. #endregion
  121.  
  122. #region Login Success
  123.  
  124. Console.WriteLine("");
  125. Console.WriteLine("Login Success, Checking available subscription");
  126. Console.WriteLine("");
  127. var messageSuccess = "Thank you for using TuanHA Combat Routine for Firehack/EasyWoWToolbox!" +
  128. "\n\nThis is your active subscription status:\n";
  129.  
  130. foreach (var product in dictProduct)
  131. {
  132. var productName = Login.MD5toClass(product.Key);
  133. var SubscriptionDayLeft = Login.SubscriptionDayLeft(product.Value);
  134.  
  135. Console.WriteLine(
  136. $"dictProduct {product.Key}:{product.Value} - productName: {productName} - SubscriptionDayLeft: {SubscriptionDayLeft}");
  137.  
  138. if (SubscriptionDayLeft > 365)
  139. {
  140. messageSuccess = messageSuccess + $"\n {productName}: No expire subscription";
  141. }
  142. else if (SubscriptionDayLeft > 1)
  143. {
  144. messageSuccess = messageSuccess + $"\n {productName}: {SubscriptionDayLeft} days left";
  145. }
  146. else
  147. {
  148. messageSuccess = messageSuccess + $"\n {productName}: {SubscriptionDayLeft} day left";
  149. }
  150. }
  151.  
  152. if (MessageBox.Show(messageSuccess, "TuanHA Firehack/EasyWoWToolbox",
  153. MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
  154.  
  155. {
  156. //Open the Setting.exe here :D
  157. //Process.Start("https://www.youtube.com/watch?v=qdzmEEVFmrg");
  158. }
  159.  
  160. #endregion
  161. }
  162.  
  163.  
  164. private void textBoxPassword_KeyPressed(object sender, KeyPressEventArgs e)
  165. {
  166. if (e.KeyChar == (char)Keys.Enter)
  167. {
  168. e.Handled = true;
  169. buttonLogin.PerformClick();
  170. }
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement