diff --git a/pandora_console/extras/mr/66.sql b/pandora_console/extras/mr/66.sql index 466909a617..4f92b5e659 100644 --- a/pandora_console/extras/mr/66.sql +++ b/pandora_console/extras/mr/66.sql @@ -4,6 +4,8 @@ ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0; +ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT; + UPDATE `twelcome_tip` SET title = 'Scheduled downtimes', url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes' diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 1aeaa8a1a6..841874e3eb 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1050,6 +1050,14 @@ switch ($action) { $ignore_skipped = $item['ignore_skipped']; break; + case 'list_checks': + $group = $item['id_group']; + $recursion = $item['recursion']; + $cat_selected = $item['cat_security_hardening']; + $status_of_check = $item['status_of_check']; + $idAgent = $item['id_agent']; + break; + default: // It's not possible. break; @@ -3751,6 +3759,28 @@ $class = 'databox filters'; + + + + + + __('All'), + 'PASS' => __('Passed'), + 'FAIL' => __('Failed'), + 'INVALID' => __('Skipped'), + ], + 'status_of_check', + $status_of_check, + ); + ?> + + + @@ -6625,6 +6655,7 @@ function chooseType() { $("#row_use_prefix_notation").hide(); $("#row_cat_security_hardening").hide(); $("#row_ignore_skipped").hide(); + $("#row_status_check").hide(); // SLA list default state. $("#sla_list").hide(); @@ -7500,6 +7531,13 @@ function chooseType() { $("#row_cat_security_hardening").show(); $("#row_ignore_skipped").show(); break; + + case 'list_checks': + $("#row_group").show(); + $("#row_agent").show(); + $("#row_cat_security_hardening").show(); + $("#row_status_check").show(); + break; } switch (type) { diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 48805131d7..1102aabdfc 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -2015,6 +2015,13 @@ switch ($action) { $good_format = true; break; + case 'list_checks': + $values['id_group'] = get_parameter('combo_group'); + $values['cat_security_hardening'] = get_parameter('cat_security_hardening'); + $values['status_of_check'] = get_parameter('status_of_check'); + $good_format = true; + break; + default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter( @@ -2916,6 +2923,13 @@ switch ($action) { $good_format = true; break; + case 'list_checks': + $values['id_group'] = get_parameter('combo_group'); + $values['cat_security_hardening'] = get_parameter('cat_security_hardening'); + $values['status_of_check'] = get_parameter('status_of_check'); + $good_format = true; + break; + default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter( diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 67c12f73a7..1603183b65 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -963,6 +963,13 @@ function reporting_make_reporting_data( ); break; + case 'list_checks': + $report['contents'][] = reporting_list_checks( + $report, + $content + ); + break; + default: // Default. break; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 887c3d5fcb..c9c4da53fb 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -479,6 +479,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) case 'vul_by_cat': reporting_vul_by_cat_graph($table, $item); break; + + case 'list_checks': + reporting_html_list_checks($table, $item); + break; } if ($item['type'] == 'agent_module') { @@ -494,6 +498,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) } +/** + * Function to print HTML checks filtered by agent and category. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * + * @return void + */ +function reporting_html_list_checks($table, $item) +{ + $table->rowclass[0] = ''; + $table->colspan[0][1] = 3; + $table->data[1][0] = ''.__('Id').''; + $table->data[1][1] = ''.__('Title').''; + $table->data[1][2] = ''.__('Category').''; + $table->data[1][3] = ''.__('Status').''; + + $row = 2; + foreach ($item['data'] as $key => $check) { + $table->data[$row][0] = $check['id']; + $table->data[$row][1] = $check['title']; + $table->data[$row][2] = $check['category']; + $table->data[$row][3] = $check['status']; + $row++; + } +} + + /** * Function to print HTML top checks failed by category * @@ -504,7 +536,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) */ function reporting_html_top_n_categories_checks($table, $item) { - global $config; $table->rowclass[0] = ''; $table->data[1][0] = ''.__('Id').''; $table->data[1][1] = ''.__('Category').''; diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 9e26be5998..f574beb3bf 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -983,6 +983,11 @@ function reports_get_report_types($template=false, $not_editor=false) 'optgroup' => __('Security hardening'), 'name' => __('Vulnerabilities by category'), ]; + + $types['list_checks'] = [ + 'optgroup' => __('Security hardening'), + 'name' => __('List of checks'), + ]; } return $types; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 5164d2ed21..d1fb4e4f1f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1674,6 +1674,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1, `cat_security_hardening` INT NOT NULL DEFAULT 0, `ignore_skipped` INT NOT NULL DEFAULT 0, + `status_of_check` TINYTEXT, PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE