diff --git a/inc/database.inc b/inc/database.inc index 6c4d56c..6d2e50f 100644 --- a/inc/database.inc +++ b/inc/database.inc @@ -4269,13 +4269,13 @@ class db public function get_Finding_Count_By_Status($cat_id, $status, $cat = null, $ctrl = null) { $joins = [ - "LEFT JOIN sagacity.target_checklist tc ON t.id=tc.tgt_id", - "LEFT JOIN sagacity.pdi_checklist_lookup pcl ON pcl.checklist_id=tc.chk_id", - "LEFT JOIN sagacity.findings f ON f.pdi_id=pcl.pdi_id AND t.id=f.tgt_id", - "LEFT JOIN sagacity.findings_status fs ON fs.id=f.findings_status_id" + "JOIN target_checklist tc ON t.id = tc.tgt_id", + "JOIN pdi_checklist_lookup pcl ON pcl.checklist_id = tc.chk_id", + "LEFT JOIN findings f ON f.pdi_id = pcl.pdi_id AND t.id = f.tgt_id", + "LEFT JOIN findings_status fs ON fs.id = f.findings_status_id" ]; if (!is_null($ctrl)) { - $joins[] = "JOIN `sagacity`.`finding_controls` fc ON fc.`finding_id`=f.`id`"; + $joins[] = "JOIN finding_controls fc ON fc.finding_id = f.id"; } $where = [ @@ -4323,20 +4323,20 @@ class db } $field = ($status == 'Not Reviewed' ? "COUNT(DISTINCT(pcl.pdi_id)) AS 'count'" : "COUNT(DISTINCT(f.id)) AS 'count'"); - $this->help->select_count("sagacity.target t", $where, ['table_joins' => $joins]); + $this->help->select_count("target t", $where, ['table_joins' => $joins]); $this->help->sql = str_replace("COUNT(1) AS 'count'", $field, $this->help->sql); $cnt = $this->help->execute(); $joins = [ - "LEFT JOIN sagacity.pdi_checklist_lookup pcl ON pcl.checklist_id=c.id", - "LEFT JOIN sagacity.findings f ON f.pdi_id=pcl.pdi_id", - "LEFT JOIN sagacity.findings_status fs ON f.findings_status_id=fs.id", - "JOIN sagacity.target t ON t.id=f.tgt_id" + "JOIN pdi_checklist_lookup pcl ON pcl.checklist_id = c.id", + "JOIN findings f ON f.pdi_id = pcl.pdi_id", + "LEFT JOIN findings_status fs ON f.findings_status_id = fs.id", + "JOIN target t ON t.id = f.tgt_id" ]; if (!is_null($ctrl) && is_a($ctrl, 'proc_ia_controls')) { - $joins[] = "JOIN sagacity.finding_controls fc ON fc.finding_id=f.id"; + $joins[] = "JOIN finding_controls fc ON fc.finding_id = f.id"; } $where = [ @@ -4388,7 +4388,7 @@ class db ]; } - $this->help->select_count("sagacity.checklist c", $where, array('table_joins' => $joins)); + $this->help->select_count("checklist c", $where, array('table_joins' => $joins)); $this->help->sql = str_replace("COUNT(1) AS 'count'", $field, $this->help->sql); $cnt += $this->help->execute(); @@ -8404,8 +8404,11 @@ class db } if ($del_tgts) { + /** + * @var host_list $host + */ foreach ($scan->get_Host_List() as $host) { - $this->delete_Target($host->targetId); + $this->delete_Target($host->getTargetId()); } } @@ -9845,6 +9848,7 @@ class db } /** + * Method to retrieve the category count data from the database for a specific category * * @param ste_cat $cat */ @@ -9854,12 +9858,14 @@ class db if($cat->get_ID()) { $where[] = [ 'field' => 'cat_id', + 'op' => '=', 'value' => $cat->get_ID() ]; } else { $where[] = [ 'field' => 'ste_id', + 'op' => '=', 'value' => $cat->get_STE_ID() ]; } @@ -11343,8 +11349,8 @@ class db ] ], [ 'table_joins' => [ - "LEFT JOIN target_checklist tc ON tc.tgt_id = t.id", - "LEFT JOIN pdi_checklist_lookup pcl ON tc.chk_id = pcl.checklist_id", + "JOIN target_checklist tc ON tc.tgt_id = t.id", + "JOIN pdi_checklist_lookup pcl ON tc.chk_id = pcl.checklist_id", "LEFT JOIN findings f ON f.tgt_id = t.id AND f.pdi_id = pcl.pdi_id", "LEFT JOIN findings_status fs ON f.findings_status_id = fs.id" ], @@ -11382,6 +11388,7 @@ class db $na += $row['finding_count']; break; case 'Not Reviewed': + case 'No Data': $nr += $row['finding_count']; break; case 'Open': @@ -11566,11 +11573,17 @@ class db if (!$tgt->is_PP_Suspended()) { $this->post_Processing($tgt->get_ID()); } + else { + $this->update_Target_Counts($tgt->get_ID()); + } } else { if ($pp === true) { $this->post_Processing($tgt->get_ID()); } + else { + $this->update_Target_Counts($tgt->get_ID()); + } } $this->help->replace("target_net_meta", [ diff --git a/results/index.php b/results/index.php index 3d41f76..297e6b9 100644 --- a/results/index.php +++ b/results/index.php @@ -55,27 +55,21 @@ set_time_limit(120); $db = new db(); -$sources = $db->get_Sources(); -$task_status = $db->get_Task_Statuses(); - $ste_id = filter_input(INPUT_POST, 'ste', FILTER_VALIDATE_INT); -if (!$ste_id) { +if (! $ste_id) { $ste_id = filter_input(INPUT_COOKIE, 'ste', FILTER_VALIDATE_INT); } -$status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING); -$type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING); -$scans = []; +$status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING); +$type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING); +$scans = []; if ($type != 'all' && $status != 'all') { $scans = $db->get_ScanData($ste_id, null, $status, $type); -} -elseif ($type != 'all') { +} elseif ($type != 'all') { $scans = $db->get_ScanData($ste_id, null, null, $type); -} -elseif ($status != 'all') { +} elseif ($status != 'all') { $scans = $db->get_ScanData($ste_id, null, $status); -} -elseif (isset($ste_id)) { +} elseif (isset($ste_id)) { $scans = $db->get_ScanData($ste_id); } @@ -86,76 +80,81 @@ $stes = $db->get_STE();
-

