示例#1
0
        static void Main(string[] args)
        {
            bool hideConsole = false;

            if (args.Contains("-noconsole"))
            {
                hideConsole = true;
                args        = args.Where(a => a != "-noconsole").ToArray();
            }

            if (args.Contains("-nc"))
            {
                hideConsole = true;
                args        = args.Where(a => a != "-nc").ToArray();
            }

            var arguments = new List <string>();

            arguments.Add(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cscs.dll"));
            arguments.AddRange(args);

            var combinedArgs = arguments.Select(x => (x.Contains(" ") || x.Contains("\t")) ? $"\"{x}\"" : x)
                               .ToArray();

            // ScriptLauncher.ShowConsole(); // interferes with Conspole.ReadKey

            if (hideConsole)
            {
                ScriptLauncher.HideConsole();
            }

            ScriptLauncher.Run("dotnet", string.Join(" ", combinedArgs));
        }
示例#2
0
 protected override void InitializeCore()
 {
     Config = new XssScanConfig()
     {
         FuzzStrings = ScriptLauncher.LoadTestCases(ScriptResult)
     };
 }
    // Use this for initialization
    void Start()
    {
        m_ScriptLauncher1 = m_Launcher1.GetComponent <ScriptLauncher>();
        m_ScriptLauncher2 = m_Launcher2.GetComponent <ScriptLauncher>();
        m_ScriptLauncher3 = m_Launcher3.GetComponent <ScriptLauncher>();



        PrepareforLaunch();
    }
示例#4
0
        static void Main(string[] args)
        {
            // Environment.SetEnvironmentVariable("CSS_WINAPP", "true", EnvironmentVariableTarget.User);
            Environment.SetEnvironmentVariable("Console.WindowWidth", Console.WindowWidth.ToString());
            Environment.SetEnvironmentVariable("ENTRY_ASM", Assembly.GetExecutingAssembly().GetName().Name);
            bool hideConsole = false;
            bool winApp      = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CSS_WINAPP"));

            if (args.Contains("-win"))
            {
                winApp = true;
                args   = args.Where(x => x != "-win").ToArray();
            }

            if (args.Contains("-noconsole") || args.Contains("-nc"))
            {
                hideConsole = true;
                args        = args.Where(a => a != "-noconsole" && a != "-nc").ToArray();
            }

            var host      = "dotnet";
            var arguments = new List <string>(args);

            if (ConfiguredFullDotNetLauncher != null)
            {
                if (Environment.OSVersion.IsWin())
                {
                    host = ConfiguredFullDotNetLauncher;
                }
                else
                {
                    host = "mono";
                    arguments.Insert(0, ConfiguredFullDotNetLauncher);
                }
            }
            else
            {
                host = "dotnet";
                var engine = "cscs.dll";
                if (winApp)
                {
                    engine = "csws.dll";
                }
                arguments.Insert(0, Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), engine));
            }

            // ScriptLauncher.ShowConsole(); // interferes with Conspole.ReadKey

            if (hideConsole)
            {
                ScriptLauncher.HideConsole();
            }

            ScriptLauncher.Run(host, arguments.ToCmdArgs());
        }
示例#5
0
        internal void LaunchScript(ScriptLauncher launcher, FrameContext callingFrameContext, string runId, Action <bool> onComplete)
        {
            if (launcher == null ||
                launcher.ScriptReference == null ||
                launcher.ScriptReference.ObjectId == null)
            {
                if (onComplete != null)
                {
                    onComplete(false);
                }

                return;
            }

            var script = GetScript(launcher.ScriptReference.ObjectId);

            if (script == null)
            {
                if (onComplete != null)
                {
                    onComplete(false);
                }

                return;
            }

            var key = GetScriptRunId(script.Id, runId);

            if (m_runningProcessors.ContainsKey(key))
            {
                // Can only run one instance at a time with this implementation.
                // It is entirely possible to run the same script with multiple
                // script processors as long as they have different state files.
                if (onComplete != null)
                {
                    onComplete(false);
                }

                return;
            }

            // Store script state in its own directory so we can reset all
            // scripts easily.
            var folderName = callingFrameContext.ScriptContext.GetCompactId(launcher.Id);

            var stateMgr = callingFrameContext.ScriptContext.StorageManager.GetManager(folderName);

            var proc = new ScriptProcessor(launcher, callingFrameContext, script, stateMgr, runId);

            proc.HandlingError += Proc_HandlingError;

            m_runningProcessors[key] = proc;

            proc.Run(null, onComplete);
        }
