public List <ProcessInstanceInfoModel> GetProcessInstanceInfoModels(string processName) { try { var processInstances = ProcessManagement.GetProcessInstances(processName); return(processInstances.Select(processInstance => { var currentStepInfo = processInstance.GetCurrentStep(); return new ProcessInstanceInfoModel { Index = processInstance.Pid, ProcessName = processInstance.ProcessName, CurrentStep = currentStepInfo.Name, CurrentStepId = currentStepInfo.Id, Container = currentStepInfo.Container, ProcessInstanceParameters = processInstance.GetParametersValue() }; }) .ToList()); } catch (Exception e) { Log.Error($"获取Process实例观察参数失败,异常为:[{e.Message}]"); return(null); } }
internal static void ProcessStart(string[] filepaths, bool elevated) { foreach (string filepath in filepaths) { ProcessManagement.ExecuteFile(filepath, elevated); } }
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); }
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); }
public override void Execute() { try { _processName = ActionInParameterManager["ProcessName"].GetValueInString(); var resourceDictionaryName = ActionInParameterManager["SubProcessResources"].GetValueInString(); _process = (Process)ResourceManager.GetResource(_processName); var selectedResource = (DictionaryParameter <string>)ActionInParameterManager.GetDictionaryParam("ParameterDictionary"); if (_process != null) { _startTime = DateTime.Now; Log.Debug($"开始调用其他Process:{_processName}"); ProcessManagement.CallProcessActionRunInstance(_process, new ResourceDicModel <string> { ResourceDictionaryName = resourceDictionaryName, DictionaryParameter = selectedResource }); } else { Log.Error($"调用其他Process:{_processName}出错ProcessName名字可能错误"); } } catch (Exception ex) { Log.Error($"调用其他Process:{_processName}出错{ex}"); } }
internal static void ProcessKillByName(string name) { int[] pids = ProcessManagement.GetProcessIdsByName(name); // Gets all running processes id by name foreach (int pid in pids) //Iterates through each process id to terminate it { ProcessManagement.TerminateProcessById(pid); } }
private void btnAnalyze_Click(object sender, RoutedEventArgs e) { ClearList(); string drive_letter = lbDrives.SelectedItem.ToString().Replace(@"\", ""); if (!ProcessManagement.LaunchCommandLineApp(DEFRAG_DISK_CMD, drive_letter + DEFRAG_DISK_ARG)) { System.Windows.MessageBox.Show("Couldn't start the process!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } btnAbort.IsEnabled = true; }
private void btnAbort_Click(object sender, RoutedEventArgs e) { if (!ProcessManagement.StopProcess()) { System.Windows.MessageBox.Show("Couldn't abort the process!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { btnAbort.IsEnabled = false; } }
private void textBox2_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { try { // adres ip serwera string ip = textBox1.Text; serwerDanychIP = IPAddress.Parse(textBox1.Text); if (textBox2.Text == "") { throw new Exception(); } Screenshot.ipSerwera = ip; WyslijWiadomoscUDP("HI:" + adresLokalnyIP + ":" + textBox2.Text + ":"); this.SetText("Wyslano komunikat HI:" + adresLokalnyIP + ":"); // wywalenie ekranu laczenia label2.Visible = false; textBox1.Visible = false; connectToServer.Visible = false; label3.Visible = false; textBox2.Visible = false; // wlaczenie konsoli listBox1.Visible = true; label1.Visible = true; // start polaczenia backgroundWorker1.RunWorkerAsync(); // Firewall //firewallController = new FirewallController(); // Procesy processController = new ProcessManagement(serwerDanychIP.ToString(), adresLokalnyIP); backgroundWorker2.RunWorkerAsync(); backgroundWorker3.RunWorkerAsync(); } catch (Exception) { MessageBox.Show("Podano zly adres IP lub nie podano nazwy"); } } else { } }
void MainForm_FormClosed(object sender, FormClosedEventArgs e) { try { ProcessManagement.TriggerTaskmanager(true); notifyIcon1.Visible = false; //Environment.Exit(0); } catch (Exception) { Environment.Exit(0); } }
public List <ProcessInfoModel> GetProcessInfos() { var processList = ResourceManager.GetResources(nameof(Process)).Select(a => (Process)a); return(processList.Select(resource => new ProcessInfoModel { ProcessName = resource.ResourceName, ContainerNames = resource.GetContainerNames(), TotalRunningTimes = resource.RunCounts, BreakCounts = resource.BreakCounts, RunningInstanceNumber = ProcessManagement.GetProcessInstancesNumber(resource.ProcessName), }).ToList()); }
private void btnStart_Click(object sender, RoutedEventArgs e) { ClearList(); if (lbDrives.SelectedIndex != -1) { string drive_letter = lbDrives.SelectedItem.ToString().Replace(@"\", ""); string arg = CHECK_DISK_PARAMS + drive_letter + CHECK_DISK_ARG; if (!ProcessManagement.LaunchCommandLineApp(CHECK_DISK_CMD, arg)) { System.Windows.MessageBox.Show("Couldn't start the process!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } btnAbort.IsEnabled = true; } }
public ActionResult Kill(string computerName, string pid) { try { PSRemoting ps = new PSRemoting(computerName, config.FALCON_FORENSICS_USERNAME, config.FALCON_FORENSICS_PASSWORD, config.FALCON_FORENSICS_DOMAIN); ProcessManagement process = new ProcessManagement(ps); process.Kill(Convert.ToInt32(pid)); Response.StatusCode = (int)HttpStatusCode.OK; return(new EmptyResult()); } catch (Exception e) { throw new HttpException(500, e.Message); } }
public QuanLySinhVien() { InitializeComponent(); _processManagement = new ProcessManagement(); loadListClassRoom(); dataGridViewStudents = new DataGridView(); dataGridViewStudents.AutoSize = true; initFieldToEdit(); this.order = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Dob = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Address = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ClassId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Phone = new System.Windows.Forms.DataGridViewTextBoxColumn(); // dataGridViewStudents // this.dataGridViewStudents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridViewStudents.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.order, this.ID, this.Name, this.Dob, this.Address, this.ClassId, this.Phone }); this.dataGridViewStudents.Location = new System.Drawing.Point(137, 142); this.dataGridViewStudents.Name = "dataGridViewStudents"; this.dataGridViewStudents.Size = new System.Drawing.Size(655, 45); this.dataGridViewStudents.TabIndex = 4; ((System.ComponentModel.ISupportInitialize)(this.dataGridViewStudents)).BeginInit(); // STT this.order.HeaderText = "STT"; this.order.Name = "STT"; // ID this.ID.HeaderText = "ID"; this.ID.Name = "ID"; // Name this.Name.HeaderText = "Name"; this.Name.Name = "Name"; // Dob this.Dob.HeaderText = "Gender"; this.Dob.Name = "Gender"; // Address this.Address.HeaderText = "Address"; this.Address.Name = "Address"; // ClassId this.ClassId.HeaderText = "Class ID"; this.ClassId.Name = "ClassId"; // Phone this.Phone.HeaderText = "Phone"; this.Phone.Name = "Phone"; // }
private void wcSecure_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { progressDownloadSecure.Value = e.ProgressPercentage; if (progressDownloadSecure.Value == 100) { string path = dwnldPathSecure + fileNameSecure; txtProgressSecure.Text = "Scanning File"; ProcessManagement.LaunchCommandLineApp("Utils/ssDownload.bat", path, arguments2: "3"); isProcessFinished = false; txtURLSecure.IsEnabled = true; progressDownloadSecure.Value = 0; progressDownloadSecure.IsEnabled = false; btnCancelSecure.IsEnabled = false; btnDownloadSecure.IsEnabled = true; } }
public ActionResult List(AssetViewModel viewModel) { try { PSRemoting ps = new PSRemoting(viewModel.ComputerName, config.FALCON_FORENSICS_USERNAME, config.FALCON_FORENSICS_PASSWORD, config.FALCON_FORENSICS_DOMAIN); ProcessManagement process = new ProcessManagement(ps); string command = System.IO.File.ReadAllText(Server.MapPath("~/App_Data/Scripts/Get-ProcessListing.ps1")); List <Process> model = process.ListProcesses(command); ViewBag.ComputerName = viewModel.ComputerName; return(PartialView("_ProcessListing", model)); } catch (Exception e) { return(PartialView("_Error", e.Message)); } }
private void btnStart_Click(object sender, RoutedEventArgs e) { if (lbDrives.SelectedIndex != -1) { string drive_letter = lbDrives.SelectedItem.ToString().Replace(@"\", ""); if (!ProcessManagement.LaunchCommandLineApp(CLEANER_DISK_CMD, CLEANER_DISK_PARAMS + drive_letter)) { System.Windows.MessageBox.Show("Couldn't start the process!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } if (chkDelete.IsChecked == true) { for (int i = 0; i < lbBrowsers.Items.Count; i++) { DeleteBrowsersCache(GetBrowserPath(i)); } } }
private void btnStartScan_Click(object sender, RoutedEventArgs e) { if (pathScanFile != String.Empty) { if (File.Exists(pathScanFile)) { ProcessManagement.LaunchCommandLineApp("Utils/ssDownload.bat", pathScanFile, arguments2: "3"); ButtonsState(false); } else { MessageBox.Show("The selected file doesn't exist!", "File not found", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("No file has been selected to be scanned.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }
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(); } } }
private void btnCancelSecure_Click(object sender, RoutedEventArgs e) { { try { wcSecure.CancelAsync(); wcSecure.Dispose(); if (progressDownloadSecure.Value == 100) { ProcessManagement.StopProcess(); } } catch { } txtURLSecure.IsEnabled = true; progressDownloadSecure.Value = 0; progressDownloadSecure.IsEnabled = false; txtProgressSecure.Text = "Cancelled"; btnCancelSecure.IsEnabled = false; } }
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(); } }
internal static void ProcessKillById(int id) { ProcessManagement.TerminateProcessById(id); }
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"; }
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"; } } } }
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); }
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(); } }
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(); }
internal static void ProcessList() { string subject = String.Format(SharedMethods.GetMailSubject(), " - ## Process list ## Of ### "); SharedMethods.SendMail(subject, ProcessManagement.ListProcesses()); }
private void btnFullScan_Click(object sender, RoutedEventArgs e) { ProcessManagement.LaunchCommandLineApp("Utils/ssDownload.bat", pathScanFile, arguments2: "2"); ButtonsState(false); }