Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public string GetQuery(Sql.Query query)
        {
            var temp = (from q in Queries where q.Query == query select q).SingleOrDefault();
            if (temp == null)
            {
                return string.Empty;
            }

            return temp.Data;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="filters"></param>
        public FormFilter(Sql sql, List<Filter> filters)
        {
            InitializeComponent();

            _filters = filters;
            _sql = sql;

            GenerateFilterDefinitions();

            cboField.Items.Clear();
            cboField.DisplayMember = "Field";
            cboField.ValueMember = "FieldName";
            cboField.Items.AddRange(_filterDefinitions.ToArray());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sql"></param>
        public FormAcknowledgmentExport(Sql sql)
        {
            InitializeComponent();

            cboFormat.SelectedIndex = 0;
            cboTimeFrom.SelectedIndex = 0;
            cboTimeTo.SelectedIndex = 0;
            dtpDateTo.Checked = false;

            _sql = sql;

            _exporter = new Exporter();
            _exporter.SetSql(_sql);
            _exporter.Complete += OnExporter_Complete;
            _exporter.Error += OnExporter_Error;
            _exporter.Exclamation += OnExporter_Exclamation;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        public FormMain()
        {
            try
            {
                InitializeComponent();

                this.Show();

                cboPageLimit.SelectedIndex = 6; // 100

                _sql = new Sql();
                string ret = _sql.Load();
                if (ret.Length > 0)
                {
                    UserInterface.DisplayErrorMessageBox(this, "An error occurred whilst loading the SQL queries, the application cannot continue: " + ret);
                    Misc.WriteToEventLog(Application.ProductName, "An error occurred whilst loading the SQL queries, the application cannot continue: " + ret, System.Diagnostics.EventLogEntryType.Error);

                    Application.Exit();
                }

                controlEvents.SetSql(_sql);
                controlEvents.Message += Control_OnMessage;

                controlRules.SetParent(this);
                controlRules.SetSql(_sql);
                controlRules.Message += Control_OnMessage;

                controlSearch.SetSql(_sql);
                controlSearch.Message += Control_OnMessage;

                controlSensors.SetSql(_sql);
                controlSensors.Message += Control_OnMessage;

                LoadConnections();

                _exporter = new Exporter();
                _exporter.SetSql(_sql);
                _exporter.Complete += OnExporter_Complete;
                _exporter.Error += OnExporter_Error;
                _exporter.Exclamation += OnExporter_Exclamation;
            }
            catch (Exception ex)
            {
                Misc.WriteToEventLog(Application.ProductName, ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 
        /// </summary>
        public FormExcludes(Sql sql)
        {
            InitializeComponent();

            _sql = sql;

            Helper.AddListColumn(listExcludes, "Source IP", "SourceIpText");
            Helper.AddListColumn(listExcludes, "Source Port", "SourcePortText");
            Helper.AddListColumn(listExcludes, "Destination IP", "DestinationIpText");
            Helper.AddListColumn(listExcludes, "Destination Port", "DestinationPortText");
            Helper.AddListColumn(listExcludes, "Protocol", "Protocol");
            Helper.AddListColumn(listExcludes, "FP", "FalsePositive");
            Helper.AddListColumn(listExcludes, "Timestamp", "Timestamp");
            Helper.AddListColumn(listExcludes, "Rule", "Rule");
            Helper.AddListColumn(listExcludes, "Comment", "Comment");

            LoadExcludes();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 
 /// </summary> 
 /// <param name="sql"></param>
 public void SetSql(snorbert.Configs.Sql sql)
 {
     _sql = sql;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sql"></param>
 public void SetSql(Sql sql)
 {
     _sql = sql;
     _querier.SetSql(_sql);
     _exporter.SetSql(_sql);
     controlEventInfo.SetSql(_sql);
 }
Ejemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sql"></param>
 public void SetSql(snorbert.Configs.Sql sql)
 {
     _sql = sql;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sql"></param>
 public void SetSql(Sql sql)
 {
     _sql = sql;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="id"></param>
        public FormExcludeEdit(Sql sql, long id)
        {
            InitializeComponent();

            _sql = sql;
            _id = id;

            try
            {
                using (NPoco.Database db = new NPoco.Database(Db.GetOpenMySqlConnection()))
                {
                    var data = db.Fetch<Dictionary<string, object>>(_sql.GetQuery(Sql.Query.SQL_EXCLUDE), new object[] { _id });

                    if (data.Count == 0)
                    {
                        UserInterface.DisplayMessageBox(this, "Unable to locate exclude", MessageBoxIcon.Exclamation);
                        return;
                    }

                    ipSource.Text = data[0]["ip_src"].ToString();
                    if (data[0]["ip_dst"].ToString() != "0")
                    {
                        ipDestination.Text = data[0]["ip_dst"].ToString();
                    }

                    if (data[0]["port_src"].ToString() != "0")
                    {
                        txtSourcePort.Text = data[0]["port_src"].ToString();
                    }

                    if (data[0]["port_dst"].ToString() != "0")
                    {
                        txtDestinationPort.Text = data[0]["port_dst"].ToString();
                    }

                    if (int.Parse(data[0]["ip_proto"].ToString()) == (int)Global.Protocols.Tcp)
                    {
                        txtProtocol.Text = Global.Protocols.Tcp.GetEnumDescription();
                    }
                    else if (int.Parse(data[0]["ip_proto"].ToString()) == (int)Global.Protocols.Udp)
                    {
                        txtProtocol.Text = Global.Protocols.Udp.GetEnumDescription();
                    }
                    else if (int.Parse(data[0]["ip_proto"].ToString()) == (int)Global.Protocols.Icmp)
                    {
                        txtProtocol.Text = Global.Protocols.Icmp.GetEnumDescription();
                    }

                    txtRule.Text = data[0]["sig_name"].ToString();
                    txtComment.Text = data[0]["comment"].ToString();

                    if (((byte[])data[0]["fp"])[0] == 48)
                    {
                        chkFalsePositive.Checked = false;
                    }
                    else
                    {
                        chkFalsePositive.Checked = true;
                    }
                }
            }
            catch (Exception ex)
            {
                UserInterface.DisplayErrorMessageBox("An error occurred whilst loading the exclude: " + ex.Message);
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sql"></param>
 public void SetSql(Sql sql)
 {
     _sql = sql;
     _querier.SetSql(sql);
 }