#9771 changes in summary and new fields for trecon_task

This commit is contained in:
Daniel Cebrian 2023-04-26 17:16:34 +02:00
parent cc2ab53db4
commit 966dc63a92
3 changed files with 12 additions and 3 deletions

View File

@ -41,6 +41,7 @@ CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` (
ALTER TABLE `trecon_task`
ADD COLUMN `id_app` int(10),
ADD COLUMN `setup_complete` tinyint unsigned NOT NULL DEFAULT 0,
ADD COLUMN `executions_timeout` int unsigned NOT NULL DEFAULT 60,
ADD FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE;
CREATE TABLE IF NOT EXISTS `tsesion_filter` (

View File

@ -1395,14 +1395,14 @@ class DiscoveryTaskList extends HTML
$output = '';
if (is_array($task['stats']) === false) {
if (is_array($task['stats']) === false && (int) $task['type'] !== DISCOVERY_EXTENSION) {
$task['stats'] = json_decode($task['summary'], true);
if (json_last_error() !== JSON_ERROR_NONE) {
return $task['summary'];
}
}
if (is_array($task['stats'])) {
if (is_array($task['stats']) || (int) $task['type'] === DISCOVERY_EXTENSION) {
$i = 0;
$table = new StdClasS();
$table->class = 'databox data';
@ -1462,8 +1462,8 @@ class DiscoveryTaskList extends HTML
$table->data[$i++][1] .= '</span>';
} else if ((int) $task['type'] === DISCOVERY_EXTENSION) {
// Content.
$countSummary = 1;
if (is_array($task['stats']) === true) {
$countSummary = 1;
foreach ($task['stats'] as $key => $summary) {
$table->data[$i][0] = '<b>'.__('Summary').' '.$countSummary.'</b>';
$table->data[$i][1] = '';
@ -1508,6 +1508,13 @@ class DiscoveryTaskList extends HTML
$i++;
}
}
} else {
$table->data[$i][0] = '<b>'.__('Summary').'</b>';
$table->data[$i][1] = '';
$i++;
$table->data[$i][0] = $task['summary'];
$table->data[$i][1] = '';
$i++;
}
} else {
// Content.

View File

@ -893,6 +893,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
`snmp_skip_non_enabled_ifs` TINYINT UNSIGNED DEFAULT 1,
`id_app` int(10),
`setup_complete` tinyint unsigned NOT NULL DEFAULT 0,
`executions_timeout` int unsigned NOT NULL DEFAULT 60,
PRIMARY KEY (`id_rt`),
KEY `recon_task_daemon` (`id_recon_server`),
FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE