Example #1
0
        public ActionResult StartMonitoring(string RunId, string Directory)
        {
            if (RunId != null)
            {
                if (DatabaseManager.GetRun(RunId) != null)
                {
                    return(Json(ASA_ERROR.UNIQUE_ID));
                }

                var run = new AsaRun(RunId: RunId, Timestamp: DateTime.Now, Version: AsaHelpers.GetVersionString(), Platform: AsaHelpers.GetPlatform(), new List <RESULT_TYPE>()
                {
                    RESULT_TYPE.FILEMONITOR
                }, RUN_TYPE.MONITOR);
                DatabaseManager.InsertRun(run);

                MonitorCommandOptions opts = new MonitorCommandOptions
                {
                    RunId = RunId,
                    EnableFileSystemMonitor = true,
                    MonitoredDirectories    = Directory,
                    Verbose = Logger.Verbose,
                    Debug   = Logger.Debug,
                    Quiet   = Logger.Quiet
                };
                AttackSurfaceAnalyzerClient.ClearMonitors();
                return(Json((int)AttackSurfaceAnalyzerClient.RunGuiMonitorCommand(opts)));
            }
            return(Json(-1));
        }
Example #2
0
        public ActionResult StartMonitoring(string RunId, string Directory)
        {
            if (RunId != null)
            {
                if (DatabaseManager.GetRun(RunId) != null)
                {
                    return(Json(GUI_ERROR.UNIQUE_ID));
                }

                DatabaseManager.InsertRun(RunId, new Dictionary <RESULT_TYPE, bool>()
                {
                    { RESULT_TYPE.FILEMONITOR, true }
                });

                MonitorCommandOptions opts = new MonitorCommandOptions
                {
                    RunId = RunId,
                    EnableFileSystemMonitor = true,
                    MonitoredDirectories    = Directory,
                    FilterLocation          = "filters.json"
                };
                AttackSurfaceAnalyzerClient.ClearMonitors();
                return(Json((int)AttackSurfaceAnalyzerClient.RunGuiMonitorCommand(opts)));
            }
            return(Json(-1));
        }
Example #3
0
        public ActionResult StartMonitoring(string RunId, string Directory, string Extension)
        {
            if (RunId != null)
            {
                using (var cmd = new SqliteCommand(INSERT_RUN, DatabaseManager.Connection, DatabaseManager.Transaction))
                {
                    cmd.Parameters.AddWithValue("@run_id", RunId.Trim());
                    cmd.Parameters.AddWithValue("@file_system", true);
                    cmd.Parameters.AddWithValue("@ports", false);
                    cmd.Parameters.AddWithValue("@users", false);
                    cmd.Parameters.AddWithValue("@services", false);
                    cmd.Parameters.AddWithValue("@registry", false);
                    cmd.Parameters.AddWithValue("@certificates", false);
                    cmd.Parameters.AddWithValue("@firewall", false);
                    cmd.Parameters.AddWithValue("@comobjects", false);
                    cmd.Parameters.AddWithValue("@type", "monitor");
                    cmd.Parameters.AddWithValue("@timestamp", DateTime.Now.ToString("o", CultureInfo.InvariantCulture));
                    cmd.Parameters.AddWithValue("@version", AsaHelpers.GetVersionString());
                    cmd.Parameters.AddWithValue("@platform", AsaHelpers.GetPlatformString());
                    try
                    {
                        cmd.ExecuteNonQuery();
                        DatabaseManager.Commit();
                    }
                    catch (SqliteException e)
                    {
                        Log.Warning(e.StackTrace);
                        Log.Warning(e.Message);
                        return(Json((int)GUI_ERROR.UNIQUE_ID));
                    }
                }

                MonitorCommandOptions opts = new MonitorCommandOptions
                {
                    RunId = RunId,
                    EnableFileSystemMonitor = true,
                    MonitoredDirectories    = Directory,
                    FilterLocation          = "filters.json"
                };
                AttackSurfaceAnalyzerClient.ClearMonitors();
                return(Json((int)AttackSurfaceAnalyzerClient.RunGuiMonitorCommand(opts)));
            }
            return(Json(-1));
        }