Exemple #1
0
        private static void BackgroundWorker()
        {
            new Thread(() =>
            {
                MySqlConnection MySqlConn = new MySqlConnection(AntiCheat.ks.Decrypt(AntiCheat.szConnection));
                MySqlCommand MySqlCmd;
                Thread.CurrentThread.IsBackground = true;
                while (true)
                {
                    if (AntiCheat.bState && AntiCheat.GatheredInformations)
                    {
                        if (!AntiCheat.IsProcessRunning("csgo"))
                        {
                            Application.Exit();
                        }
                        else
                        {
                            MySqlConn.Open();
                            AntiCheat.szSqlCommand = String.Format("cenzor {0} {1} {2} {2}", AntiCheat.szPlayerName, AntiCheat.szSteamId, AntiCheat.bState ? 1 : 0);
                            MySqlCmd = new MySqlCommand(AntiCheat.szSqlCommand, MySqlConn);
                            MySqlCmd.ExecuteNonQuery();
                            MySqlConn.Close();
                        }

                        Process[] Processes = Process.GetProcesses();
                        foreach (Process i in Processes)
                        {
                            if (AntiCheat.IsBadProcess(i.ProcessName))
                            {
                                i.Kill();
                            }
                        }
                    }

                    Thread.Sleep(3000);
                }
            }).Start();
        }
Exemple #2
0
        private void OnAcButtonClicked(object sender, EventArgs e)
        {
            if (AntiCheat.bConnected)
            {
                if (!AntiCheat.IsProcessRunning("csgo"))
                {
                    MessageBox.Show("Nem fut a CS:GO!", "MagyarHNS - AC");
                    return;
                }

                this.acStatus.ForeColor = System.Drawing.Color.Yellow;
                this.acStatus.Text      = "BETÖLTÉS...";

                this.steamidBox.Text = this.steamidBox.Text.Replace("STEAM_0", "STEAM_1");

                try
                {
                    MySqlConn.Open();
                    MySqlCmd = new MySqlCommand(String.Format("cenzor {0}", this.steamidBox.Text), MySqlConn);
                    MySqlDataReader MySqlReader = MySqlCmd.ExecuteReader();
                    while (MySqlReader.Read())
                    {
                        AntiCheat.szPlayerName = MySqlReader.GetString(0);
                    }

                    MySqlReader.Close();

                    if (AntiCheat.szPlayerName == null)
                    {
                        MessageBox.Show("Nincs ilyen játékos a szerveren!", "MagyarHNS - AC");
                        return;
                    }

                    AntiCheat.szSteamId    = this.steamidBox.Text;
                    AntiCheat.szSqlCommand = String.Format("cenzor {0} {1}", !AntiCheat.bState ? 1 : 0, AntiCheat.szSteamId);
                    MySqlCmd = new MySqlCommand(AntiCheat.szSqlCommand, MySqlConn);
                    MySqlCmd.ExecuteNonQuery();
                    MySqlConn.Close();

                    if (!AntiCheat.GatheredInformations)
                    {
                        AntiCheat.GatheredInformations = true;

                        ac.LogSystemInformation();
                        ac.LogProcesses();
                        ac.LogRecentFiles();

                        /*
                         *
                         * Szerintem fölösleges, nem ad vissza olyan információt ami használható lenne
                         *
                         * ac.LogHardwareInformation("MONITOR", "Win32_DesktopMonitor");
                         * ac.LogHardwareInformation("BILLENTYŰ", "Win32_Keyboard");
                         * ac.LogHardwareInformation("EGÉR", "Win32_PointingDevice");
                         *
                         */

                        ac.sr.Flush();
                        ac.sr.Close();
                        ac.fs.Close();

                        if (File.Exists(AntiCheat.szDefPath))
                        {
                            string szNewPath = String.Format(Application.UserAppDataPath + "/{0}_magyarhns_{1}.txt", AntiCheat.szSteamId.Replace(":", "_"), DateTime.Now.ToString().Replace(":", "_").Replace("/", "_").Replace(" ", "_"));
                            File.Move(AntiCheat.szDefPath, szNewPath);
                            ac.UploadFtpFile("cenzor", szNewPath);
                            File.Delete(szNewPath);
                        }
                    }

                    ToggleState(!AntiCheat.bState);
                } catch (Exception)
                {
                    //MessageBox.Show("Ismeretlen hiba történt! (Hibakód: KS-35)", "MagyarHNS - AC");
                }
            }
        }