Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void buttonLogin_Click(object sender, EventArgs e)
- {
- #region Submit Info
- var usernameText = textBoxUserName.Text.Trim();
- var passwordText = textBoxPassword.Text.Trim();
- Login.UserName = usernameText;
- Login.TimeStampCode = (Int32) DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
- if (Login.AccceptNextLogin > DateTime.Now)
- {
- MessageBox.Show(
- "Too many fail attept, please verify your User Name and Password" +
- "\n\nWait " + Math.Ceiling((Login.AccceptNextLogin - DateTime.Now).TotalSeconds) +
- " seconds and click \"Login\" button again..."
- + "\n\nClick \"Forgot Password?\" to reset your password.",
- "TuanHA Firehack/EasyWoWToolbox", MessageBoxButtons.OK,
- MessageBoxIcon.Exclamation);
- return;
- }
- var url =
- $"&username={Login.Base64Encode(usernameText)}&password={Login.Base64Encode(passwordText)}&rdc={Login.TimeStampCode}";
- url = "http://www.tuanha.biz/index.php?option=com_bookpro&task=auth" + url;
- Console.WriteLine("");
- Console.WriteLine($"url: {url}");
- var http = (HttpWebRequest) WebRequest.Create(url);
- var response = http.GetResponse();
- var stream = response.GetResponseStream();
- var sr = new StreamReader(stream);
- var content = sr.ReadToEnd();
- Console.WriteLine("");
- Console.WriteLine($"content: {content}");
- var contentProcessed = content.Replace("{", "");
- contentProcessed = contentProcessed.Replace("}", "");
- //Console.WriteLine("");
- var listProduct = contentProcessed.Split(',');
- var dictProduct = new Dictionary<string, int>();
- foreach (var product in listProduct)
- {
- //Console.WriteLine($"listProduct: {product}");
- try
- {
- string productMD5 = product.Split(':')[0];
- productMD5 = productMD5.Replace("\"", "");
- Int32 expireDate = Convert.ToInt32(product.Split(':')[1]);
- if (!string.IsNullOrEmpty(productMD5)
- && expireDate > Login.TimeStampCode)
- {
- dictProduct.Add(productMD5, expireDate);
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine($"");
- Console.WriteLine($"{ex.Message}");
- }
- }
- #endregion
- #region Login Fail or No active subscriptions
- if (content.Contains("incorectUsesrnameorPassword")
- || content.Contains("NoActiveSubcription")
- || dictProduct.Count < 1)
- {
- Login.FailLoginAttempt = Login.FailLoginAttempt + 1;
- Login.CustomerMode = false;
- var message = "";
- if (Login.FailLoginAttempt > 5)
- {
- Login.AccceptNextLogin = DateTime.Now + TimeSpan.FromSeconds(Login.FailLoginAttempt);
- message = "Too many fail login attempt. Please try again in " +
- Login.FailLoginAttempt + " seconds" +
- "\n\nMake sure you have active subscription for TuanHA Firehack/EasyWoWToolbox" +
- " and use login info for tuanha.biz" +
- "\n\nDo you want to visit tuanha.biz to reset your Username and Password?";
- if (MessageBox.Show(message, "TuanHA Firehack/EasyWoWToolbox",
- MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
- {
- Process.Start("http://www.tuanha.biz/index.php?option=com_bookpro&view=login");
- }
- }
- else if (content.Contains("incorectUsesrnameorPassword"))
- {
- message = "Incorect Username or Password. " +
- "\n\nDo you want to visit tuanha.biz to reset your Username and Password?";
- if (MessageBox.Show(message, "TuanHA Firehack/EasyWoWToolbox",
- MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
- {
- Process.Start("http://www.tuanha.biz/index.php?option=com_bookpro&view=login");
- }
- }
- else
- {
- message = "You have no active subscriptions. " +
- "\n\nDo you want to visit tuanha.biz and buy subcription?";
- if (MessageBox.Show(message, "TuanHA Firehack/EasyWoWToolbox",
- MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
- {
- Process.Start("http://www.tuanha.biz/index.php?option=com_bookpro&view=products&Itemid=242");
- }
- }
- textBoxPassword.Text = "";
- return;
- }
- #endregion
- #region Login Success
- Console.WriteLine("");
- Console.WriteLine("Login Success, Checking available subscription");
- Console.WriteLine("");
- var messageSuccess = "Thank you for using TuanHA Combat Routine for Firehack/EasyWoWToolbox!" +
- "\n\nThis is your active subscription status:\n";
- foreach (var product in dictProduct)
- {
- var productName = Login.MD5toClass(product.Key);
- var SubscriptionDayLeft = Login.SubscriptionDayLeft(product.Value);
- Console.WriteLine(
- $"dictProduct {product.Key}:{product.Value} - productName: {productName} - SubscriptionDayLeft: {SubscriptionDayLeft}");
- if (SubscriptionDayLeft > 365)
- {
- messageSuccess = messageSuccess + $"\n {productName}: No expire subscription";
- }
- else if (SubscriptionDayLeft > 1)
- {
- messageSuccess = messageSuccess + $"\n {productName}: {SubscriptionDayLeft} days left";
- }
- else
- {
- messageSuccess = messageSuccess + $"\n {productName}: {SubscriptionDayLeft} day left";
- }
- }
- if (MessageBox.Show(messageSuccess, "TuanHA Firehack/EasyWoWToolbox",
- MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
- {
- //Open the Setting.exe here :D
- //Process.Start("https://www.youtube.com/watch?v=qdzmEEVFmrg");
- }
- #endregion
- }
- private void textBoxPassword_KeyPressed(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == (char)Keys.Enter)
- {
- e.Handled = true;
- buttonLogin.PerformClick();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement