mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'ent-3430-proyecto-discovery' into 'develop'
Ent 3430 proyecto discovery See merge request artica/pandorafms!2210 Former-commit-id: 104df0b898d6f4bb9eef21005cca6a3f74c3e035
This commit is contained in:
commit
75b889ff4a
@ -30,6 +30,7 @@ require_once __DIR__.'/Wizard.main.php';
|
|||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
require_once $config['homedir'].'/include/functions_reports.php';
|
require_once $config['homedir'].'/include/functions_reports.php';
|
||||||
require_once $config['homedir'].'/include/functions_cron.php';
|
require_once $config['homedir'].'/include/functions_cron.php';
|
||||||
|
enterprise_include('include/functions_tasklist.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defined as wizard to guide user to explore running tasks.
|
* Defined as wizard to guide user to explore running tasks.
|
||||||
@ -72,6 +73,9 @@ class DiscoveryTaskList extends Wizard
|
|||||||
/**
|
/**
|
||||||
* Implements run method.
|
* Implements run method.
|
||||||
*
|
*
|
||||||
|
* @param string $message Redirected input.
|
||||||
|
* @param boolean $status Redirected input.
|
||||||
|
*
|
||||||
* @return mixed Returns null if wizard is ongoing. Result if done.
|
* @return mixed Returns null if wizard is ongoing. Result if done.
|
||||||
*/
|
*/
|
||||||
public function run($message='', $status=null)
|
public function run($message='', $status=null)
|
||||||
@ -115,43 +119,39 @@ class DiscoveryTaskList extends Wizard
|
|||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
// This check only applies to enterprise users.
|
// This check only applies to enterprise users.
|
||||||
// Check if DiscoveryCronTasks is running. Warn user if not.
|
enterprise_hook('tasklist_checkrunning');
|
||||||
if ($config['cron_last_run'] == 0
|
|
||||||
|| (get_system_time() - $config['cron_last_run']) > 3600
|
|
||||||
) {
|
|
||||||
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly').'. ';
|
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
|
|
||||||
$message_conf_cron .= __('Discovery relies on a proper setup of cron, the time-based scheduling service');
|
|
||||||
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
|
|
||||||
$message_conf_cron .= '<b><pre style="color: #333;">* * * * * <user> wget -q -O - --no-check-certificate ';
|
|
||||||
$message_conf_cron .= str_replace(
|
|
||||||
ENTERPRISE_DIR.'/meta/',
|
|
||||||
'',
|
|
||||||
ui_get_full_url(false)
|
|
||||||
);
|
|
||||||
$message_conf_cron .= ENTERPRISE_DIR.'/'.EXTENSIONS_DIR;
|
|
||||||
$message_conf_cron .= '/cron/cron.php >> ';
|
|
||||||
$message_conf_cron .= $config['homedir'].'/pandora_console.log</pre></b>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($config['cron_last_run']) === true
|
$ret = $this->showListConsoleTask();
|
||||||
&& $config['cron_last_run'] > 0
|
} else {
|
||||||
) {
|
$ret = false;
|
||||||
$message_conf_cron .= '<p style="color: #333;">'.__('Last execution').': ';
|
|
||||||
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']).'</p>';
|
|
||||||
$message_conf_cron .= '<p style="color: #333;">';
|
|
||||||
$message_conf_cron .= __('Please check process is no locked.').'</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_warning_message($message_conf_cron, '', false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = $this->showListConsoleTask();
|
|
||||||
$ret2 = $this->showList();
|
$ret2 = $this->showList();
|
||||||
|
|
||||||
if ($ret === false && $ret2 === false) {
|
if ($ret === false && $ret2 === false) {
|
||||||
include_once $config['homedir'].'/general/firts_task/recon_view.php';
|
include_once $config['homedir'].'/general/firts_task/recon_view.php';
|
||||||
|
} else {
|
||||||
|
$form = [
|
||||||
|
'form' => [
|
||||||
|
'method' => 'POST',
|
||||||
|
'action' => ui_get_full_url(
|
||||||
|
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
'inputs' => [
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'submit',
|
||||||
|
'label' => __('Go back'),
|
||||||
|
'type' => 'submit',
|
||||||
|
'attributes' => 'class="sub cancel"',
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->printForm($form);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -237,7 +237,7 @@ class DiscoveryTaskList extends Wizard
|
|||||||
$id_console_task = (int) get_parameter('id_console_task');
|
$id_console_task = (int) get_parameter('id_console_task');
|
||||||
|
|
||||||
if ($id_console_task !== null) {
|
if ($id_console_task !== null) {
|
||||||
cron_task_run($id_console_task, true);
|
enterprise_include('cron_task_run', $id_console_task, true);
|
||||||
// Trick to avoid double execution.
|
// Trick to avoid double execution.
|
||||||
header('Location: '.$this->url);
|
header('Location: '.$this->url);
|
||||||
}
|
}
|
||||||
@ -311,257 +311,227 @@ class DiscoveryTaskList extends Wizard
|
|||||||
if ($servers === false) {
|
if ($servers === false) {
|
||||||
$servers = [];
|
$servers = [];
|
||||||
ui_print_error_message(__('Discovery Server is disabled'));
|
ui_print_error_message(__('Discovery Server is disabled'));
|
||||||
return false;
|
$check = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||||
|
return (bool) $check;
|
||||||
} else {
|
} else {
|
||||||
$recon_task = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
include_once $config['homedir'].'/include/functions_graph.php';
|
||||||
if ($recon_task === false) {
|
include_once $config['homedir'].'/include/functions_servers.php';
|
||||||
return false;
|
include_once $config['homedir'].'/include/functions_network_profiles.php';
|
||||||
} else {
|
|
||||||
include_once $config['homedir'].'/include/functions_graph.php';
|
|
||||||
include_once $config['homedir'].'/include/functions_servers.php';
|
|
||||||
include_once $config['homedir'].'/include/functions_network_profiles.php';
|
|
||||||
|
|
||||||
$modules_server = 0;
|
$modules_server = 0;
|
||||||
$total_modules = 0;
|
$total_modules = 0;
|
||||||
$total_modules_data = 0;
|
$total_modules_data = 0;
|
||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
// FORCE A RECON TASK
|
// FORCE A RECON TASK
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
if (isset($_GET['force'])) {
|
if (isset($_GET['force'])) {
|
||||||
$id = (int) get_parameter_get('force', 0);
|
$id = (int) get_parameter_get('force', 0);
|
||||||
servers_force_recon_task($id);
|
servers_force_recon_task($id);
|
||||||
header(
|
header(
|
||||||
'Location: '.ui_get_full_url(
|
'Location: '.ui_get_full_url(
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($servers as $serverItem) {
|
||||||
|
$id_server = $serverItem['id_server'];
|
||||||
|
$server_name = servers_get_name($id_server);
|
||||||
|
$recon_tasks = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||||
|
$user_groups = implode(',', array_keys(users_get_groups()));
|
||||||
|
$defined_tasks = db_get_all_rows_filter(
|
||||||
|
'tuser_task_scheduled',
|
||||||
|
'id_grupo IN ('.$user_groups.')'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($tasks_console) === true
|
||||||
|
&& is_array($tasks_console) === true
|
||||||
|
) {
|
||||||
|
foreach ($tasks_console as $key => $value) {
|
||||||
|
$value['parameters'] = unserialize(
|
||||||
|
$value['parameters']
|
||||||
|
);
|
||||||
|
|
||||||
|
$value['type'] = 'Cron';
|
||||||
|
array_push($recon_tasks, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show network tasks for Recon Server.
|
||||||
|
if ($recon_tasks === false) {
|
||||||
|
$recon_tasks = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = new StdClass();
|
||||||
|
$table->cellpadding = 4;
|
||||||
|
$table->cellspacing = 4;
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox data';
|
||||||
|
$table->head = [];
|
||||||
|
$table->data = [];
|
||||||
|
$table->align = [];
|
||||||
|
$table->headstyle = [];
|
||||||
|
for ($i = 0; $i < 9; $i++) {
|
||||||
|
$table->headstyle[$i] = 'text-align: left;';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->head[0] = __('Force');
|
||||||
|
$table->align[0] = 'left';
|
||||||
|
|
||||||
|
$table->head[1] = __('Task name');
|
||||||
|
$table->align[1] = 'left';
|
||||||
|
|
||||||
|
$table->head[2] = __('Interval');
|
||||||
|
$table->align[2] = 'left';
|
||||||
|
|
||||||
|
$table->head[3] = __('Network');
|
||||||
|
$table->align[3] = 'left';
|
||||||
|
|
||||||
|
$table->head[4] = __('Status');
|
||||||
|
$table->align[4] = 'left';
|
||||||
|
|
||||||
|
$table->head[5] = __('Task type');
|
||||||
|
$table->align[5] = 'left';
|
||||||
|
|
||||||
|
$table->head[6] = __('Progress');
|
||||||
|
$table->align[6] = 'left';
|
||||||
|
|
||||||
|
$table->head[7] = __('Updated at');
|
||||||
|
$table->align[7] = 'left';
|
||||||
|
|
||||||
|
$table->head[8] = __('Operations');
|
||||||
|
$table->align[8] = 'left';
|
||||||
|
|
||||||
|
foreach ($recon_tasks as $task) {
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if ($task['disabled'] == 0) {
|
||||||
|
$data[0] = '<a href="'.ui_get_full_url(
|
||||||
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||||
|
).'">';
|
||||||
|
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||||
|
$data[0] .= '</a>';
|
||||||
|
} else if ($task['disabled'] == 2) {
|
||||||
|
$data[0] = ui_print_help_tip(
|
||||||
|
__('This task has not been completely defined, please edit it'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$data[0] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[1] = '<b>'.$task['name'].'</b>';
|
||||||
|
|
||||||
|
if ($task['interval_sweep'] > 0) {
|
||||||
|
$data[2] = human_time_description_raw(
|
||||||
|
$task['interval_sweep']
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$data[2] = __('Manual');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($task['id_recon_script'] == 0) {
|
||||||
|
$data[3] = $task['subnet'];
|
||||||
|
} else {
|
||||||
|
$data[3] = '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($task['status'] <= 0) {
|
||||||
|
$data[4] = __('Done');
|
||||||
|
} else {
|
||||||
|
$data[4] = __('Pending');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($task['id_recon_script'] == 0) {
|
||||||
|
// Discovery NetScan.
|
||||||
|
$data[5] = html_print_image(
|
||||||
|
'images/network.png',
|
||||||
|
true,
|
||||||
|
['title' => __('Discovery NetScan')]
|
||||||
|
).' ';
|
||||||
|
$data[5] .= network_profiles_get_name(
|
||||||
|
$task['id_network_profile']
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// APP recon task.
|
||||||
|
$data[5] = html_print_image(
|
||||||
|
'images/plugin.png',
|
||||||
|
true
|
||||||
|
).' ';
|
||||||
|
$data[5] .= db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT name FROM trecon_script WHERE id_recon_script = %d',
|
||||||
|
$task['id_recon_script']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($servers as $serverItem) {
|
if ($task['status'] <= 0 || $task['status'] > 100) {
|
||||||
$id_server = $serverItem['id_server'];
|
$data[6] = '-';
|
||||||
$server_name = servers_get_name($id_server);
|
|
||||||
$recon_tasks = db_get_all_rows_field_filter(
|
|
||||||
'trecon_task',
|
|
||||||
'id_recon_server',
|
|
||||||
$id_server
|
|
||||||
);
|
|
||||||
|
|
||||||
$user_groups = implode(',', array_keys(users_get_groups()));
|
|
||||||
$defined_tasks = db_get_all_rows_filter(
|
|
||||||
'tuser_task_scheduled',
|
|
||||||
'id_grupo IN ('.$user_groups.')'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset($tasks_console) === true
|
|
||||||
&& is_array($tasks_console) === true
|
|
||||||
) {
|
|
||||||
foreach ($tasks_console as $key => $value) {
|
|
||||||
$value['parameters'] = unserialize(
|
|
||||||
$value['parameters']
|
|
||||||
);
|
|
||||||
|
|
||||||
$value['type'] = 'Cron';
|
|
||||||
array_push($recon_tasks, $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show network tasks for Recon Server.
|
|
||||||
if ($recon_tasks === false) {
|
|
||||||
$recon_tasks = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = new StdClass();
|
|
||||||
$table->cellpadding = 4;
|
|
||||||
$table->cellspacing = 4;
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->class = 'databox data';
|
|
||||||
$table->head = [];
|
|
||||||
$table->data = [];
|
|
||||||
$table->align = [];
|
|
||||||
$table->headstyle = [];
|
|
||||||
for ($i = 0; $i < 9; $i++) {
|
|
||||||
$table->headstyle[$i] = 'text-align: left;';
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->head[0] = __('Force');
|
|
||||||
$table->align[0] = 'left';
|
|
||||||
|
|
||||||
$table->head[1] = __('Task name');
|
|
||||||
$table->align[1] = 'left';
|
|
||||||
|
|
||||||
$table->head[2] = __('Interval');
|
|
||||||
$table->align[2] = 'left';
|
|
||||||
|
|
||||||
$table->head[3] = __('Network');
|
|
||||||
$table->align[3] = 'left';
|
|
||||||
|
|
||||||
$table->head[4] = __('Status');
|
|
||||||
$table->align[4] = 'left';
|
|
||||||
|
|
||||||
$table->head[5] = __('Task type');
|
|
||||||
$table->align[5] = 'left';
|
|
||||||
|
|
||||||
$table->head[6] = __('Progress');
|
|
||||||
$table->align[6] = 'left';
|
|
||||||
|
|
||||||
$table->head[7] = __('Updated at');
|
|
||||||
$table->align[7] = 'left';
|
|
||||||
|
|
||||||
$table->head[8] = __('Operations');
|
|
||||||
$table->align[8] = 'left';
|
|
||||||
|
|
||||||
foreach ($recon_tasks as $task) {
|
|
||||||
$data = [];
|
|
||||||
|
|
||||||
if ($task['disabled'] == 0) {
|
|
||||||
$data[0] = '<a href="'.ui_get_full_url(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
|
||||||
).'">';
|
|
||||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
|
||||||
$data[0] .= '</a>';
|
|
||||||
} else if ($task['disabled'] == 2) {
|
|
||||||
$data[0] = ui_print_help_tip(
|
|
||||||
__('This task has not been completely defined, please edit it'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = '<b>'.$task['name'].'</b>';
|
|
||||||
|
|
||||||
if ($task['interval_sweep'] > 0) {
|
|
||||||
$data[2] = human_time_description_raw(
|
|
||||||
$task['interval_sweep']
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$data[2] = __('Manual');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($task['id_recon_script'] == 0) {
|
|
||||||
$data[3] = $task['subnet'];
|
|
||||||
} else {
|
|
||||||
$data[3] = '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($task['status'] <= 0) {
|
|
||||||
$data[4] = __('Done');
|
|
||||||
} else {
|
|
||||||
$data[4] = __('Pending');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($task['id_recon_script'] == 0) {
|
|
||||||
// Discovery NetScan.
|
|
||||||
$data[5] = html_print_image(
|
|
||||||
'images/network.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Discovery NetScan')]
|
|
||||||
).' ';
|
|
||||||
$data[5] .= network_profiles_get_name(
|
|
||||||
$task['id_network_profile']
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// APP recon task.
|
|
||||||
$data[5] = html_print_image(
|
|
||||||
'images/plugin.png',
|
|
||||||
true
|
|
||||||
).' ';
|
|
||||||
$data[5] .= db_get_sql(
|
|
||||||
sprintf(
|
|
||||||
'SELECT name FROM trecon_script WHERE id_recon_script = %d',
|
|
||||||
$task['id_recon_script']
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($task['status'] <= 0 || $task['status'] > 100) {
|
|
||||||
$data[6] = '-';
|
|
||||||
} else {
|
|
||||||
$data[6] = progress_bar(
|
|
||||||
$task['status'],
|
|
||||||
100,
|
|
||||||
20,
|
|
||||||
__('Progress').':'.$task['status'].'%',
|
|
||||||
1
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($task['utimestamp'] > 0) {
|
|
||||||
$data[7] = ui_print_timestamp(
|
|
||||||
$task['utimestamp'],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$data[7] = __('Not executed yet');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_acl(
|
|
||||||
$config['id_user'],
|
|
||||||
$task['id_group'],
|
|
||||||
'PM'
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
// Check if is a H&D, Cloud or Application.
|
|
||||||
$data[8] = '<a href="'.ui_get_full_url(
|
|
||||||
sprintf(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
|
||||||
$this->getTargetWiz($task),
|
|
||||||
$task['id_rt']
|
|
||||||
)
|
|
||||||
).'">'.html_print_image(
|
|
||||||
'images/config.png',
|
|
||||||
true
|
|
||||||
).'</a>';
|
|
||||||
$data[8] .= '<a href="'.ui_get_full_url(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
|
||||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
|
||||||
'images/cross.png',
|
|
||||||
true
|
|
||||||
).'</a>';
|
|
||||||
} else {
|
|
||||||
$data[8] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($table->data, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($table->data)) {
|
|
||||||
echo '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no recon tasks assigned').'</div>';
|
|
||||||
} else {
|
} else {
|
||||||
echo '<h2>'.__('Server task').'</h2>';
|
$data[6] = progress_bar(
|
||||||
html_print_table($table);
|
$task['status'],
|
||||||
|
100,
|
||||||
|
20,
|
||||||
|
__('Progress').':'.$task['status'].'%',
|
||||||
|
1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($table);
|
if ($task['utimestamp'] > 0) {
|
||||||
|
$data[7] = ui_print_timestamp(
|
||||||
|
$task['utimestamp'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$data[7] = __('Not executed yet');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check_acl(
|
||||||
|
$config['id_user'],
|
||||||
|
$task['id_group'],
|
||||||
|
'PM'
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
// Check if is a H&D, Cloud or Application.
|
||||||
|
$data[8] = '<a href="'.ui_get_full_url(
|
||||||
|
sprintf(
|
||||||
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||||
|
$this->getTargetWiz($task),
|
||||||
|
$task['id_rt']
|
||||||
|
)
|
||||||
|
).'">'.html_print_image(
|
||||||
|
'images/config.png',
|
||||||
|
true
|
||||||
|
).'</a>';
|
||||||
|
$data[8] .= '<a href="'.ui_get_full_url(
|
||||||
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
||||||
|
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||||
|
'images/cross.png',
|
||||||
|
true
|
||||||
|
).'</a>';
|
||||||
|
} else {
|
||||||
|
$data[8] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '<h2>'.__('Server tasks').'</h2>';
|
||||||
|
if (empty($table->data)) {
|
||||||
|
echo '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
html_print_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = [
|
|
||||||
'form' => [
|
|
||||||
'method' => 'POST',
|
|
||||||
'action' => ui_get_full_url(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery'
|
|
||||||
),
|
|
||||||
],
|
|
||||||
'inputs' => [
|
|
||||||
[
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'submit',
|
|
||||||
'label' => __('Go back'),
|
|
||||||
'type' => 'submit',
|
|
||||||
'attributes' => 'class="sub cancel"',
|
|
||||||
'return' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->printForm($form);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,385 +543,7 @@ class DiscoveryTaskList extends Wizard
|
|||||||
*/
|
*/
|
||||||
public function showListConsoleTask()
|
public function showListConsoleTask()
|
||||||
{
|
{
|
||||||
global $config;
|
return enterprise_hook('tasklist_showListConsoleTask', [$this]);
|
||||||
|
|
||||||
check_login();
|
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
|
||||||
db_pandora_audit(
|
|
||||||
'ACL Violation',
|
|
||||||
'Trying to access recon task viewer'
|
|
||||||
);
|
|
||||||
include 'general/noaccess.php';
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$read_perms = check_acl(
|
|
||||||
$config['id_user'],
|
|
||||||
0,
|
|
||||||
'RR'
|
|
||||||
);
|
|
||||||
$write_perms = check_acl(
|
|
||||||
$config['id_user'],
|
|
||||||
0,
|
|
||||||
'RW'
|
|
||||||
);
|
|
||||||
$manage_perms = check_acl(
|
|
||||||
$config['id_user'],
|
|
||||||
0,
|
|
||||||
'RM'
|
|
||||||
);
|
|
||||||
$manage_pandora = check_acl(
|
|
||||||
$config['id_user'],
|
|
||||||
0,
|
|
||||||
'PM'
|
|
||||||
);
|
|
||||||
|
|
||||||
$url = 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&';
|
|
||||||
|
|
||||||
$user_groups = implode(
|
|
||||||
',',
|
|
||||||
array_keys(users_get_groups())
|
|
||||||
);
|
|
||||||
|
|
||||||
$defined_tasks = db_get_all_rows_filter(
|
|
||||||
'tuser_task_scheduled',
|
|
||||||
'id_grupo IN ('.$user_groups.')'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
|
||||||
$read_tasks = [];
|
|
||||||
foreach ($defined_tasks as $task) {
|
|
||||||
$function_name = db_get_value(
|
|
||||||
'function_name',
|
|
||||||
'tuser_task',
|
|
||||||
'id',
|
|
||||||
$task['id_user_task']
|
|
||||||
);
|
|
||||||
|
|
||||||
if (($function_name != 'cron_task_execute_custom_script')
|
|
||||||
&& ($function_name != 'cron_task_do_backup')
|
|
||||||
) {
|
|
||||||
$read_tasks[] = $task;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$defined_tasks = $read_tasks;
|
|
||||||
|
|
||||||
if (empty($defined_tasks)) {
|
|
||||||
$defined_tasks = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($defined_tasks !== false) {
|
|
||||||
echo '<h2>'.__('Console task').'</h2>';
|
|
||||||
|
|
||||||
$table = new stdClass();
|
|
||||||
$table->class = 'databox data';
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->data = [];
|
|
||||||
$table->head = [];
|
|
||||||
$table->head[0] = '';
|
|
||||||
$table->head[1] = __('User');
|
|
||||||
$table->head[2] = __('Task');
|
|
||||||
$table->head[3] = __('Scheduled');
|
|
||||||
$table->head[4] = __('Next execution');
|
|
||||||
$table->head[5] = __('Last run');
|
|
||||||
$table->head[6] = __('Group');
|
|
||||||
$table->head[7] = __('Operations');
|
|
||||||
$table->align[7] = 'left';
|
|
||||||
|
|
||||||
foreach ($defined_tasks as $task) {
|
|
||||||
$data = [];
|
|
||||||
|
|
||||||
$function_name = db_get_value(
|
|
||||||
'function_name',
|
|
||||||
'tuser_task',
|
|
||||||
'id',
|
|
||||||
$task['id_user_task']
|
|
||||||
);
|
|
||||||
|
|
||||||
switch ($function_name) {
|
|
||||||
case 'cron_task_generate_report':
|
|
||||||
if ($write_perms || $manage_pandora) {
|
|
||||||
$data[0] = '<a href="'.$url;
|
|
||||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
|
||||||
$data[0] .= html_print_image(
|
|
||||||
'images/target.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Force run')]
|
|
||||||
);
|
|
||||||
$data[0] .= '</a>';
|
|
||||||
} else {
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = $task['id_usuario'];
|
|
||||||
$data[2] = db_get_value(
|
|
||||||
'name',
|
|
||||||
'tuser_task',
|
|
||||||
'id',
|
|
||||||
$task['id_user_task']
|
|
||||||
);
|
|
||||||
$args = unserialize($task['args']);
|
|
||||||
$report = reports_get_report($args[0]);
|
|
||||||
|
|
||||||
// Check ACL in reports_get_report return false.
|
|
||||||
if ($report === false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$email = $args[1];
|
|
||||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=".$args[0]."'>";
|
|
||||||
$data[2] .= $report['name'].'</a>';
|
|
||||||
$data[2] .= '<br>- '.__('Email').": <a href='mailto:".$email."'>";
|
|
||||||
$data[2] .= ui_print_truncate_text(
|
|
||||||
$email,
|
|
||||||
60,
|
|
||||||
false
|
|
||||||
).'</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'cron_task_generate_report_by_template':
|
|
||||||
if ($write_perms || $manage_pandora) {
|
|
||||||
$data[0] = '<a href="'.$url;
|
|
||||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
|
||||||
$data[0] .= html_print_image(
|
|
||||||
'images/target.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Force run')]
|
|
||||||
);
|
|
||||||
$data[0] .= '</a>';
|
|
||||||
} else {
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = $task['id_usuario'];
|
|
||||||
$data[2] = db_get_value(
|
|
||||||
'name',
|
|
||||||
'tuser_task',
|
|
||||||
'id',
|
|
||||||
$task['id_user_task']
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = unserialize($task['args']);
|
|
||||||
|
|
||||||
$filter = [];
|
|
||||||
$filter['id_report'] = $args[0];
|
|
||||||
$template = db_get_row_filter(
|
|
||||||
'treport_template',
|
|
||||||
$filter,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check ACL in reports_get_report return false.
|
|
||||||
if ($template === false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents_id = $args[1];
|
|
||||||
$id_group = $args[2];
|
|
||||||
$report_per_agent = $args[0];
|
|
||||||
$report_name = $args[3];
|
|
||||||
$email = $args[4];
|
|
||||||
$data[2] .= '<br>- '.__('Template').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
|
||||||
$data[2] .= '&id='.$args[0]."'>".$template['name'].'</a>';
|
|
||||||
$data[2] .= '<br>- '.__('Agents').': '.$agents_id.'</a>';
|
|
||||||
$data[2] .= '<br>- '.__('Report per agent').': '.$report_per_agent.'</a>';
|
|
||||||
$data[2] .= '<br>- '.__('Report name').': '.$report_name.'</a>';
|
|
||||||
$data[2] .= '<br>- '.__('Email').": <a href='mailto:".$email."'>".$email.'</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'cron_task_execute_custom_script':
|
|
||||||
if ($manage_pandora) {
|
|
||||||
$data[0] = '<a href="'.$url;
|
|
||||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
|
||||||
$data[0] .= html_print_image(
|
|
||||||
'images/target.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Force run')]
|
|
||||||
);
|
|
||||||
$data[0] .= '</a>';
|
|
||||||
} else {
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = $task['id_usuario'];
|
|
||||||
$data[2] = db_get_value(
|
|
||||||
'name',
|
|
||||||
'tuser_task',
|
|
||||||
'id',
|
|
||||||
$task['id_user_task']
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = unserialize($task['args']);
|
|
||||||
$data[2] .= '<br>- '.__('Custom script').': '.$args[0];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'cron_task_save_report_to_disk':
|
|
||||||
if ($write_perms || $manage_pandora) {
|
|
||||||
$data[0] = '<a href="'.$url;
|
|
||||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
|
||||||
$data[0] .= html_print_image(
|
|
||||||
'images/target.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Force run')]
|
|
||||||
);
|
|
||||||
$data[0] .= '</a>';
|
|
||||||
} else {
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = $task['id_usuario'];
|
|
||||||
$data[2] = db_get_value(
|
|
||||||
'name',
|
|
||||||
'tuser_task',
|
|
||||||
'id',
|
|
||||||
$task['id_user_task']
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = unserialize($task['args']);
|
|
||||||
$report = reports_get_report($args[0]);
|
|
||||||
|
|
||||||
// Check ACL in reports_get_report return false.
|
|
||||||
if ($report === false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = $args[1];
|
|
||||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
|
||||||
$data[2] .= '&id='.$args[0]."'>".$report['name'].'</a>';
|
|
||||||
$data[2] .= '<br>- '.__('Path').': '.$path.'</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'cron_task_save_xml_report_to_disk':
|
|
||||||
if ($write_perms || $manage_pandora) {
|
|
||||||
$data[0] = '<a href="'.$url;
|
|
||||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
|
||||||
$data[0] .= html_print_image(
|
|
||||||
'images/target.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Force run')]
|
|
||||||
);
|
|
||||||
$data[0] .= '</a>';
|
|
||||||
} else {
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = $task['id_usuario'];
|
|
||||||
$data[2] = db_get_value('name', 'tuser_task', 'id', $task['id_user_task']);
|
|
||||||
$args = unserialize($task['args']);
|
|
||||||
$report = reports_get_report($args[0]);
|
|
||||||
|
|
||||||
// Check ACL in reports_get_report return false.
|
|
||||||
if ($report === false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = $args[1];
|
|
||||||
$data[2] .= '<br>- '.__('Report').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
|
|
||||||
$data[2] .= '&id='.$args[0]."'>".$report['name'].'</a>';
|
|
||||||
$data[2] .= '<br>- '.__('Path').': '.$path.'</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'cron_task_do_backup':
|
|
||||||
if ($manage_pandora) {
|
|
||||||
$data[0] = '<a href="'.$url;
|
|
||||||
$data[0] .= 'force_run=1&id_console_task='.$task['id'].'">';
|
|
||||||
$data[0] .= html_print_image(
|
|
||||||
'images/target.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Force run')]
|
|
||||||
);
|
|
||||||
$data[0] .= '</a>';
|
|
||||||
} else {
|
|
||||||
$data[0] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] = $task['id_usuario'];
|
|
||||||
$data[2] = db_get_value(
|
|
||||||
'name',
|
|
||||||
'tuser_task',
|
|
||||||
'id',
|
|
||||||
$task['id_user_task']
|
|
||||||
);
|
|
||||||
$args = unserialize($task['args']);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Ignore.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[3] = cron_get_scheduled_string($task['scheduled']);
|
|
||||||
$data[4] = date('Y/m/d H:i:s', $args['first_execution']);
|
|
||||||
$data[5] = empty($task['last_run']) ? __('Never') : date('Y/m/d H:i:s', $task['last_run']);
|
|
||||||
|
|
||||||
$data[6] = ui_print_group_icon($task['id_grupo'], true);
|
|
||||||
|
|
||||||
if ($function_name == 'cron_task_do_backup' || $function_name == 'cron_task_execute_custom_script') {
|
|
||||||
if ($manage_pandora) {
|
|
||||||
$data[7] = '<a href="'.ui_get_full_url(
|
|
||||||
sprintf(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
|
||||||
$this->getTargetWiz(['description' => 'console_task']),
|
|
||||||
$task['id']
|
|
||||||
)
|
|
||||||
).'">';
|
|
||||||
$data[7] .= html_print_image(
|
|
||||||
'images/config.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Edit')]
|
|
||||||
).'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($manage_pandora) {
|
|
||||||
$data[7] .= '<a href="'.$url;
|
|
||||||
$data[7] .= 'delete_console_task=1&id_console_task='.$task['id'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
|
||||||
$data[7] .= html_print_image(
|
|
||||||
'images/cross.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Delete')]
|
|
||||||
);
|
|
||||||
$data[7] .= '</a>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($write_perms || $manage_pandora) {
|
|
||||||
$data[7] = '<a href="'.ui_get_full_url(
|
|
||||||
sprintf(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
|
||||||
$this->getTargetWiz(['description' => 'console_task']),
|
|
||||||
$task['id']
|
|
||||||
)
|
|
||||||
).'">';
|
|
||||||
$data[7] .= html_print_image(
|
|
||||||
'images/config.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Edit')]
|
|
||||||
).'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($manage_perms || $manage_pandora) {
|
|
||||||
$data[7] .= '<a href="'.$url;
|
|
||||||
$data[7] .= 'delete_console_task=1&id_console_task='.$task['id'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
|
||||||
$data[7] .= html_print_image(
|
|
||||||
'images/cross.png',
|
|
||||||
true,
|
|
||||||
['title' => __('Delete')]
|
|
||||||
);
|
|
||||||
$data[7] .= '</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($table->data, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
html_print_table($table);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
require_once __DIR__.'/Wizard.main.php';
|
require_once __DIR__.'/Wizard.main.php';
|
||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
enterprise_include('include/class/CSVImportAgents.class.php');
|
enterprise_include('include/class/CSVImportAgents.class.php');
|
||||||
|
enterprise_include_once('include/functions_hostdevices.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wizard section Host&devices.
|
* Wizard section Host&devices.
|
||||||
@ -780,266 +781,17 @@ $("select#interval_manual_defined").change(function() {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feature configuration.
|
if (enterprise_installed()) {
|
||||||
// Input: SNMP enabled.
|
// Feature configuration.
|
||||||
$form['inputs'][] = [
|
$extra = enterprise_hook('hd_showextrainputs', [$this]);
|
||||||
'label' => __('SNMP enabled'),
|
if (is_array($extra) === true) {
|
||||||
'arguments' => [
|
$form['inputs'] = array_merge(
|
||||||
'name' => 'snmp_enabled',
|
$form['inputs'],
|
||||||
'type' => 'switch',
|
$extra['inputs']
|
||||||
'return' => true,
|
);
|
||||||
'value' => (isset($this->task['snmp_enabled'])) ? $this->task['snmp_enabled'] : 1,
|
$form['js'] = $extra['js'];
|
||||||
'onclick' => 'extraSNMP();',
|
}
|
||||||
|
}
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// SNMP CONFIGURATION.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'hidden' => 1,
|
|
||||||
'block_id' => 'snmp_extra',
|
|
||||||
'block_content' => [
|
|
||||||
[
|
|
||||||
'label' => __('SNMP version'),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_version',
|
|
||||||
'fields' => [
|
|
||||||
'1' => 'v. 1',
|
|
||||||
'2c' => 'v. 2c',
|
|
||||||
'3' => 'v. 3',
|
|
||||||
],
|
|
||||||
'type' => 'select',
|
|
||||||
'script' => 'SNMPExtraShow(this.value)',
|
|
||||||
'selected' => $this->task['snmp_version'],
|
|
||||||
'return' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// SNMP Options pack v1.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'hidden' => 1,
|
|
||||||
'block_id' => 'snmp_options_basic',
|
|
||||||
'block_content' => [
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('SNMP Default community').'</b>'.ui_print_help_tip(
|
|
||||||
__(
|
|
||||||
'You can specify several values, separated by commas, for example: public,mysecret,1234'
|
|
||||||
),
|
|
||||||
true
|
|
||||||
),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'community',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $this->task['snmp_community'],
|
|
||||||
'size' => 25,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// SNMP Options pack v3.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'hidden' => 1,
|
|
||||||
'block_id' => 'snmp_options_v3',
|
|
||||||
'block_content' => [
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('Context').'</b>',
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_context',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $this->task['snmp_community'],
|
|
||||||
'size' => 15,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('Auth user').'</b>',
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_auth_user',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $this->task['snmp_auth_user'],
|
|
||||||
'size' => 15,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
|
|
||||||
__(
|
|
||||||
'The pass length must be eight character minimum.'
|
|
||||||
),
|
|
||||||
true
|
|
||||||
),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_auth_pass',
|
|
||||||
'type' => 'password',
|
|
||||||
'value' => $this->task['snmp_auth_pass'],
|
|
||||||
'size' => 15,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('Privacy method').'</b>',
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_privacy_method',
|
|
||||||
'type' => 'select',
|
|
||||||
'fields' => [
|
|
||||||
'DES' => __('DES'),
|
|
||||||
'AES' => __('AES'),
|
|
||||||
],
|
|
||||||
'selected' => $this->task['snmp_privacy_method'],
|
|
||||||
'size' => 15,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('Privacy pass').'</b>'.ui_print_help_tip(
|
|
||||||
__(
|
|
||||||
'The pass length must be eight character minimum.'
|
|
||||||
),
|
|
||||||
true
|
|
||||||
),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_privacy_pass',
|
|
||||||
'type' => 'password',
|
|
||||||
'value' => $this->task['snmp_privacy_pass'],
|
|
||||||
'size' => 15,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('Auth method').'</b>',
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_auth_method',
|
|
||||||
'type' => 'select',
|
|
||||||
'fields' => [
|
|
||||||
'MD5' => __('MD5'),
|
|
||||||
'SHA' => __('SHA'),
|
|
||||||
],
|
|
||||||
'selected' => $this->task['snmp_auth_method'],
|
|
||||||
'size' => 15,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('Security level').'</b>',
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'snmp_security_level',
|
|
||||||
'type' => 'select',
|
|
||||||
'fields' => [
|
|
||||||
'noAuthNoPriv' => __('Not auth and not privacy method'),
|
|
||||||
'authNoPriv' => __('Auth and not privacy method'),
|
|
||||||
'authPriv' => __('Auth and privacy method'),
|
|
||||||
],
|
|
||||||
'selected' => $this->task['snmp_security_level'],
|
|
||||||
'size' => 15,
|
|
||||||
'return' => true,
|
|
||||||
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Input: WMI enabled.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'label' => __('WMI enabled'),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'wmi_enabled',
|
|
||||||
'type' => 'switch',
|
|
||||||
'value' => (isset($this->task['wmi_enabled'])) ? $this->task['wmi_enabled'] : 0,
|
|
||||||
'return' => true,
|
|
||||||
'onclick' => 'toggleWMI();',
|
|
||||||
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// WMI CONFIGURATION.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'block_id' => 'wmi_extra',
|
|
||||||
'hidden' => 1,
|
|
||||||
'block_content' => [
|
|
||||||
[
|
|
||||||
'label' => '<b>'.__('WMI Auth. strings').'</b>'.ui_print_help_tip(
|
|
||||||
__(
|
|
||||||
'Auth strings must be defined as user%pass, comma separated as many you need.'
|
|
||||||
),
|
|
||||||
true
|
|
||||||
),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'auth_strings',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $this->task['auth_strings'],
|
|
||||||
'return' => true,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Input: Enforce os detection.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'label' => __('OS detection'),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'os_detect',
|
|
||||||
'type' => 'switch',
|
|
||||||
'return' => true,
|
|
||||||
'value' => (isset($this->task['os_detect'])) ? $this->task['os_detect'] : 1,
|
|
||||||
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Input: Name resolution.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'label' => __('Name resolution'),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'resolve_names',
|
|
||||||
'type' => 'switch',
|
|
||||||
'return' => true,
|
|
||||||
'value' => (isset($this->task['resolve_names'])) ? $this->task['resolve_names'] : 0,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Input: Parent detection.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'label' => __('Parent detection'),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'parent_detection',
|
|
||||||
'type' => 'switch',
|
|
||||||
'return' => true,
|
|
||||||
'value' => (isset($this->task['parent_detection'])) ? $this->task['parent_detection'] : 1,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Input: Parent recursion.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'label' => __('Parent recursion'),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'parent_recursion',
|
|
||||||
'type' => 'switch',
|
|
||||||
'return' => true,
|
|
||||||
'value' => (isset($this->task['parent_recursion'])) ? $this->task['parent_recursion'] : 1,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Input: VLAN enabled.
|
|
||||||
$form['inputs'][] = [
|
|
||||||
'label' => __('VLAN enabled'),
|
|
||||||
'arguments' => [
|
|
||||||
'name' => 'vlan_enabled',
|
|
||||||
'type' => 'switch',
|
|
||||||
'return' => true,
|
|
||||||
'value' => (isset($this->task['vlan_enabled'])) ? $this->task['vlan_enabled'] : 1,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
// Submit button.
|
// Submit button.
|
||||||
$form['inputs'][] = [
|
$form['inputs'][] = [
|
||||||
@ -1052,57 +804,6 @@ $("select#interval_manual_defined").change(function() {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$form['js'] = '
|
|
||||||
function SNMPExtraShow(target) {
|
|
||||||
$("#snmp_options_basic").hide();
|
|
||||||
$("#snmp_options_v3").hide();
|
|
||||||
if (document.getElementsByName("snmp_enabled")[0].checked) {
|
|
||||||
$("#snmp_extra").show();
|
|
||||||
if (target == 3) {
|
|
||||||
$("#snmp_options_v3").show();
|
|
||||||
} else {
|
|
||||||
$("#snmp_options_basic").show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function extraSNMP() {
|
|
||||||
if (document.getElementsByName("snmp_enabled")[0].checked) {
|
|
||||||
SNMPExtraShow($("#snmp_version").val());
|
|
||||||
$("#snmp_extra").show();
|
|
||||||
} else {
|
|
||||||
// Hide unusable sections
|
|
||||||
$("#snmp_extra").hide();
|
|
||||||
$("#snmp_options_basic").hide();
|
|
||||||
$("#snmp_options_v3").hide();
|
|
||||||
|
|
||||||
// Disable snmp dependant checks
|
|
||||||
if (document.getElementsByName("parent_recursion")[0].checked)
|
|
||||||
$("input[name=parent_recursion]").click();
|
|
||||||
|
|
||||||
if (document.getElementsByName("parent_detection")[0].checked)
|
|
||||||
$("input[name=parent_detection]").click();
|
|
||||||
|
|
||||||
if (document.getElementsByName("vlan_enabled")[0].checked)
|
|
||||||
$("input[name=vlan_enabled]").click();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleWMI() {
|
|
||||||
if (document.getElementsByName("wmi_enabled")[0].checked)
|
|
||||||
$("#wmi_extra").show();
|
|
||||||
else
|
|
||||||
$("#wmi_extra").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
SNMPExtraShow($("#snmp_version").val());
|
|
||||||
toggleWMI();
|
|
||||||
});
|
|
||||||
';
|
|
||||||
|
|
||||||
$form['form'] = [
|
$form['form'] = [
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
|
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
|
||||||
|
@ -1,11 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interfaz tope gama que obliga a implementar metodos.
|
* Extension to schedule tasks on Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Wizard
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Wizard skel
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global Wizard generic class. Needs to be inherited.
|
||||||
|
*
|
||||||
|
* Used in Hostdevices class, Applications class and others, is the core of
|
||||||
|
* Discovery proyect.
|
||||||
|
*/
|
||||||
class Wizard
|
class Wizard
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -17,9 +45,9 @@ class Wizard
|
|||||||
public $breadcrum;
|
public $breadcrum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented variable
|
* Current page
|
||||||
*
|
*
|
||||||
* @var [type]
|
* @var integer
|
||||||
*/
|
*/
|
||||||
public $page;
|
public $page;
|
||||||
|
|
||||||
@ -498,6 +526,8 @@ class Wizard
|
|||||||
/**
|
/**
|
||||||
* Prints a go back button redirecting to main page.
|
* Prints a go back button redirecting to main page.
|
||||||
*
|
*
|
||||||
|
* @param string $url Optional target url.
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function printGoBackButton($url=null)
|
public function printGoBackButton($url=null)
|
||||||
|
@ -580,7 +580,6 @@ if ($get_extended_event) {
|
|||||||
dataType : "html",
|
dataType : "html",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$("#related_data").html(data);
|
$("#related_data").html(data);
|
||||||
console.log("vamos puta");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user