Exemplo n.º 1
0
 //DETAILED VULNERABILITIES
 private void deleteVuln_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 0)
     {
         MessageBox.Show("Please select a row to remove.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else
     {
         DataGridViewSelectedRowCollection collection = dataGridView1.SelectedRows;
         foreach (DataGridViewRow gvr in collection)
         {
             object obj = gvr.DataBoundItem;
             if (null != obj)
             {
                 if (obj is Vulnerability)
                 {
                     Vulnerability v = obj as Vulnerability;
                     if (null != v)
                     {
                         Vulnerabilities.RemoveItem(v);
                         bindGrid(null);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private void newMenuItem1_Click(object sender, EventArgs e)
 {
     //TODO These methods won't work for clearing the data. Doh.
     projectHelper.Clear();
     staticCodeAnalysisData.DataSource = null;
     notesDataView.DataSource          = null;
     penTesterDataView.DataSource      = null;
     ddlProjects.Items.Clear();
     isso.Text              = string.Empty;
     developmentLead.Text   = string.Empty;
     productionUrlText.Text = string.Empty;
     SetTimePickers();
     codeScanned.Checked  = false;
     scanTypeNone.Checked = true;
     repository.Text      = string.Empty;
     ClearLanguages();
     Vulnerabilities.Clear();
 }
Exemplo n.º 3
0
        private void addIssueButton_Click(object sender, EventArgs e)
        {
            ProjectPOCO project = projectHelper.GetCurrentProject(ddlProjects.Text);

            if (null == project)
            {
                ShowError("No project found.");
                return;
            }
            bool     isUpdate = false;
            ModTypes t        = ModTypes.Add;

            DateTime       outCompleteDate;
            DateTime       outDiscoveredDate;
            Decimal        cvss = 0;
            IVulnerability vuln = new Vulnerability();

            vuln.Identifier = Guid.NewGuid();
            if (sender is Button)
            {
                Button localB = sender as Button;
                if (null != localB)
                {
                    isUpdate = localB.Text == "Save" ? true : false;
                    if (isUpdate)
                    {
                        t = ModTypes.Update;
                        vuln.Identifier = EditGuid;
                    }
                    else
                    {
                        t = ModTypes.Add;
                    }
                }
            }
            if (Decimal.TryParse(cvssDataText.Text, out cvss))
            {
                vuln.CVSS = cvss;
            }
            else
            {
                MessageBox.Show("Value was not a decimal.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (DateTime.TryParse(completeDateInput.Text, out outCompleteDate))
            {
                vuln.CompletedDate = outCompleteDate;
            }
            else
            {
                vuln.CompletedDate = null;
            }

            if (DateTime.TryParse(discoveredDate.Text, out outDiscoveredDate))
            {
                vuln.DiscoveredDate = outDiscoveredDate;
            }
            else
            {
                vuln.DiscoveredDate = null;
            }

            string title     = vulnTitle.Text;
            string status    = statusInput.Text;
            string risklevel = riskLevelInput.Text;
            string details   = vulnerabilityInput.Text;

            if (status != "Not An Issue" || status != "Fixed")
            {
                vuln.CompletedDate = null;
            }
            vuln.Title            = title;
            vuln.VulnTypeReported = vulnTypeItems.SelectedItem.ToString();
            vuln.Status           = status;
            vuln.Risk             = risklevel;
            vuln.Details          = details;
            vuln.Tester           = penTesterDiscover.SelectedItem.ToString();


            vuln.isWeeklyReportItem = isForUpdate.Checked;
            Vulnerabilities.AddObject(vuln);

            projectHelper.ModifyVulnerabilityAnalysis(t, ddlProjects.Text, vuln);
            if (ModTypes.Update == t)
            {
                dataGridView1.CellContentClick += dataGridView1_CellContentClick;
            }
            bindGrid(project);
            ClearVulnForm();
        }