public override string execute() { try { PayloadCrasher pc = (PayloadCrasher)payload; Process process = pc.process.SelectedProcess; Process crasher = Process.Start(Path.Combine(Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location), "Crasher.exe"), process.Id.ToString()); crasher.WaitForExit(); if (crasher.ExitCode == 0) { return("alert('Thread created successfully. Process should now have been crashed.');"); } else if (crasher.ExitCode == 1) { return("alert('The process is already dead.');"); } else if (crasher.ExitCode == 2) { return("alert('Crashing the process failed.');"); } else if ((crasher.ExitCode & 0x4000000) != 0) { return(string.Format("alert('Failed to open the process handle.\\n\\n Error Code: {0}');", crasher.ExitCode & (~0x4000000))); } else if ((crasher.ExitCode & 0x8000000) != 0) { return(string.Format("alert('Failed to create the thread.\\n\\n Error Code: {0}');", crasher.ExitCode & (~0x8000000))); } } catch (Exception) // Very crappy exception handling { return("alert('Crashing the process failed.');"); } return("void(0);"); }
public override string execute() { PayloadCrasher pc = (PayloadCrasher)payload; Process process = pc.process.SelectedProcess; try { if (process.HasExited) { return("alert('The process is already dead.');"); } process.Kill(); return("alert('The process has been killed successfully.');"); } catch (Exception) { return("alert('Failed to kill the Process.');"); } }