public bool Authenticate() { var _version = Environment.OSVersion; var username = Environment.UserName; var processorCount = Environment.ProcessorCount; var httpClient = new HttpClient { UserAgent = $"BoxyBot Windows:{_version}, User:{username}, Count:{processorCount}" }; var request = new RequestBuilder(); var iv = ""; var rnd = new Random(); for (var i = 0; i < 32; i++) { iv += rnd.Next(0, 9).ToString(); } request.Add("AuthKey", iv); request.Add("Identifier", Crypt.Encrypt(Program.fingerprint, Password, iv)); var ts = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds; request.Add("Timestamp", Crypt.Encrypt((ts.ToString()), Password, iv)); var response = httpClient.Request(request, "http://sinlyu.me/boxybot/auth/api.php"); return(this.HandleRequest(Crypt.Decrypt(response, Password, iv))); }
private void LoginButton_Click(object sender, EventArgs e) { var httpClient = new HttpClient { UserAgent = $"BoxyBot Login" }; var request = new RequestBuilder(); var iv = ""; var rnd = new Random(); for (var i = 0; i < 32; i++) { iv += rnd.Next(0, 9).ToString(); } request.Add("AuthKey", iv); request.Add("username", Crypt.Encrypt(this.loginNameTxtbox.Text, "32252821674067076967647077869621", iv)); request.Add("password", Crypt.Encrypt(this.loginPassTxtbox.Text, "32252821674067076967647077869621", iv)); request.Add("indentifier", Crypt.Encrypt(Program.fingerprint, "32252821674067076967647077869621", iv)); var response = httpClient.Request(request, "http://sinlyu.me/boxybot/auth/login.php"); response = Crypt.Decrypt(response, "32252821674067076967647077869621", iv); JArray jsonData = null; string status = "0"; if (response.Contains("[")) { jsonData = JArray.Parse(response); status = jsonData.Last.SelectToken("status").ToString(); } else { status = JObject.Parse(response).SelectToken("status").ToString(); } if (status == "0") { MessageBox.Show("There was an error while connecting to the Server!", "Connection Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (status == "-4") { MessageBox.Show("Your Account got banned!", "Banned Account!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (status == "-3") { MessageBox.Show("Invalid Account!", "Invalid Account!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (status == "-2") { MessageBox.Show("You have entered an invalid Password!", "Invalid Password!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (status == "-1") { MessageBox.Show("Your license is expired!", "License Expired!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (status == "1") { DialogResult = DialogResult.OK; } }
public bool CheckVersion() { var httpClient = new HttpClient { UserAgent = $"BoxyBot Version Check" }; var request = new RequestBuilder(); var iv = ""; var rnd = new Random(); for (var i = 0; i < 32; i++) { iv += rnd.Next(0, 9).ToString(); } request.Add("AuthKey", iv); request.Add("Identifier", Crypt.Encrypt(Program.fingerprint, Password, iv)); request.Add("Version", Program.BountyBotVersion); var response = httpClient.Request(request, "http://sinlyu.me/boxybot/auth/version.php"); var recieved = Crypt.Decrypt(response, Password, iv); JArray jsonData = null; if (recieved.Contains("[")) { jsonData = JArray.Parse(recieved); versionStatus = jsonData.Last.SelectToken("status").ToString(); } else { versionStatus = JObject.Parse(recieved).SelectToken("status").ToString(); } if (versionStatus != "1") { return(false); } return(true); }
public bool CheckForStartUpMessage() { var httpClient = new HttpClient { UserAgent = $"BoxyBot Message Check" }; var request = new RequestBuilder(); var help = new HelpTools(); request.Add("Message", "1.0"); var response = httpClient.Request(request, "http://sinlyu.me/boxybot/auth/messages.php"); this.message = string.Empty; if (response.Length > ("{\"message\":\"\"}").Length + 2) { this.message = help.Between(response, "message\":\"", "\"}").Replace("\\", ""); return(true); } return(false); }