示例#6
0
        static void Main(string[] args)
        {
            var arguments = new List <string>();

            arguments.Add(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cscs.dll"));
            arguments.AddRange(args);

            var combinedArgs = arguments.Select(x => (x.Contains(" ") || x.Contains("\t")) ? $"\"{x}\"" : x)
                               .ToArray();

            ScriptLauncher.Run("dotnet", string.Join(" ", combinedArgs));
        }
        protected AphidObject ExecuteScript()
        {
            string name = GetType().Name;

            name = Regex.Replace(name, @"ScanPlugin$", "", RegexOptions.IgnoreCase);

            var filename = ".\\ScanPlugins\\" + name + ".alx";

            WasScriptCached = ScriptLauncher.IsExecuteCached(filename);

            return(ScriptLauncher.Execute(filename));
        }
示例#8
0
        public void Prepare()
        {
            Console.WriteLine("");
            Console.WriteLine("Preparing for test...");
            Console.WriteLine("");

            new FilesGrabber(
                OriginalDirectory,
                WorkingDirectory
                ).GrabOriginalFiles();

            var scriptLauncher = new ScriptLauncher();

            // TODO: See if there's a faster way to prepare
            scriptLauncher.Launch("EnsureBuild", "-mode:" + BuildMode.Value);
            scriptLauncher.Launch("Repack", "-mode:" + BuildMode.Value);
            scriptLauncher.Launch("CopyBinToLib", "-mode:" + BuildMode.Value);
            scriptLauncher.Launch("CopyBinToRoot", "-mode:" + BuildMode.Value);
        }
        protected override void InitializeCore()
        {
            _traversalSequences = ScriptLauncher.LoadTestCases(ScriptResult);

            try
            {
                WriteProbe();
            }
            catch (System.Exception)
            {
                ScannerCli.DisplayCriticalMessageAndExit("Could not create LFI probe. Please run PHPVH as administrator.");
            }

            var path = new DirectoryInfo(Program.Config.WebRoot).Root.ToString();

            watcher                     = new FileSystemWatcher(path);
            watcher.Changed            += watcher_FileSystemEvent;
            watcher.Created            += watcher_FileSystemEvent;
            watcher.Deleted            += watcher_FileSystemEvent;
            watcher.EnableRaisingEvents = true;
        }
示例#10
0
        static void Main(string[] args)
        {
            Environment.SetEnvironmentVariable("Console.WindowWidth", Console.WindowWidth.ToString());
            bool hideConsole = false;

            if (args.Contains("-noconsole") || args.Contains("-nc"))
            {
                hideConsole = true;
                args        = args.Where(a => a != "-noconsole" && a != "-nc").ToArray();
            }

            if (args.ParseValuedArg("runtime", "rt", out string value))
            {
                var full_env = Environment.OSVersion.IsWin() ? ".NET" : "Mono";

                args = args.Where(a => !(a.StartsWith("-engine") || a.StartsWith("-eng"))).ToArray();
                if (value == null)
                {
                    if (args.Contains("?") || args.Contains("help"))
                    {
                        Console.WriteLine("-rt|-runtime[:<core|net>]\n" +
                                          "    Sets the execution engine to .NET Core or the full version of .NET/Mono.");
                    }
                    else
                    {
                        if (File.Exists(RedirectFileName))
                        {
                            Console.WriteLine($"The execution engine is set to {full_env}");
                        }
                        else
                        {
                            Console.WriteLine($"The execution engine is set to .NET Core");
                        }
                    }
                }
                else
                {
                    switch (value.ToLower())
                    {
                    case "net":
                        File.WriteAllText(RedirectFileName, "");
                        Console.WriteLine($"The execution engine is set to {full_env}");
                        break;

                    case "core":
                        if (File.Exists(RedirectFileName))
                        {
                            File.Delete(RedirectFileName);
                        }
                        Console.WriteLine($"The execution engine is set to .NET Core");
                        break;
                    }
                }
                return;
            }

            var host      = "dotnet";
            var arguments = new List <string>(args);

            if (ConfiguredFullDotNetLauncher != null)
            {
                if (Environment.OSVersion.IsWin())
                {
                    host = ConfiguredFullDotNetLauncher;
                }
                else
                {
                    host = "mono";
                    arguments.Insert(0, ConfiguredFullDotNetLauncher);
                }
            }
            else
            {
                host = "dotnet";
                arguments.Insert(0, Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cscs.dll"));
            }

            // ScriptLauncher.ShowConsole(); // interferes with Conspole.ReadKey

            if (hideConsole)
            {
                ScriptLauncher.HideConsole();
            }

            ScriptLauncher.Run(host, arguments.ToCmdArgs());
        }
 public HelloWorldScriptLauncher()
 {
     Launcher = new ScriptLauncher();
 }
    // Use this for initialization
    void Start()
    {
        m_ScriptLauncher1 = m_Launcher1.GetComponent<ScriptLauncher>();
        m_ScriptLauncher2 = m_Launcher2.GetComponent<ScriptLauncher>();
        m_ScriptLauncher3 = m_Launcher3.GetComponent<ScriptLauncher>();

        PrepareforLaunch();
    }