Exemple #1
0
        private void pictureBox1_Click_1(object sender, EventArgs e)
        {
            ProcessManagement.TriggerTaskmanager(false);

            ProcessManagement.TaskManagerIsRunning();

            if (label4.Text.Equals("Scanning"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Game is running!";
                ef.Show();
                return;
            }

            if (label4.Text.Equals("Uploading"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Please wait until uploading ends!";
                ef.Show();
                return;
            }

            ProcessManagement.TriggerTaskmanager(true);

            notifyIcon1.Visible = false;

            if (Directory.Exists(Core.AppPath + "acscreens\\") == true)
            {
                DirectoryInfo di = new DirectoryInfo(Core.AppPath + "acscreens\\");
                di.Delete(true);
            }

            Environment.Exit(0);
        }
Exemple #2
0
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProcessManagement.TriggerTaskmanager(false);

            ProcessManagement.TaskManagerIsRunning();

            if (label4.Text.Equals("Scanning"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Game is running!";
                ef.Show();
                return;
            }

            if (label4.Text.Equals("Uploading"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Please wait until uploading ends!";
                ef.Show();
                return;
            }

            ProcessManagement.TriggerTaskmanager(true);

            notifyIcon1.Visible = false;

            Environment.Exit(0);
        }
Exemple #3
0
 void MainForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         ProcessManagement.TriggerTaskmanager(true);
         notifyIcon1.Visible = false;
         //Environment.Exit(0);
     }
     catch (Exception)
     {
         Environment.Exit(0);
     }
 }
Exemple #4
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            ProcessManagement.TriggerTaskmanager(false);

            ProcessManagement.TaskManagerIsRunning();

            if (label4.Text.Equals("Scanning"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Game is running!";
                ef.Show();
                return;
            }

            if (label4.Text.Equals("Uploading"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Please wait until uploading ends!";
                ef.Show();
                return;
            }

            ProcessManagement.TriggerTaskmanager(true);

            pictureBox2.Image = ESA_AC.Properties.Resources.ac_button_back_active;

            if (File.Exists(Core.AppPath + "mypassword.txt"))
            {
                File.Delete(Core.AppPath + "mypassword.txt");
            }

            notifyIcon1.Visible = false;

            if (Directory.Exists(Core.AppPath + "acscreens\\") == true)
            {
                DirectoryInfo di = new DirectoryInfo(Core.AppPath + "acscreens\\");
                di.Delete(true);
            }

            Core.DisplayLoginForm();
            this.Hide();
        }
        internal void CheckIfGameIsRunning()
        {
            if (!ProcessManagement.ProcessIsRunning(File.ReadAllText(Core.AppPath + "chosengameexec.txt")))
            {
                ProcessManagement.TriggerTaskmanager(true);
                timer.Enabled = false;
                timer.Stop();

                gamerunningtimer.Enabled = false;
                gamerunningtimer.Stop();

                this.watcher.OnNewProcess -= new NewProcessStartedEvent(watcher_OnNewProcess);

                _fs.Close();

                if (OnStopped != null)
                {
                    OnStopped();
                }
            }
        }
Exemple #6
0
        public static void Initialize()
        {
            try
            {
                MD5Encoder  = new MD5CryptoService();
                SHA1Encoder = new SHA1CryptoService();

                string hwid = ComputerIDFactory.GenerateComputerID();
                computerHardwareID = MD5Encoder.EncodeHash(hwid);
                ProcessManagement.TriggerTaskmanager(true);

                Application.EnableVisualStyles();
                AeroControl ac = new AeroControl();
                ac.ControlAero(false);
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new LoadingForm());
            }
            catch (Exception)
            {
                ReportForm ef = new ReportForm();
                ef.label2.Text = "An error has occurred on initialization!";
                ef.Show();
            }
        }
        public RuntimeChecker(ServerType type, string username)
        {
            this.type     = type;
            this.username = username;

            try
            {
                FileManagement fm2 = new FileManagement();
                fm2.createFolder(1, username, getGame, null);
                FileManagement fm3 = new FileManagement();
                fm3.createFolder(2, username, getGame, getMatchID);

                getTimeZip = TextHandling.GetUnixTimestamp();
            }
            catch (Exception)
            {
                // we assume that the server is down.
                Environment.Exit(0);
            }

            if (!Directory.Exists(Core.AppPath + "acscreens"))
            {
                Directory.CreateDirectory(Core.AppPath + "acscreens");
            }

            ZipStorer zip;

            zip = ZipStorer.Create(Core.AppPath + "acscreens\\log_" + getMatchID + "_" + getGame + "_" + getTimeZip + ".zip", "ESA AntiCheat log for match " + getMatchID.ToString());
            zip.Close();

            _fs = new FileStream(Core.AppPath + "acscreens\\log_" + getMatchID + "_" + getGame + "_" + getTimeZip + ".zip", FileMode.Open, FileAccess.ReadWrite, FileShare.None);

            TaskManagerIsRunning();

            ProcessManagement.TriggerTaskmanager(false);

            writePreGameProcesses();

            FileManagement fm4 = new FileManagement();

            fm4.postFile(username, getGame, getMatchID, Core.AppPath + "ac_logbeforegame_" + getTimepre + "_matchid" + getMatchID + ".txt");

            File.Delete(Core.AppPath + "ac_logbeforegame_" + getTimepre + "_matchid" + getMatchID + ".txt");

            using (ScreenshotDump screenpre = new ScreenshotDump())
            {
                try
                {
                    AeroControl ac = new AeroControl();
                    ac.ControlAero(false);

                    screenpre.SaveToFile(Core.AppPath + "acscreens\\" + "screen_beforegame_" + getTimepre + "_matchid" + getMatchID + ".jpeg");

                    fm4.postFile(username, getGame, getMatchID, Core.AppPath + "acscreens\\" + "screen_beforegame_" + getTimepre + "_matchid" + getMatchID + ".jpeg");

                    File.Delete(Core.AppPath + "acscreens\\" + "screen_beforegame_" + getTimepre + "_matchid" + getMatchID + ".jpeg");
                }

                catch (Exception)
                {
                    File.WriteAllText(Core.AppPath + "acscreens\\captureerror_" + getTimepre + "_matchid" + getMatchID + ".txt", "Failed to grab screenshot! at " + DateTime.Now.TimeOfDay);

                    FileManagement fm = new FileManagement();

                    fm.postFile(username, getGame, getMatchID, Core.AppPath + "acscreens\\captureerror_" + getTimepre + "_matchid" + getMatchID + ".txt");

                    File.Delete(Core.AppPath + "acscreens\\captureerror_" + getTimepre + "_matchid" + getMatchID + ".txt");

                    ReportForm ef = new ReportForm();
                    ef.label2.Text = "Screenshot capture failed!";
                    ef.Show();
                }
            }

            //---timer---
            this.timer = new Timer()
            {
                AutoReset = true,
                Interval  = 60000,
                Enabled   = true
            };

            timer.Elapsed += tick;
            timer.Start();

            this.watcher = new ProcessWatchDog(1000);
            this.watcher.OnNewProcess += new NewProcessStartedEvent(watcher_OnNewProcess);

            this.gamerunningtimer = new Timer()
            {
                AutoReset = true,
                Interval  = 5000,
                Enabled   = true
            };

            gamerunningtimer.Elapsed += gametick;
            gamerunningtimer.Start();

            LaunchGame();
        }
Exemple #8
0
        private void MainForm_FormClosing(System.Object sender, System.Windows.Forms.FormClosingEventArgs e)
        {
            try
            {
                if (ProcessManagement.ProcessIsRunning(File.ReadAllText(Core.AppPath + "chosengameexec.txt")))
                {
                    int gameclosedtimestamp = TextHandling.GetUnixTimestamp();

                    GameReport report = new GameReport();

                    report.WriteLine("Anticheat closed while game was running! at " + DateTime.Now.TimeOfDay + " timestamp: " + gameclosedtimestamp + Environment.NewLine + "On match ID: " + getID + Environment.NewLine);

                    File.WriteAllText(Core.AppPath + "acscreens\\gameclosed.txt", report.toFile());

                    try
                    {
                        FileManagement fm = new FileManagement();
                        fm.postFile(username, null, null, Core.AppPath + "acscreens\\gameclosed.txt");
                    }

                    catch (Exception)
                    {
                        ReportForm ef = new ReportForm();
                        ef.label2.Text = "Upload failed.";
                        ef.Show();
                    }

                    File.Delete(Core.AppPath + "acscreens\\gameclosed.txt");

                    string grabName;
                    grabName = File.ReadAllText(Core.AppPath + "chosengameexec.txt");
                    string grabProc;
                    grabProc = grabName;
                    grabProc = grabProc.Substring(0, grabProc.Length - 4);

                    RuntimeChecker.IsGameRunning(grabProc);
                    ProcessManagement.TriggerTaskmanager(true);

                    notifyIcon1.Visible = false;

                    Environment.Exit(0);
                }
            }

            catch (FileNotFoundException)
            {
                /* user does not need to know about this error */
                try
                {
                    string grabName;
                    grabName = File.ReadAllText(Core.AppPath + "chosengameexec.txt");
                    string grabProc;
                    grabProc = grabName;
                    grabProc = grabProc.Substring(0, grabProc.Length - 4);

                    RuntimeChecker.IsGameRunning(grabProc);
                    ProcessManagement.TriggerTaskmanager(true);
                    notifyIcon1.Visible = false;
                    Environment.Exit(0);
                }
                catch (Exception)
                {
                    ProcessManagement.TriggerTaskmanager(true);
                    notifyIcon1.Visible = false;
                    Environment.Exit(0);
                }
            }
            ProcessManagement.TriggerTaskmanager(true);
            notifyIcon1.Visible = false;
            Environment.Exit(0);
        }
Exemple #9
0
        private void checker_OnStopped()
        {
            CheckForIllegalCrossThreadCalls = false;
            this.Show();
            this.WindowState = FormWindowState.Normal;

            button5.Image = ESA_AC.Properties.Resources.startscan_normal;

            ProcessManagement.TriggerTaskmanager(false);
            ProcessManagement.TaskManagerIsRunning();

            label4.Text = "Uploading";

            try
            {
                if (File.Exists(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip"))
                {
                    using (FileStream fsread = new FileStream(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip", FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        if (File.Exists(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip"))
                        {
                            FileManagement fm = new FileManagement();
                            fm.postFile(username, selectedGame, getID.ToString(), Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip");

                            fsread.Close();

                            File.Delete(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip");
                        }
                        else
                        {
                            File.WriteAllText(Core.AppPath + "acscreens\\warning.txt", "Anticheat zip log has been deleted.");

                            FileManagement fm = new FileManagement();
                            fm.postFile(username, selectedGame, getID.ToString(), Core.AppPath + "acscreens\\warning.txt");

                            File.Delete(Core.AppPath + "acscreens\\warning.txt");
                        }
                    }
                }
                else
                {
                    File.WriteAllText(Core.AppPath + "acscreens\\warning.txt", "Anticheat zip log has been deleted.");

                    FileManagement fm = new FileManagement();
                    fm.postFile(username, selectedGame, getID.ToString(), Core.AppPath + "acscreens\\warning.txt");

                    File.Delete(Core.AppPath + "acscreens\\warning.txt");
                }
            }
            catch (Exception)
            {
                ReportForm ef = new ReportForm();
                ef.label2.Text = "Upload failed.";
                ef.Show();
            }

            ProcessManagement.TriggerTaskmanager(true);

            noGameSelectedToolStripMenuItem.Text = "No game currently selected";

            selectedGame = "";

            label4.Text = "Idle";
        }
Exemple #10
0
        private void startRoutine(DialogResult getdr)
        {
            if (label4.Text.Equals("Scanning"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Routine is already running!";
                ef.Show();
                return;
            }

            if (label4.Text.Equals("Uploading"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Please wait until uploading ends!";
                ef.Show();
                return;
            }

            else
            {
                try
                {
                    getID = int.Parse(TextBox1.Text);

                    if (getID == 0)
                    {
                        ErrorForm ef = new ErrorForm();
                        ef.label2.Text = "Match ID cannot be 0.";
                        ef.Show();
                        return;
                    }

                    File.WriteAllText(Core.AppPath + "matchid.txt", TextBox1.Text);
                }
                catch (Exception)
                {
                    ErrorForm ef = new ErrorForm();
                    ef.label2.Text = "Invalid Match ID.";
                    ef.Show();
                    return;
                }

                DialogResult dr = getdr;

                if (dr == DialogResult.Cancel)
                {
                    //we continue
                }

                else if (dr == DialogResult.OK)
                {
                    noGameSelectedToolStripMenuItem.Text = "Scanning game: " + selectedGame;

                    label4.Text = "Scanning";

                    this.Hide();
                    this.WindowState = FormWindowState.Minimized;

                    string grabName;
                    grabName = File.ReadAllText(Core.AppPath + "chosengameexec.txt");

                    if (grabName.Equals("steam://run/730"))
                    {
                        grabName = "csgo.exe";
                    }

                    else if (grabName.Equals("steam://run/440"))
                    {
                        grabName = "hl2.exe";
                    }

                    else if (grabName.Equals("steam://run/570"))
                    {
                        grabName = "dota.exe";
                    }

                    else if (grabName.Equals("Shootmania"))
                    {
                        string read = string.Empty;

                        try
                        {
                            read = File.ReadAllText(Core.AppPath + "chosengamefullexec.txt");
                        }
                        catch (Exception) { }

                        if (!read.Contains("ManiaPlanet"))
                        {
                            OpenFileDialog ofd = new OpenFileDialog();
                            ofd.Filter = "maniaplanet.exe|maniaplanet.exe| Exe Files (.exe)|*.exe";
                            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                string fullPath = ofd.InitialDirectory + ofd.FileName;
                                string execName = ofd.SafeFileName;
                                File.WriteAllText(Core.AppPath + "chosengamefullexec.txt", fullPath);
                                File.WriteAllText(Core.AppPath + "chosengameexec.txt", execName);
                            }
                            else
                            {
                                label4.Text = "Idle";

                                this.Show();
                                this.WindowState = FormWindowState.Normal;
                                this.Activate();

                                return;
                            }
                        }

                        File.WriteAllText(Core.AppPath + "chosengameexec.txt", "ManiaPlanet.exe");
                    }

                    if (ProcessManagement.ProcessIsRunning(grabName))
                    {
                        grabName = grabName.Substring(0, grabName.Length - 4);
                        RuntimeChecker.IsGameRunning(grabName); //kills old process and opens new one with anticheat
                        ProcessManagement.TriggerTaskmanager(true);
                        Thread.Sleep(1000);
                    }

                    bool primaryFail = false;

                    try
                    {
                        RuntimeChecker checker = new RuntimeChecker(ServerType.PrimaryServer, username);
                        checker.OnStopped += new CheckerStoppedEvent(checker_OnStopped);
                    }
                    catch (Exception)
                    {
                        primaryFail = true;
                    }

                    if (primaryFail == true)
                    {
                        this.Show();
                        this.WindowState = FormWindowState.Normal;

                        ReportForm ef = new ReportForm();
                        ef.label2.Text = "A error has occurred!";
                        ef.Show();

                        checker_OnStopped();

                        ProcessManagement.TriggerTaskmanager(false);
                        ProcessManagement.TaskManagerIsRunning();

                        button5.Image = ESA_AC.Properties.Resources.startscan_normal;

                        label4.Text = "Uploading";

                        try
                        {
                            if (File.Exists(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip"))
                            {
                                using (FileStream fsread = new FileStream(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip", FileMode.Open, FileAccess.Read, FileShare.Read))
                                {
                                    if (File.Exists(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip"))
                                    {
                                        FileManagement fm = new FileManagement();
                                        fm.postFile(username, selectedGame, getID.ToString(), Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip");

                                        fsread.Close();

                                        File.Delete(Core.AppPath + "acscreens\\log_" + getID + "_" + selectedGame + "_" + RuntimeChecker.getTimeZip + ".zip");
                                    }
                                    else
                                    {
                                        File.WriteAllText(Core.AppPath + "acscreens\\warning.txt", "Anticheat zip log has been deleted.");

                                        FileManagement fm = new FileManagement();
                                        fm.postFile(username, selectedGame, getID.ToString(), Core.AppPath + "acscreens\\warning.txt");

                                        File.Delete(Core.AppPath + "acscreens\\warning.txt");
                                    }
                                }
                            }
                            else
                            {
                                File.WriteAllText(Core.AppPath + "acscreens\\warning.txt", "Anticheat zip log has been deleted.");

                                FileManagement fm = new FileManagement();
                                fm.postFile(username, selectedGame, getID.ToString(), Core.AppPath + "acscreens\\warning.txt");

                                File.Delete(Core.AppPath + "acscreens\\warning.txt");
                            }
                        }
                        catch (Exception)
                        {
                            ReportForm ef2 = new ReportForm();
                            ef2.label2.Text = "Upload failed.";
                            ef2.Show();
                        }

                        ProcessManagement.TriggerTaskmanager(true);

                        noGameSelectedToolStripMenuItem.Text = "No game currently selected";

                        selectedGame = "";

                        label4.Text = "Idle";
                    }
                }
            }
        }