コード例 #1
0
        private void watcher_OnNewProcess(int PID)
        {
            try {
                Process process = Process.GetProcessById(PID);

                GameReport report = new GameReport();
                report.WriteLine("New process started => " + process.ProcessName + " " + process.MainWindowTitle + " " + GetFilePath(PID) + " " + DateTime.Now.ToString() + Environment.NewLine + "On matchID: " + getMatchID + Environment.NewLine);

                File.AppendAllText(Core.AppPath + "newproc.txt", report.toFile());

                FileManagement fm = new FileManagement();
                fm.postFile(username, getGame, getMatchID, Core.AppPath + "newproc.txt");

                File.Delete(Core.AppPath + "newproc.txt");
            }
            catch (IOException)
            {
                // we continue, no need to warn user about this error.
            }
            catch (ArgumentException)
            {
                // we continue, no need to warn user about this error.
            }
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        private void Execute()
        {
            try
            {
                _fs.Close();

                try
                {
                    FileManagement fm1 = new FileManagement();
                    fm1.createFolder(0, username, null, null);
                    FileManagement fm2 = new FileManagement();
                    fm2.createFolder(1, username, getGame, null);
                    FileManagement fm3 = new FileManagement();
                    fm3.createFolder(2, username, getGame, getMatchID);
                }
                catch (Exception)
                {
                    // we assume that the server is down.
                    Environment.Exit(0);
                }

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

                writeProcesses();

                FileManagement fm = new FileManagement();

                fs.Close();

                ZipStorer zip;

                zip = ZipStorer.Open(Core.AppPath + "acscreens\\log_" + getMatchID + "_" + getGame + "_" + getTimeZip + ".zip", FileAccess.Write);
                zip.AddFile(ZipStorer.Compression.Store, Core.AppPath + "ac_log_" + getTimeProcesses + "_matchid" + getMatchID + ".txt", "ac_log_" + getTimeProcesses + "_matchid" + getMatchID + ".txt", "Anticheat process log during game for match ID " + getMatchID.ToString() + "and at " + DateTime.Now.ToString());
                zip.Close();

                File.Delete(Core.AppPath + "ac_log_" + getTimeProcesses + "_matchid" + getMatchID + ".txt");

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

                int getTime2 = TextHandling.GetUnixTimestamp();

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

                        screen.SaveToFile(Core.AppPath + "acscreens\\" + "screen_" + getTime2 + "_matchid" + getMatchID + ".jpeg");

                        fs2.Close();

                        zip = ZipStorer.Open(Core.AppPath + "acscreens\\log_" + getMatchID + "_" + getGame + "_" + getTimeZip + ".zip", FileAccess.Write);
                        zip.AddFile(ZipStorer.Compression.Store, Core.AppPath + "acscreens\\" + "screen_" + getTime2 + "_matchid" + getMatchID + ".jpeg", "screen_" + getTime2 + "_matchid" + getMatchID + ".jpeg", "Screenshot during game for match ID " + getMatchID.ToString() + "and at " + DateTime.Now.ToString());
                        zip.Close();

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

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

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

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

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

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

                using (ScreenshotBitBltDump screenbitblthandle = new ScreenshotBitBltDump())
                {
                    try
                    {
                        string grabProc;

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

                        Process[] getHandle = Process.GetProcessesByName(grabProc);

                        foreach (Process p in getHandle)
                        {
                            IntPtr windowHandle = p.MainWindowHandle;

                            AeroControl ac = new AeroControl();
                            ac.ControlAero(false);

                            screenbitblthandle.CaptureWindowToFile(windowHandle, Core.AppPath + "acscreens\\" + "screen_bitblt_handle_" + getTime2 + "_matchid" + getMatchID + ".jpeg", ImageFormat.Jpeg);

                            fs3.Close();

                            zip = ZipStorer.Open(Core.AppPath + "acscreens\\log_" + getMatchID + "_" + getGame + "_" + getTimeZip + ".zip", FileAccess.Write);
                            zip.AddFile(ZipStorer.Compression.Store, Core.AppPath + "acscreens\\" + "screen_bitblt_handle_" + getTime2 + "_matchid" + getMatchID + ".jpeg", "screen_bitblt_handle_" + getTime2 + "_matchid" + getMatchID + ".jpeg", "Screenshot aggro mode during game for match ID " + getMatchID.ToString() + "and at " + DateTime.Now.ToString());
                            zip.Close();

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

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

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

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

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

                if (ProcessManagement.ProcessIsRunning("taskmgr.exe"))
                {
                    int tskmgrtimestamp = TextHandling.GetUnixTimestamp();

                    GameReport taskmgrReport = new GameReport();

                    taskmgrReport.WriteLine("Taskmgr opened while anticheat running for user " + username + " at " + DateTime.Now.TimeOfDay + " timestamp: " + tskmgrtimestamp + " on match: " + getMatchID);

                    File.WriteAllText(Core.AppPath + "acscreens\\taskmgr.txt", taskmgrReport.toFile());

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

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

                    TaskManagerIsRunning();
                }

                fs4.Close();
            }
            catch (Exception ex)
            {
                ReportForm ef = new ReportForm();
                ef.label2.Text = ex.ToString();
                ef.Show();
            }
        }