public ActionResult StartCollection(string Id, bool File, bool Port, bool Service, bool User, bool Registry, bool Certificates)
        {
            CollectCommandOptions opts = new CollectCommandOptions();

            opts.RunId = Id.Trim();
            opts.EnableFileSystemCollector  = File;
            opts.EnableNetworkPortCollector = Port;
            opts.EnableServiceCollector     = Service;
            opts.EnableRegistryCollector    = Registry;
            opts.EnableUserCollector        = User;
            opts.EnableCertificateCollector = Certificates;
            opts.DatabaseFilename           = "asa.sqlite";
            opts.FilterLocation             = "Use embedded filters.";

            Dictionary <string, bool> dict = new Dictionary <string, bool>();

            foreach (BaseCollector c in AttackSurfaceAnalyzerCLI.GetCollectors())
            {
                // The GUI *should* prevent us from getting here. But this is extra protection.
                // We won't start new collections while existing ones are ongoing.
                if (c.IsRunning() == RUN_STATUS.RUNNING)
                {
                    return(Json(ERRORS.ALREADY_RUNNING));
                }
            }
            AttackSurfaceAnalyzerCLI.ClearCollectors();
            string Select_Runs = "select run_id from runs where run_id=@run_id";

            using (var cmd = new SqliteCommand(Select_Runs, DatabaseManager.Connection, DatabaseManager.Transaction))
            {
                cmd.Parameters.AddWithValue("@run_id", Id);
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        return(Json(ERRORS.UNIQUE_ID));
                    }
                }
            }

            Task.Factory.StartNew <int>(() => AttackSurfaceAnalyzerCLI.RunCollectCommand(opts));
            return(Json(ERRORS.NONE));
        }
        public ActionResult GetCollectors()
        {
            Dictionary <string, RUN_STATUS> dict = new Dictionary <string, RUN_STATUS>();
            string RunId = AttackSurfaceAnalyzerCLI.GetLatestRunId();

            //TODO: Improve this to not have to change this variable on every loop, without having to call GetCollectors twice.
            foreach (BaseCollector c in AttackSurfaceAnalyzerCLI.GetCollectors())
            {
                var fullString = c.GetType().ToString();
                var splits     = fullString.Split('.');
                dict.Add(splits[splits.Count() - 1], c.IsRunning());
            }
            Dictionary <string, object> output = new Dictionary <string, object>();

            output.Add("RunId", RunId);
            output.Add("Runs", dict);
            //@TODO: Also return the RunId
            return(Json(JsonConvert.SerializeObject(output)));
        }