Ejemplo n.º 1
0
        public ExceptionForm()
        {
            NexposeAPIFetcher nexpose = new NexposeAPIFetcher(username, password);

            siteList = nexpose.getSites();
            List <String> exceptions = new List <String>();

            exceptions.Add("False Positive");
            exceptions.Add("Acceptable Use");
            exceptions.Add("Acceptable Risk");
            exceptions.Add("Compensating Control");
            InitializeComponent();
            expDate.CustomFormat        = "yyyy MM dd HH mm ss";
            cmbExceptionType.DataSource = exceptions.ToList();
            Dictionary <string, string> sortedSites = new Dictionary <string, string>();
            var list = siteList.Keys.ToList();

            list.Sort();
            foreach (var key in list)
            {
                sortedSites.Add(key, siteList[key]);
            }
            cmbSiteSelect.DataSource = sortedSites.Keys.ToList();
            cmbSiteSelect.Size       = new System.Drawing.Size(220, 21);
            cmbSiteSelect.Refresh();
            cmbExceptionType.Refresh();
            expDate.Refresh();
        }
Ejemplo n.º 2
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            var               vulnid          = vulns.Where(i => i.title == cmbVulnTitle.Text).FirstOrDefault().id;
            string            exp             = expDate.Value.Year.ToString() + "-" + expDate.Value.Month.ToString().PadLeft(2, '0') + "-" + expDate.Value.Day.ToString().PadLeft(2, '0');
            string            comment         = "Please reference " + txtTicket.Text.ToString() + ". " + cmbExceptionType.SelectedValue.ToString() + " requests in the attached form are approved as reported. Requested by " + txtRequestor.Text;
            List <string>     ips             = new List <string>();
            NexposeAPIFetcher nexpose         = new NexposeAPIFetcher(username, password);
            List <Device>     devices         = nexpose.siteDeviceList(siteList[cmbSiteSelect.SelectedValue.ToString()]);
            List <string>     exceptedDevices = new List <string>();
            List <string>     successes       = new List <string>();

            foreach (string line in txtIps.Lines)
            {
                ips.Add(line);
            }
            foreach (string ip in ips)
            {
                foreach (Device device in devices)
                {
                    if (ip == device.ip)
                    {
                        exceptedDevices.Add(device.id);
                        break;
                    }
                }
            }
            foreach (String asset in exceptedDevices)
            {
                //nexpose.approveException(nexpose.createException(asset, txtVulnID.Text, cmbExceptionType.SelectedValue.ToString(), comment),comment, exp);
                nexpose.createException(asset, vulnid, cmbExceptionType.SelectedValue.ToString(), comment);
            }
            ScanForm scan = new ScanForm("user", "pass");

            scan.showConfirmation("Exception requests sent to Nexpose.");
        }
Ejemplo n.º 3
0
        public ScanForm()
        {
            var templateList = new List <string>();

            //Add your templates here. replace spaces with dashes, replace dashes with underscores.
            templateList.Add("test-_-template");
            cmbTemplate.DataSource         = templateList.ToList();
            cmbTemplate.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cmbTemplate.AutoCompleteSource = AutoCompleteSource.ListItems;

            NexposeAPIFetcher nexpose = new NexposeAPIFetcher(username, password);

            token = nexpose.getToken();
            sites = nexpose.getSites();
            Dictionary <string, string> sortedSites = new Dictionary <string, string>();
            var list = sites.Keys.ToList();

            list.Sort();
            foreach (var key in list)
            {
                sortedSites.Add(key, sites[key]);
            }
            InitializeComponent();
            cmbSelectSite.DataSource = sortedSites.Keys.ToList();
            cmbSelectSite.Size       = new System.Drawing.Size(220, 21);
            dtpscanTime.Format       = DateTimePickerFormat.Custom;
            dtpscanTime.CustomFormat = "yyyy MM dd HH mm ss";
            cmbSelectSite.Refresh();
            dtpscanTime.Refresh();
        }
Ejemplo n.º 4
0
        public ExceptionForm(string _username, string _password)
        {
            this.username = _username;
            this.password = _password;
            InitializeComponent();
            NexposeAPIFetcher nexpose = new NexposeAPIFetcher(username, password);

            vulns = nexpose.getVulnerabilities();
            cmbVulnTitle.DataSource         = vulns.Select(f => f.title).ToList();
            cmbVulnTitle.AutoCompleteSource = AutoCompleteSource.ListItems;
            cmbVulnTitle.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            siteList = nexpose.getSites();
            List <String> exceptions = new List <String>();

            exceptions.Add("False Positive");
            exceptions.Add("Acceptable Use");
            exceptions.Add("Acceptable Risk");
            exceptions.Add("Compensating Control");
            expDate.CustomFormat                = "yyyy MM dd HH mm ss";
            cmbExceptionType.DataSource         = exceptions.ToList();
            cmbExceptionType.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cmbExceptionType.AutoCompleteSource = AutoCompleteSource.ListItems;

            Dictionary <string, string> sortedSites = new Dictionary <string, string>();
            var list = siteList.Keys.ToList();

            list.Sort();
            foreach (var key in list)
            {
                sortedSites.Add(key, siteList[key]);
            }
            cmbSiteSelect.DataSource = sortedSites.Keys.ToList();
            cmbSiteSelect.Size       = new System.Drawing.Size(220, 21);
            cmbSiteSelect.Refresh();
            cmbSiteSelect.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cmbSiteSelect.AutoCompleteSource = AutoCompleteSource.ListItems;
            cmbExceptionType.Refresh();
            expDate.Refresh();
        }