Do you want to delete the associated targets?


-

WARNING: This will delete ALL targets in this scan and all associated data even if it was imported from another scan. This action is irreversible

+

+ Do + you want to delete the associated targets? +

+
+

WARNING: This will delete ALL targets in this scan and all + associated data even if it was imported from another scan. This + action is irreversible

-

Are you sure you want to delete this scan?

+

+ Are + you sure you want to delete this scan? +

diff --git a/results/results_script.js b/results/results_script.js index 2b55e2d..8c71d0a 100644 --- a/results/results_script.js +++ b/results/results_script.js @@ -66,11 +66,3 @@ function add_import() { $('#import').css('display', 'block'); view_box(); } - -function del_scan(form) { - if ($('#toggle_refresh').val() == 'Stop Refresh') { - clearTimeout(to); - to = null; - } - $('#delete-target-confirm').dialog('open'); -} diff --git a/results/results_script.min.js b/results/results_script.min.js index 4dd1b3f..32a8db6 100644 --- a/results/results_script.min.js +++ b/results/results_script.min.js @@ -1,2 +1,2 @@ - -$(function(){$(".close, .backdrop").click(function(){close_box()})});function List_host(a){$("#host_list_frame").attr("src","host_list_iframe.php?ste="+$("#ste").val()+"&scan_id="+a);$("#host_list_div").animate({opacity:"1.00"},300,"linear");$("#host_list_div").css("display","block");view_box()}function close_box(){$(".backdrop, .box").animate({opacity:"0"},300,"linear",function(){$(".backdrop, .box").css("display","none")});$(".dz-complete").remove();$(".dz-message").show()}function view_box(){$(".backdrop").animate({opacity:".5"},300,"linear");$(".backdrop").css("display","block")}function add_import(){if($("#ste").val()<1){alert("Please select an ST&E");return}$("#add_import").val($("#ste").val());$("#import").animate({opacity:"1.00"},300,"linear");$("#import").css("display","block");view_box()}function del_scan(a){if($("#toggle_refresh").val()=="Stop Refresh"){clearTimeout(to);to=null}$("#delete-target-confirm").dialog("open")}; \ No newline at end of file +$(function(){$(".close, .backdrop").click(function(){close_box();});});function List_host(scan_id){$("#host_list_frame").attr("src","host_list_iframe.php?ste="+$("#ste").val()+"&scan_id="+scan_id);$("#host_list_div").animate({"opacity":"1.00"},300,"linear");$("#host_list_div").css("display","block");view_box();}function close_box(){$(".backdrop, .box").animate({"opacity":"0"},300,"linear",function(){$(".backdrop, .box").css("display","none");});$(".dz-complete").remove();$(".dz-message").show();}function view_box(){$(".backdrop").animate({"opacity":".5"},300,"linear"); +$(".backdrop").css("display","block");}function add_import(){if($("#ste").val()<1){alert("Please select an ST&E");return;}$("#add_import").val($("#ste").val());$("#import").animate({"opacity":"1.00"},300,"linear");$("#import").css("display","block");view_box();} \ No newline at end of file