예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }