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. } }
//updater code //string currentMD5 = null; //string updatedMD5 = null; //FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create("ftp://78.110.169.171/78.110.169.171_14240/ac/" + "ac.exe.newver"); //ftp.Credentials = new NetworkCredential("spiteful", "LPOcssSV2012"); //ftp.KeepAlive = false; //ftp.UseBinary = true; //ftp.Method = WebRequestMethods.Ftp.DownloadFile; //using (FtpWebResponse FtpResponse = (FtpWebResponse)ftp.GetResponse()) //{ // using (System.IO.Stream ResponseStream = FtpResponse.GetResponseStream()) // { // using (System.IO.FileStream fs = new System.IO.FileStream("C:\\ac_updated.exe", FileMode.Create)) // { // byte[] buffer = new byte[2048]; // int read = 0; // do // { // read = ResponseStream.Read(buffer, 0, buffer.Length); // fs.Write(buffer, 0, read); // } while (read != 0); // ResponseStream.Close(); // fs.Flush(); // fs.Close(); // } // ResponseStream.Close(); // } //} ////lolcode ftw //currentMD5 = Core.MD5Encoder.EncodeHashFromFile(Application.ExecutablePath); //updatedMD5 = Core.MD5Encoder.EncodeHashFromFile("c:\\ac_updated.exe"); //if (currentMD5 != updatedMD5) //{ // if (MessageBox.Show("There is a update available, would you like to perform it?" + Environment.NewLine + "We remind you that playing with a outdated version will lead to a 3 day suspension.", "", MessageBoxButtons.YesNo) == DialogResult.Yes) // { // File.Copy("c:\\ac_updated.exe", Application.StartupPath + "\\" + "ac_updated.exe"); // File.Delete("c:\\ac_updated.exe"); // MessageBox.Show("You can now run the updated version called ac_updated.exe and delete old version." + Environment.NewLine + "Please rename the ac_updated.exe to ac.exe or anything at your choice to avoid update bugs." + Environment.NewLine + "DO NOT DELETE THE .DLL OR ELSE YOU WILL NOT BE ABLE TO LOGIN."); // Environment.Exit(0); // } // else // { // File.Delete("c:\\ac_updated.exe"); // Environment.Exit(0); // } //} //else //{ // File.Delete("c:\\ac_updated.exe"); //} private void MainForm_FormClosing(System.Object sender, System.Windows.Forms.FormClosingEventArgs e) { try { if (ProcessManagement.ProcessIsRunning(File.ReadAllText("C:\\esagamerac\\chosengameexec.txt"))) { GameReport report = new GameReport(); report.WriteLine("Anticheat closed while game was running!"); File.WriteAllText("C:\\esagamerac\\acscreens\\gameclosed.txt", report.toFile()); try { RequestHelper.uploadFile(GlobalSettings.RequestHost, username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "game_closed.txt", "C:\\esagamerac\\acscreens\\gameclosed.txt"); } catch (Exception) { try { RequestHelper.uploadFile(GlobalSettings.BackupRequestHost, username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "game_closed.txt", "C:\\esagamerac\\acscreens\\gameclosed.txt"); } catch (Exception) {} } } } catch (FileNotFoundException) { } ProcessManagement.TriggerTaskmanager(true); notifyIcon1.Visible = false; }
public MainForm() { InitializeComponent(); FormClosed += new FormClosedEventHandler(MainForm_FormClosed); this.KeyPreview = true; try { username = File.ReadAllText("C:\\esagamerac\\myusername.txt"); try { RequestHelper.requestFolder(GlobalSettings.RequestHost, "REQUEST USER FOLDER ", username); } catch (Exception) { try { RequestHelper.requestFolder(GlobalSettings.BackupRequestHost, "REQUEST USER FOLDER ", username); } catch (Exception) { MessageBox.Show("Failed to connect to servers. Program will now exit."); string grabProc; try { grabProc = File.ReadAllText("c:\\esagamerac\\chosengameexec.txt"); grabProc = grabProc.Substring(0, grabProc.Length - 4); RuntimeChecker.IsGameRunning(grabProc); } catch (Exception) {} Environment.Exit(0); } } if (Directory.Exists("c:\\esagamerac\\acscreens") == false) { Directory.CreateDirectory("c:\\esagamerac\\acscreens"); } ToolStripLabel3.Text = "Welcome, " + username + "!"; if (ProcessManagement.ProcessIsRunning(File.ReadAllText("C:\\esagamerac\\chosengameexec.txt"))) { GameReport report = new GameReport(); report.WriteLine("Anticheat closed while game was running! " + DateTime.Now.ToString()); File.WriteAllText("C:\\esagamerac\\acscreens\\gameclosed.txt", report.toFile()); try { RequestHelper.uploadFile(GlobalSettings.RequestHost, username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "game_closed.txt", "C:\\esagamerac\\acscreens\\gameclosed.txt"); } catch (Exception) { try { RequestHelper.uploadFile(GlobalSettings.BackupRequestHost, username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "game_closed.txt", "C:\\esagamerac\\acscreens\\gameclosed.txt"); } catch (Exception) { } } } } catch (FileNotFoundException) { } }
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 + " " + DateTime.Now.ToString() + Environment.NewLine); File.WriteAllText("c:\\esagamerac\\" + "newproc.txt", report.toFile()); RequestHelper.uploadFile(GetServerLocation(), username, File.ReadAllText("C:\\esagamerac\\chosengame.txt"), "newproc.txt", "c:\\esagamerac\\newproc.txt"); } catch (ArgumentException) { } }
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(); }
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()); } }
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(); } }
internal void writeProcesses() { string osname = GetOSFriendlyName(); string macaddr = GetMacAddress(); Process[] processlist = System.Diagnostics.Process.GetProcesses(); GameReport report = new GameReport(); report.WriteLine("Anti Cheat Version " + Core.AC_Ver + Environment.NewLine); report.WriteLine("Anti Cheat Report: " + DateTime.Now.ToString().Remove(11) + " " + DateTime.Now.TimeOfDay + Environment.NewLine); report.WriteLine("From user: "******" - playing: " + getGame + Environment.NewLine); report.WriteLine("User HWID: " + Core.ComputerHWID + " - Computer Name: " + System.Environment.MachineName + " - Windows Version: " + osname + " - MAC Address: " + macaddr + Environment.NewLine); report.WriteLine("Match ID: " + getMatchID + Environment.NewLine); foreach (Process process in processlist) { try { report.WriteLine(process.ProcessName + " " + process.MainWindowTitle + " " + GetFilePath(process.Id) + Environment.NewLine); } catch (Exception) { /* the user does not need to know about this error. */ } } getTimeProcesses = TextHandling.GetUnixTimestamp(); File.WriteAllText(Core.AppPath + "ac_log_" + getTimeProcesses + "_matchid" + getMatchID + ".txt", report.toFile()); }