public static void ExecutePythonScriptDirty(string sampleFile) { string pythonFile = @"C:\Users\Derek\source\pyrepo\YaraPlay.py"; string pythonArgs = "-f " + sampleFile; string output = PythonScript.ExecutePythonScript(pythonFile, pythonArgs); Console.WriteLine(output); }
public static void ExecutePythonScriptNoMatches(string sampleFile) { string pythonFile = @"..\..\..\..\PythonScripts\yara_script.py"; string pythonArgs = "-f " + sampleFile; string foutput = PythonScript.ExecutePythonScript(pythonFile, pythonArgs).Replace("\r", ""); string doutput = "\tScanning file: " + sampleFile.Replace("\"", "") + "\n\tNo matches.\n"; Console.WriteLine(foutput); Assert.AreEqual(doutput, foutput); }
public static void ExecutePythonScriptTestBadPaths(string sampleFile) { string pythonFile = @"..\..\..\..\PythonScripts\yara_script.py"; //string sampleFile = "\"C:\\Users\\Derek\\OneDrive\\Documents\\CSC205\\ProjectTestFiles\\COVID-19 Precautions.txt\""; //Note filenames with spaces must be encapsulated sufficienctly //string sampleFile = "\""+@"..\..\..\..\ProjectTestFiles\COVID-19 Precautions.txt" +"\""; string pythonArgs = "-f " + sampleFile; string foutput = PythonScript.ExecutePythonScript(pythonFile, pythonArgs).Replace("\r", ""); string doutput = "\tScanning file: " + sampleFile.Replace("\"", "") + "\n\tError scanning file.\n"; Console.WriteLine(foutput); Assert.AreEqual(doutput, foutput); }