public void RunTests(SetupData setupData) { Starting(); var args = String.Format("-B -u -m unittest discover -v {0} {1}", setupData.TestSubFolder, setupData.TestFileSpec); var startInfo = new ProcessStartInfo { UseShellExecute = false, RedirectStandardError = true, CreateNoWindow = true, FileName = setupData.PythonPath, Arguments = args, WorkingDirectory = setupData.ProjectFolder }; Debug.WriteLine(startInfo.ToString()); using (var python = new Process { StartInfo = startInfo }) { python.Start(); _testResultParser.Parse(python.StandardError, TestResultReady, TestResultDetailsReady); } Finished(); }
public static void StartZAPDaemon() { Console.WriteLine("Trying to StartZAPDaemon"); ProcessStartInfo zapProcessStartInfo = new ProcessStartInfo(); zapProcessStartInfo.FileName = @"C:\Program Files (x86)\OWASP\Zed Attack Proxy\ZAP.exe"; zapProcessStartInfo.WorkingDirectory = @"C:\Program Files (x86)\OWASP\Zed Attack Proxy"; zapProcessStartInfo.Arguments = "-daemon -host 127.0.0.1 -port 7070"; Console.WriteLine("Issuing command to StartZAPDaemon"); Console.WriteLine(zapProcessStartInfo.ToString()); Process zap = Process.Start(zapProcessStartInfo); //Sleep(120000); //you can choose to wait for 2 minutes and bet that ZAP has started CheckIfZAPHasStartedByPollingTheAPI(1); //you can try accessing an API and ensure ZAP has fully initialized }
// Since the Windows XP does not support the multiple default gateway. // In order to make the Ethernet can be access via its default gateway, we need to add the gateway into the route table. // For more information, plesae refer to the KB article. // http://support.microsoft.com/kb/159168 private static void AddRoute(string gateway, string destination) { ProcessStartInfo startInfo = new ProcessStartInfo("route"); startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.Arguments = string.Format(" add {0} mask 255.255.255.255 {1}", destination, gateway); startInfo.Verb = "runas"; string commandline = startInfo.ToString(); MessageBox.Show("Executing: route " + startInfo.Arguments); Process p = Process.Start(startInfo); p.WaitForExit(); int exitCode = p.ExitCode; if (exitCode != 0) { MessageBox.Show("hmm .. exitCode " + exitCode+ " (whatever that means)"); } }