Esempio n. 1
0
        public RuntimeChecker(ServerType type, string username)
        {
            this.type = type;
            this.username = username;

            RequestHelper.requestFolder(GetServerLocation(), "REQUEST GAME FOLDER ", username + "\\" + File.ReadAllText("C:\\esagamerac\\chosengame.txt"));

            if (Directory.Exists("c:\\esagamerac\\acscreens") == false)
                Directory.CreateDirectory("c:\\esagamerac\\acscreens");

            ProcessManagement.TriggerTaskmanager(false);
            Process[] processlist = null;
            processlist = System.Diagnostics.Process.GetProcesses();

            GameReport report = new GameReport();
            string realtime = System.DateTime.Now.ToString();

            report.WriteLine("Anti Cheat Report: " + realtime.Remove(11) + "  " + DateTime.Now.TimeOfDay + Environment.NewLine);
            report.WriteLine("From user: "******"." + Environment.NewLine);
            report.WriteLine("User playing: " + File.ReadAllText("C:\\esagamerac\\chosengame.txt"));
            report.WriteLine("Match ID: " + File.ReadAllText("C:\\esagamerac\\matchid.txt"));

            foreach (Process proc_loopVariable in processlist)
            {
                report.WriteLine(proc_loopVariable.ProcessName + " " + proc_loopVariable.MainWindowTitle + Environment.NewLine);
            }

            File.WriteAllText("c:\\esagamerac\\ac_logbeforegame.txt", report.toFile());

            RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "ac_logbeforegame.txt", "c:\\esagamerac\\ac_logbeforegame.txt");

            GameReport driverreport = new GameReport();

            driverreport.WriteLine("System drivers:");
            driverreport.WriteLine(Environment.NewLine);
 
            SelectQuery query = new SelectQuery("Win32_SystemDriver");
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);

            foreach (ManagementObject ManageObject in searcher.Get())
                    {
                        driverreport.WriteLine("Path: " + ManageObject["PathName"].ToString());
                        driverreport.WriteLine("Description: " + ManageObject["Description"].ToString());
                        driverreport.WriteLine(Environment.NewLine);
            }

            File.WriteAllText("c:\\esagamerac\\driverreport_beforegame.txt", driverreport.toFile());

            RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("c:\\esagamerac\\chosengame.txt"), "driverreport_beforegame.txt", "c:\\esagamerac\\driverreport_beforegame.txt");

            using (ScreenshotDump screenpre = new ScreenshotDump())
            {
                int getTimepre = TextHandling.GetUnixTimestamp();
                
                try
                {
                    screenpre.SaveToFile("c:\\esagamerac\\acscreens\\" + "screen_beforegame_" + getTimepre + ".jpeg");

                    RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "screen_beforegame_" + getTimepre + ".jpeg", "c:\\esagamerac\\acscreens\\" + "screen_beforegame_" + getTimepre + ".jpeg");
                }

                catch (Exception)
                {
                    File.WriteAllText("c:\\esagamerac\\acscreens\\captureerror_" + getTimepre + ".txt", "Failed to grab screenshot!");

                    RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "captureerror_" + getTimepre + ".txt", "c:\\esagamerac\\acscreens\\captureerror_" + getTimepre + ".txt");
                }
            }

            //---timer---
            this.timer = new Timer()
            {
                AutoReset = true,
                Interval = 30000,
                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();
        }
Esempio n. 2
0
        private void Execute()
        {
            try
            {
                string username = File.ReadAllText("c:\\esagamerac\\myusername.txt");

                Process[] processlist = System.Diagnostics.Process.GetProcesses();
                
                GameReport report = new GameReport();
                report.WriteLine("Anti Cheat Report: " + DateTime.Now.ToString().Remove(11) + "  " + DateTime.Now.TimeOfDay + Environment.NewLine);
                report.WriteLine("From user: "******"." + Environment.NewLine);
                report.WriteLine("User is playing: " + File.ReadAllText("C:\\esagamerac\\chosengame.txt"));
                report.WriteLine("Match ID: " + File.ReadAllText("C:\\esagamerac\\matchid.txt"));

                foreach (Process process in processlist)
                {
                    report.WriteLine(process.ProcessName + " " + process.MainWindowTitle + Environment.NewLine);
                }

                int getTime = TextHandling.GetUnixTimestamp();

                File.WriteAllText("c:\\esagamerac\\" + "ac_log_" + getTime + ".txt", report.toFile());

                RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "ac_log_" + getTime + ".txt", "c:\\esagamerac\\" + "ac_log_" + getTime + ".txt");

                GameReport driverreport = new GameReport();

                driverreport.WriteLine("System drivers:");
                driverreport.WriteLine(Environment.NewLine);

                SelectQuery query = new SelectQuery("Win32_SystemDriver");
                ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);

                foreach (ManagementObject ManageObject in searcher.Get())
                {
                    driverreport.WriteLine("Path: " + ManageObject["PathName"].ToString());
                    driverreport.WriteLine("Description: " + ManageObject["Description"].ToString());
                    driverreport.WriteLine(Environment.NewLine);
                }

                File.WriteAllText("c:\\esagamerac\\driverreport_" + getTime + ".txt", driverreport.toFile());

                RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("c:\\esagamerac\\chosengame.txt"), "driverreport_" + getTime + ".txt", "c:\\esagamerac\\driverreport_" + getTime + ".txt");

                using (ScreenshotDump screen = new ScreenshotDump())
                {
                    int getTime2 = TextHandling.GetUnixTimestamp();

                    try
                    {
                        screen.SaveToFile("c:\\esagamerac\\acscreens\\" + "screen_" + getTime2 + ".jpeg");

                        RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "screen_" + getTime2 + ".jpeg", "c:\\esagamerac\\acscreens\\" + "screen_" + getTime2 + ".jpeg");
                    }

                    catch (Exception)
                    {
                        File.WriteAllText("c:\\esagamerac\\acscreens\\captureerror_" + getTime2 + ".txt", "Failed to grab screenshot!");

                        RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "captureerror_" + getTime2 + ".txt", "c:\\esagamerac\\acscreens\\captureerror_" + getTime2 + ".txt");
                    }
                }

                if (ProcessManagement.ProcessIsRunning("taskmgr.exe"))
                {
                    GameReport taskmgrReport = new GameReport();

                    taskmgrReport.WriteLine("Taskmgr opened while anticheat running for user " + username);

                    File.WriteAllText("C:\\esagamerac\\acscreens\\taskmgr.txt", taskmgrReport.toFile());

                    RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "taskmgr.txt", "C:\\esagamerac\\acscreens\\taskmgr.txt");

                    TaskManagerIsRunning();
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("An error has occurred: " + Environment.NewLine +  ex.ToString());
            }
        }