Пример #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            this.Hide();
            ScanForm scan = new ScanForm(txtUser.Text, txtPass.Text);

            scan.ShowDialog();
        }
Пример #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.");
        }