int loginTries = 0; // After a few failed logins. Notify Database and exit or delete application? private void button2_Click(object sender, EventArgs e) { msgtext.Text = ("Please wait"); LoadProgress.Value = 0; if (Usernametextbox.Text.Length == (0) || Passwordtextbox.Text.Length == (0)) { MessageBox.Show("Please fill in your credentials!", "X-LOADER", MessageBoxButtons.OK, MessageBoxIcon.Error); msgtext.Text = ("Status: IDLE"); LoadProgress.Value = 0; } else { msgtext.Text = ("Status: Please wait"); LoadProgress.Value = 0; HttpWebRequest httpWebRequest = null; HttpWebResponse httpWebResponse = null; Stream stream = null; StreamReader streamReader = null; Byte[] postBytes; CookieContainer cookieContainer = new CookieContainer(); string sPostData = "&username="******"&password="******"&remember=yes&submit=Login&action=do_login&url=/member.php?action=login"; string sFinalData = null; msgtext.Text = ("Status: Please wait."); LoadProgress.Value = 15; try { httpWebRequest = (HttpWebRequest)WebRequest.Create("http://x-hook.xyz/forum/member.php?action=login"); httpWebRequest.Method = "POST"; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; postBytes = Encoding.UTF8.GetBytes(sPostData); httpWebRequest.ContentLength = postBytes.Length; httpWebRequest.CookieContainer = cookieContainer; stream = httpWebRequest.GetRequestStream(); stream.Write(postBytes, 0, postBytes.Length); stream.Close(); stream = null; LoadProgress.Value = 35; httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.ASCII); sFinalData = streamReader.ReadToEnd(); msgtext.Text = ("Status: Please wait.."); LoadProgress.Value = 50; if (sFinalData.Contains("X-HOOK Forum") & (sFinalData.Contains("You have successfully been logged in.") & sFinalData.Contains("You will now be taken back to where you came from.") & sFinalData.Contains("Click here if you don't want to wait any longer."))) { WebClient client = new WebClient(); string url = "http://x-hook.xyz/loader/lso/webforum/login.php?username="******"&password="******"&HWID=" + HWID.Generate();//if the username and password field's r NOT empty"; byte[] html = client.DownloadData(url); UTF8Encoding utf = new UTF8Encoding(); string mystring = utf.GetString(html); msgtext.Text = ("Status: Please wait..."); LoadProgress.Value = 65; string Reply = new WebClient().DownloadString("http://x-hook.xyz/loader/lso/webforum/version.php"); msgtext.Text = ("Checking for updates..."); if (version == Reply) { MessageBox.Show("Version: " + Reply + "\nHas been released", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } LoadProgress.Value = 80; //Check HWID, subscription other stuff if (XHOOKACCESS.login(Usernametextbox.Text).Contains("Username does not exist!")) { MessageBox.Show("Login unsuccessful! Please check your credentials!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Usernametextbox.Clear(); Passwordtextbox.Clear(); Usernametextbox.Focus(); msgtext.Text = ("Status: Error"); LoadProgress.Value = 0; } else if (XHOOKACCESS.login(Usernametextbox.Text).Contains("reason: ")) { MessageBox.Show("You are banned check the forum for more information.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); msgtext.Text = ("Status: Error"); LoadProgress.Value = 0; } else if (XHOOKACCESS.login(Usernametextbox.Text).Contains("An other computer is activated with this account!")) { MessageBox.Show("This account is already bound to another computer. \nRequest a HWID unlock to continue", "", MessageBoxButtons.OK, MessageBoxIcon.Error); msgtext.Text = ("Status: Error"); LoadProgress.Value = 0; } else if (XHOOKACCESS.login(Usernametextbox.Text).Contains("we cant do shit!")) { LoadProgress.Value = 100; Form1 f1 = new Form1(Usernametextbox.Text); this.Hide(); f1.Show(); var XLOADERSETTINGS = new MyProg.IniFile("XLOADER.ini"); XLOADERSETTINGS.Write("Username", Usernametextbox.Text, "Username"); XLOADERSETTINGS.Write("Password", Passwordtextbox.Text, "Password"); } else if (XHOOKACCESS.login(Usernametextbox.Text).Contains("No Active subscription.")) { MessageBox.Show("No Active subscription was found.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); msgtext.Text = ("Status: Error"); LoadProgress.Value = 0; Application.Exit(); } else if (XHOOKACCESS.login(Usernametextbox.Text).Contains("New Device activation!")) { MessageBox.Show("welcome!/nYour HWID has been submited. try to relog.", "", MessageBoxButtons.OK, MessageBoxIcon.Error); msgtext.Text = ("Status: Please Relog."); LoadProgress.Value = 0; } else if (XHOOKACCESS.login(Usernametextbox.Text).Contains("")) { MessageBox.Show("Error", "", MessageBoxButtons.OK, MessageBoxIcon.Error); msgtext.Text = ("Status: Error"); LoadProgress.Value = 0; } } else { MessageBox.Show("Login unsuccessful! Please check your credentials!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); msgtext.Text = ("Status: Error"); LoadProgress.Value = 0; } } catch (Exception exception) { //To be sure... } } }
string version = "1.3"; // our current version + 0.1 // GHETTO!!! private void XHOOKACCESS_Load(object sender, EventArgs e) { bool isDebuggerPresent = false; CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref isDebuggerPresent); if (isDebuggerPresent == true) { Application.Exit(); } else { var XLOADERSETTINGS = new MyProg.IniFile("XLOADER.ini"); var UsernameIni = XLOADERSETTINGS.Read("Username", "Username"); var PasswordIni = XLOADERSETTINGS.Read("Password", "Password"); Usernametextbox.Text = UsernameIni; Passwordtextbox.Text = PasswordIni; // anti dbg check flags // IsAlreadyRunning(); /* Configure timer */ /* Configure anti Debug*/ Antidbg.Start(); /* Center Form on screen */ this.CenterToScreen(); string Reply = new WebClient().DownloadString("http://x-hook.xyz/loader/lso/webforum/version.php"); if (Reply.Contains(version)) // ghetto way but for some reason i cant download strings nor using other functions after hours of searching and trying... { toolStripTextBox1.Text = ("Version: ") + (version); MessageBox.Show("A new version of X-HOOK has been released \n Click OK to download a new version. \n This might take a minute.", "X-HOOK | A Update is required!"); try { Name = ("XLOADER.zip"); string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), Name); WebClient webClient = new WebClient(); { webClient.DownloadFile("http://www.x-hook.xyz/app/loader/program/XLOADER.zip", Name); } string version = "1.3"; MessageBox.Show("Download successful. Current Version: " + version + "\nDownloaded Version: " + Reply, "X-LOADER"); string path = Environment.CurrentDirectory + "\\XLOADER.exe"; Process process = new Process(); process.StartInfo.FileName = "cmd.exe"; process.StartInfo.Arguments = string.Format("/c del \"{0}\"", path); process.Start(); Application.Exit(); } catch { MessageBox.Show("Failed To Download! Delete the current X-LOADER.ZIP", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); Application.Exit(); } } else { toolStripTextBox1.Text = ("Version: ") + (Reply); } //Probably smart to Encrypt the strings string Loc = Path.GetTempPath(); string Shell32 = "/shell32.dll"; string Imageres = "/imageres.dll"; if (File.Exists(@Loc + Shell32)) { File.Delete(@Loc + Shell32); } if (File.Exists(@Loc + Imageres)) { File.Delete(@Loc + Imageres); } } }