Merge remote-tracking branch 'origin/ent-3595-discovery-fase-2' into ent-3409-pandora-network-traffic-analyzer-ntop-fork-fase-1

Conflicts:
	pandora_console/extras/mr/26.sql
	pandora_console/include/class/ConsoleSupervisor.php
	pandora_console/include/class/NetworkMap.class.php
	pandora_console/include/styles/pandora.css
	pandora_console/operation/menu.php

Former-commit-id: 2a0661a65772d4a91f95587d77b0d1287fb66b18
This commit is contained in:
fermin831 2019-03-27 12:11:23 +01:00
commit b2f046e4d6
43 changed files with 708 additions and 382 deletions

View File

@ -11,6 +11,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
UNIQUE (`source`, `destination`, `utimestamp`) UNIQUE (`source`, `destination`, `utimestamp`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ; ) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics"; UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport"); UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport");
@ -22,4 +23,6 @@ ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0'; ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
ALTER TABLE `trecon_task` ADD COLUMN `summary` text;
COMMIT; COMMIT;

View File

@ -1413,6 +1413,7 @@ ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0';
ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0'; ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
ALTER TABLE trecon_task ADD `auth_strings` text; ALTER TABLE trecon_task ADD `auth_strings` text;
ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0'; ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0';
ALTER TABLE trecon_task ADD `summary` text;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `twidget` AND Table `twidget_dashboard` -- Table `twidget` AND Table `twidget_dashboard`

View File

@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/icono_grande_reconserver.png', true, ['title' => __('Collections')]); ?> <?php echo html_print_image('images/icono_grande_reconserver.png', true, ['title' => __('Collections')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Collections'); ?> <p id="description_task"> <h3> <?php echo __('Create Collections'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"A file collection is a group of files (e.g. scripts or executables) which are "A file collection is a group of files (e.g. scripts or executables) which are

View File

@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Custom Fields'); ?> <p id="description_task"> <h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"Custom fields are an easy way to personalized agent's information. "Custom fields are an easy way to personalized agent's information.

View File

@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
<?php echo html_print_image('images/firts_task/icono_grande_custom_reporting.png', true, ['title' => __('Custom Graphs')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_custom_reporting.png', true, ['title' => __('Custom Graphs')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Custom Graph'); ?> <p id="description_task"> <h3> <?php echo __('Create Custom Graph'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"Graphs are designed to show the data collected by %s in a temporary scale defined by the user. "Graphs are designed to show the data collected by %s in a temporary scale defined by the user.

View File

@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Fields Manager')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Fields Manager')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Fields Manager'); ?> <p id="description_task"> <h3> <?php echo __('Create Fields Manager'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"Custom fields are an easy way to personalized agent's information. "Custom fields are an easy way to personalized agent's information.

View File

@ -28,7 +28,7 @@ if ($incident_w || $incident_m) {
<?php echo html_print_image('images/firts_task/icono_grande_incidencia.png', true, ['title' => __('Incidents')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_incidencia.png', true, ['title' => __('Incidents')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Incidents'); ?> <p id="description_task"> <h3> <?php echo __('Create Incidents'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"Besides receiving and processing data to monitor systems or applications, "Besides receiving and processing data to monitor systems or applications,

View File

@ -31,7 +31,7 @@ if ($vconsoles_write || $vconsoles_manage) {
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Visual Console'); ?> <p id="description_task"> <h3> <?php echo __('Create Visual Console'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
'%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.", '%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.",

View File

@ -26,7 +26,7 @@ $networkmap_types = networkmap_get_types($strict_user);
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Network Map')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Network Map')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Network Map'); ?> <p id="description_task"> <h3> <?php echo __('Create Network Map'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
'There is also an open-source version of the network map. 'There is also an open-source version of the network map.

View File

@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Planned Downtime'); ?> <p id="description_task"> <h3> <?php echo __('Create Planned Downtime'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"%s contains a scheduled downtime management system. "%s contains a scheduled downtime management system.

View File

@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Discovery server')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Discovery server')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Discovery Task'); ?><p id="description_task"> <h3> <?php echo __('Create Discovery Task'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
'Discovery Task are used to find new elements in the network. 'Discovery Task are used to find new elements in the network.

View File

@ -25,7 +25,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Services'); ?> <p id="description_task"> <h3> <?php echo __('Create Services'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"A service is a way to group your IT resources based on their functionalities. "A service is a way to group your IT resources based on their functionalities.

View File

@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('SNMP Filter')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('SNMP Filter')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create SNMP Filter'); ?> <p id="description_task"> <h3> <?php echo __('Create SNMP Filter'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"Some systems receive a high number of traps. "Some systems receive a high number of traps.

View File

@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
<?php echo html_print_image('images/firts_task/icono_grande_gestiondetags.png', true, ['title' => __('Tags')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_gestiondetags.png', true, ['title' => __('Tags')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Tags'); ?> <p id="description_task"> <h3> <?php echo __('Create Tags'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"Access to modules can be configured by a tagging system. "Access to modules can be configured by a tagging system.

View File

@ -28,7 +28,7 @@ if ($networkmaps_write || $networkmaps_manage) {
<?php echo html_print_image('images/firts_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?> <?php echo html_print_image('images/firts_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Transactions'); ?> <p id="description_task"> <h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time. 'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.

View File

@ -305,12 +305,12 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
echo '<div class ="img_banner_login">'; echo '<div class ="img_banner_login">';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (isset($config['custom_splash_login'])) { if (isset($config['custom_splash_login'])) {
html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0, 'title' => $splash_title], false, true); html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0], false, true);
} else { } else {
html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true); html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
} }
} else { } else {
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true); html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
} }
echo '</div>'; echo '</div>';

View File

@ -15,8 +15,6 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
ui_require_css_file('discovery'); ui_require_css_file('discovery');
ui_print_page_header(__('Discovery'), '', false, '', true);
/** /**
* Mask class names. * Mask class names.

View File

@ -96,7 +96,8 @@ class DiscoveryTaskList extends Wizard
] ]
); );
$this->printHeader(); // Header
ui_print_page_header(__('Task list'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
// Show redirected messages from discovery.php. // Show redirected messages from discovery.php.
if ($status === 0) { if ($status === 0) {
@ -432,7 +433,7 @@ class DiscoveryTaskList extends Wizard
// Name task. // Name task.
$data[1] = ''; $data[1] = '';
if ($task['disabled'] != 2) { if ($task['disabled'] != 2) {
$data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">'; $data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
} }
$data[1] .= '<b>'.$task['name'].'</b>'; $data[1] .= '<b>'.$task['name'].'</b>';
@ -503,7 +504,7 @@ class DiscoveryTaskList extends Wizard
} }
if ($task['disabled'] != 2) { if ($task['disabled'] != 2) {
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">'; $data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image( $data[9] .= html_print_image(
'images/eye.png', 'images/eye.png',
true true
@ -512,7 +513,7 @@ class DiscoveryTaskList extends Wizard
} }
if ($task['disabled'] != 2 && $task['utimestamp'] > 0) { if ($task['disabled'] != 2 && $task['utimestamp'] > 0) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">'; $data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image( $data[9] .= html_print_image(
'images/dynamic_network_icon.png', 'images/dynamic_network_icon.png',
true true
@ -565,6 +566,9 @@ class DiscoveryTaskList extends Wizard
$data[9] = ''; $data[9] = '';
} }
// Div neccesary for modal progress task.
echo '<div id="progress_task_'.$task['id_rt'].'" style="display:none"></div>';
array_push($table->data, $data); array_push($table->data, $data);
} }
@ -576,8 +580,8 @@ class DiscoveryTaskList extends Wizard
html_print_table($table); html_print_table($table);
} }
// Div neccesary for modal progress task. // Div neccesary for modal map task.
echo '<div id="progress_task" style="display:none"></div>'; echo '<div id="map_task" style="display:none"></div>';
unset($table); unset($table);

View File

@ -152,7 +152,7 @@ class HostDevices extends Wizard
] ]
); );
$this->printHeader(); ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
$this->printBigButtonsList($buttons); $this->printBigButtonsList($buttons);
return; return;
@ -512,9 +512,15 @@ class HostDevices extends Wizard
$task_url = '&task='.$this->task['id_rt']; $task_url = '&task='.$this->task['id_rt'];
} }
$breadcrum[] = [ $breadcrum = [
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd', [
'label' => __($this->label), 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery',
'label' => 'Discovery',
],
[
'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd',
'label' => __($this->label),
],
]; ];
for ($i = 0; $i < $this->maxPagesNetScan; $i++) { for ($i = 0; $i < $this->maxPagesNetScan; $i++) {
$breadcrum[] = [ $breadcrum[] = [
@ -527,7 +533,7 @@ class HostDevices extends Wizard
if ($this->page < $this->maxPagesNetScan) { if ($this->page < $this->maxPagesNetScan) {
// Avoid to print header out of wizard. // Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum); $this->prepareBreadcrum($breadcrum);
$this->printHeader(); ui_print_page_header(__('NetScan'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
} }
if (isset($this->page) === true if (isset($this->page) === true

View File

@ -196,20 +196,38 @@ class Wizard
* *
* @return void * @return void
*/ */
public function prepareBreadcrum(array $urls, bool $add=false) public function prepareBreadcrum(array $urls, bool $add=false, bool $separator_beginning=false)
{ {
$bc = []; $bc = [];
$i = 0; $i = 0;
$count = 0;
$array_size = count($urls);
foreach ($urls as $url) { foreach ($urls as $url) {
$count++;
if ($url['selected'] == 1) { if ($url['selected'] == 1) {
$class = 'selected'; $class = 'selected';
} else { } else {
$class = ''; $class = '';
} }
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">'; $bc[$i] = '';
$bc[$i] .= '<div class="arrow_box '.$class.'">'.$url['label'];
$bc[$i++] .= '</div></a>'; if ($separator_beginning === true) {
$bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>';
}
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
$bc[$i] .= $url['label'];
$bc[$i] .= '</a>';
if ($count < $array_size) {
$bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>';
}
$bc[$i] .= '</span>';
$i++;
} }
if ($add === true) { if ($add === true) {
@ -257,7 +275,7 @@ class Wizard
*/ */
public function printBreadcrum() public function printBreadcrum()
{ {
return '<h1 class="wizard">'.implode('', $this->breadcrum).'</h1>'; return implode('', $this->breadcrum);
} }

View File

@ -34,14 +34,23 @@ $showmap = (bool) get_parameter('showmap', 0);
if ($progress_task_discovery) { if ($progress_task_discovery) {
$id_task = get_parameter('id', 0); $id_task = get_parameter('id', 0);
if ($id_task !== 0) { if ($id_task <= 0) {
$result = ''; echo json_encode(['error' => true]);
return;
}
$task = db_get_row('trecon_task', 'id_rt', $id_task);
$global_progress = $task['status'];
$summary = json_decode($task['summary'], true);
$result = '<div id = progress_task_'.$id_task.'>';
if ($task['utimestamp']) {
$result .= '<ul class="progress_task_discovery">'; $result .= '<ul class="progress_task_discovery">';
$result .= '<li><h1>'._('Overall Progress').'</h1></li>'; $result .= '<li><h1>'._('Overall Progress').'</h1></li>';
$result .= '<li>'; $result .= '<li>';
$result .= d3_progress_bar( $result .= d3_progress_bar(
$id_task, $id_task,
90, ($global_progress < 0) ? 100 : $global_progress,
460, 460,
30, 30,
'#EA5434', '#EA5434',
@ -49,40 +58,104 @@ if ($progress_task_discovery) {
'', '',
'#FFFFFF', '#FFFFFF',
0, 0,
0
);
$result .= '</li>';
$result .= '<li><h1>'.__('Searching devices in').' red a scanear</h1></li>';
$result .= '<li>';
$result .= d3_progress_bar(
$id_task.'_2',
30,
460,
30,
'#2751E1',
'%',
'',
'#FFFFFF',
0, 0,
0 0
); );
$result .= '</li>'; if ($global_progress > 0) {
$result .= '<li><h1>'.__('Summary').'</h1></li>'; switch ($summary['step']) {
$result .= '<li><span><b>'.__('Estimated').'</b>: total de host</span></li>'; case STEP_SCANNING:
$result .= '<li><span><b>'.__('Discovered').'</b>: total de agentes</span></li>'; $str = __('Scanning network');
$result .= '<li><span><b>'.__('Not alive/Not found').'</b>: total de agentes 1-2</span></li>'; break;
case STEP_AFT:
$str = __('Finding AFT connectivity');
break;
case STEP_TRACEROUTE:
$str = __('Finding traceroute connectivity');
break;
case STEP_GATEWAY:
$str = __('Finding gateway connectivity');
break;
default:
$str = __('Searching for devices...');
break;
}
$result .= '</li>';
$result .= '<li><h1>'.$str.' ';
$result .= $summary['c_network_name'];
$result .= '</h1></li>';
$result .= '<li>';
$result .= d3_progress_bar(
$id_task.'_detail',
$summary['c_network_percent'],
460,
30,
'#2751E1',
'%',
'',
'#FFFFFF',
0,
0,
0
);
$result .= '</li>';
}
$result .= '</ul>'; $result .= '</ul>';
echo $result; $i = 0;
$table = new StdClasS();
$table->class = 'databox data';
$table->width = '75%';
$table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;';
$table->rowid = [];
$table->data = [];
// Content.
$table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>';
$table->data[$i][1] = '<span id="discovered">';
$table->data[$i][1] .= $summary['summary']['discovered'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Alive').'</b>';
$table->data[$i][1] = '<span id="alive">';
$table->data[$i][1] .= $summary['summary']['alive'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Not alive').'</b>';
$table->data[$i][1] = '<span id="not_alive">';
$table->data[$i][1] .= $summary['summary']['not_alive'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>';
$table->data[$i][1] = '<span id="SNMP">';
$table->data[$i][1] .= $summary['summary']['SNMP'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Responding WMI').'</b>';
$table->data[$i][1] = '<span id="WMI">';
$table->data[$i][1] .= $summary['summary']['WMI'];
$table->data[$i++][1] .= '</span>';
$result .= html_print_table($table, true).'</div>';
} else { } else {
// Error. $global_progress = -1;
ui_print_error_message( $result .= ui_print_error_message(
__('Please, select task') __('No data to show'),
); '',
true
).'</div>';
} }
$result_array['status'] = $global_progress;
$result_array['html'] = $result;
echo json_encode($result_array);
return; return;
} }

View File

@ -36,7 +36,7 @@ require_once $config['homedir'].'/include/functions_servers.php';
// Enterprise includes. // Enterprise includes.
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_license.php'); enterprise_include_once('include/functions_license.php');
enterprise_include_once('extensions/cron/functions.php'); enterprise_include_once('include/functions_cron.php');
/** /**
* Base class to run scheduled tasks in cron extension * Base class to run scheduled tasks in cron extension

View File

@ -337,9 +337,15 @@ class CustomNetScan extends Wizard
$task_url = '&task='.$this->task['id_rt']; $task_url = '&task='.$this->task['id_rt'];
} }
$breadcrum[] = [ $breadcrum = [
'link' => $run_url.'&wiz=hd', [
'label' => __('Host & Devices'), 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery',
'label' => 'Discovery',
],
[
'link' => $run_url.'&wiz=hd',
'label' => __('Host & Devices'),
],
]; ];
for ($i = 0; $i < $this->MAXPAGES; $i++) { for ($i = 0; $i < $this->MAXPAGES; $i++) {
@ -353,7 +359,9 @@ class CustomNetScan extends Wizard
if ($this->page < $this->MAXPAGES) { if ($this->page < $this->MAXPAGES) {
// Avoid to print header out of wizard. // Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum); $this->prepareBreadcrum($breadcrum);
$this->printHeader();
// Header
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
} }
$task_url = ''; $task_url = '';
@ -376,7 +384,9 @@ class CustomNetScan extends Wizard
if ($this->page < $this->maxPagesNetScan) { if ($this->page < $this->maxPagesNetScan) {
// Avoid to print header out of wizard. // Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum); $this->prepareBreadcrum($breadcrum);
$this->printHeader();
// Header
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
} }
if (isset($this->page) === true if (isset($this->page) === true

View File

@ -92,9 +92,15 @@ class ManageNetScanScripts extends Wizard
$run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery'; $run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
$breadcrum[] = [ $breadcrum = [
'link' => $run_url.'&wiz=hd', [
'label' => __('Host & Devices'), 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery',
'label' => 'Discovery',
],
[
'link' => $run_url.'&wiz=hd',
'label' => __('Host & Devices'),
],
]; ];
for ($i = 0; $i < $this->MAXPAGES; $i++) { for ($i = 0; $i < $this->MAXPAGES; $i++) {
@ -108,7 +114,9 @@ class ManageNetScanScripts extends Wizard
if ($this->page < $this->MAXPAGES) { if ($this->page < $this->MAXPAGES) {
// Avoid to print header out of wizard. // Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum); $this->prepareBreadcrum($breadcrum);
$this->printHeader();
// Header
ui_print_page_header(__('Net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
} }
$id_script = get_parameter('id_script', 0); $id_script = get_parameter('id_script', 0);

View File

@ -212,6 +212,13 @@ class NetworkMap
*/ */
public $tooltipParams; public $tooltipParams;
/**
* Shows the map using 100% of height and width if is a widget.
*
* @var boolean
*/
public $isWidget;
/** /**
* Defines a custom method to parse Graphviz output and generate Graph. * Defines a custom method to parse Graphviz output and generate Graph.
* Function pointer. * Function pointer.
@ -380,6 +387,12 @@ class NetworkMap
$this->noPopUp = $options['no_popup']; $this->noPopUp = $options['no_popup'];
} }
// Initialize as widget?
if (isset($options['widget'])) {
$this->isWidget = (bool) $options['widget'];
$this->isWidget = true;
}
// Use a custom parser. // Use a custom parser.
if (isset($options['custom_parser'])) { if (isset($options['custom_parser'])) {
$this->customParser = $options['custom_parser']; $this->customParser = $options['custom_parser'];
@ -596,10 +609,6 @@ class NetworkMap
$this->idGroup = $this->map['id_group']; $this->idGroup = $this->map['id_group'];
switch ($this->map['source']) { switch ($this->map['source']) {
case SOURCE_GROUP:
$this->idGroup = $this->map['source_data'];
break;
case SOURCE_TASK: case SOURCE_TASK:
$this->idTask = $this->map['source_data']; $this->idTask = $this->map['source_data'];
break; break;
@ -608,6 +617,8 @@ class NetworkMap
$this->network = $this->map['source_data']; $this->network = $this->map['source_data'];
break; break;
case SOURCE_GROUP:
// Already load.
default: default:
// Ignore. // Ignore.
break; break;
@ -764,7 +775,9 @@ class NetworkMap
// Empty map returns no data. // Empty map returns no data.
$nodes = []; $nodes = [];
} else { } else {
if ($this->mapOptions['map_filter']['dont_show_subgroups'] == 'true') { if ($this->mapOptions['map_filter']['dont_show_subgroups'] === 'true'
|| $this->mapOptions['map_filter']['dont_show_subgroups'] == 1
) {
// Show only current selected group. // Show only current selected group.
$filter['id_grupo'] = $this->idGroup; $filter['id_grupo'] = $this->idGroup;
} else { } else {
@ -2776,6 +2789,10 @@ class NetworkMap
false, false,
true true
); );
$output .= '</div>';
$output .= '</div>';
return $output; return $output;
} }
@ -2999,7 +3016,11 @@ class NetworkMap
$table->data = []; $table->data = [];
$table->data['interface_row']['node_source_interface'] = html_print_label('', 'node_source_interface'); $table->data['interface_row']['node_source_interface'] = html_print_label(
'',
'node_source_interface',
true
);
$table->data['interface_row']['interface_source_select'] = html_print_select( $table->data['interface_row']['interface_source_select'] = html_print_select(
[], [],
@ -3023,10 +3044,11 @@ class NetworkMap
$table->data['interface_row']['node_target_interface'] = html_print_label( $table->data['interface_row']['node_target_interface'] = html_print_label(
'', '',
'node_target_interface' 'node_target_interface',
true
); );
$output .= 'br><br>'; $output .= '<br>';
$table->data['interface_row']['interface_link_button'] = html_print_button( $table->data['interface_row']['interface_link_button'] = html_print_button(
__('Add interface link'), __('Add interface link'),
@ -3228,7 +3250,8 @@ class NetworkMap
enterprise_installed: enterprise_installed, enterprise_installed: enterprise_installed,
node_radius: node_radius, node_radius: node_radius,
holding_area_dimensions: networkmap_holding_area_dimensions, holding_area_dimensions: networkmap_holding_area_dimensions,
url_background_grid: url_background_grid url_background_grid: url_background_grid,
font_size: '.$this->mapOptions['font_size'].'
}); });
init_drag_and_drop(); init_drag_and_drop();
init_minimap(); init_minimap();
@ -3289,7 +3312,10 @@ class NetworkMap
'/enterprise/include/styles/tooltipster.bundle.min.css' '/enterprise/include/styles/tooltipster.bundle.min.css'
).'" />'."\n"; ).'" />'."\n";
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" style="border: 1px #dddddd solid;">'; $output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
$output .= 'style="border: 1px #ddd solid;';
$output .= ' width:'.$this->mapOptions['width'];
$output .= ' ;height:'.$this->mapOptions['height'].'">';
$output .= '<svg id="svg'.$this->idMap.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" pointer-events="all" width="'.$this->mapOptions['width'].'" height="'.$this->mapOptions['height'].'px">'; $output .= '<svg id="svg'.$this->idMap.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" pointer-events="all" width="'.$this->mapOptions['width'].'" height="'.$this->mapOptions['height'].'px">';
$output .= '</svg>'; $output .= '</svg>';
$output .= '</div>'; $output .= '</div>';
@ -3321,7 +3347,11 @@ class NetworkMap
// Open networkconsole_id div. // Open networkconsole_id div.
$output .= '<div id="networkconsole_'.$networkmap['id'].'"'; $output .= '<div id="networkconsole_'.$networkmap['id'].'"';
$output .= ' style="width: '.$this->mapOptions['width'].'; height: '.$this->mapOptions['height'].';position: relative; overflow: hidden; background: #FAFAFA">'; if ($this->isWidget) {
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">';
} else {
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
}
$output .= '<div style="display: '.$minimap_display.';">'; $output .= '<div style="display: '.$minimap_display.';">';
$output .= '<canvas id="minimap_'.$networkmap['id'].'"'; $output .= '<canvas id="minimap_'.$networkmap['id'].'"';

View File

@ -514,6 +514,12 @@ define('OPTION_COLOR_PICKER', 11);
define('NODE_TYPE', 0); define('NODE_TYPE', 0);
define('ARROW_TYPE', 1); define('ARROW_TYPE', 1);
// Discovery task steps.
define('STEP_SCANNING', 1);
define('STEP_AFT', 2);
define('STEP_TRACEROUTE', 3);
define('STEP_GATEWAY', 4);
// Networkmap node types. // Networkmap node types.
define('NODE_AGENT', 0); define('NODE_AGENT', 0);
define('NODE_MODULE', 1); define('NODE_MODULE', 1);

View File

@ -19,8 +19,10 @@
// Set session variable to store menu type (classic or collapsed) within this session // Set session variable to store menu type (classic or collapsed) within this session
if (!empty(get_parameter('menuType'))) if (!empty(get_parameter('menuType'))) {
$_SESSION['menu_type'] = get_parameter('menuType', 'collapsed'); $_SESSION['menu_type'] = get_parameter('menuType', 'classic');
}
/** /**
* Prints a complete menu structure. * Prints a complete menu structure.
@ -80,10 +82,17 @@ function menu_print_menu(&$menu)
$submenu = false; $submenu = false;
if ($_SESSION['menu_type']=='classic') if ($_SESSION['menu_type'] == 'classic') {
$classes = ['menu_icon', 'no_hidden_menu']; $classes = [
else 'menu_icon',
$classes = ['menu_icon', 'menu_icon_collapsed']; 'no_hidden_menu',
];
} else {
$classes = [
'menu_icon',
'menu_icon_collapsed',
];
}
if (isset($main['sub'])) { if (isset($main['sub'])) {
$classes[] = ''; $classes[] = '';
@ -383,10 +392,11 @@ function menu_print_menu(&$menu)
$length = strlen(__($main['text'])); $length = strlen(__($main['text']));
$padding_top = ( $length >= 18) ? 6 : 12; $padding_top = ( $length >= 18) ? 6 : 12;
if ($_SESSION['menu_type']=='classic') if ($_SESSION['menu_type'] == 'classic') {
$output .= '<div id="title_menu" class="title_menu_classic" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>'; $output .= '<div id="title_menu" class="title_menu_classic" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
else } else {
$output .= '<div id="title_menu" class="title_menu_collapsed" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>'; $output .= '<div id="title_menu" class="title_menu_collapsed" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
}
// Add the notification ball if defined // Add the notification ball if defined
if (isset($main['notification'])) { if (isset($main['notification'])) {

View File

@ -11,10 +11,10 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
require_once 'include/functions_modules.php'; require_once __DIR__.'/functions_modules.php';
require_once 'include/functions_events.php'; require_once __DIR__.'/functions_events.php';
require_once 'include/functions_groups.php'; require_once __DIR__.'/functions_groups.php';
require_once 'include/functions_netflow.php'; require_once __DIR__.'/functions_netflow.php';
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');

View File

@ -2768,7 +2768,8 @@ function ui_print_page_header(
$modal=false, $modal=false,
$message='', $message='',
$numChars=GENERIC_SIZE_TEXT, $numChars=GENERIC_SIZE_TEXT,
$alias='' $alias='',
$breadcrumbs=''
) { ) {
$title = io_safe_input_html($title); $title = io_safe_input_html($title);
if (($icon == '') && ($godmode == true)) { if (($icon == '') && ($godmode == true)) {
@ -2781,15 +2782,21 @@ function ui_print_page_header(
if ($godmode == true) { if ($godmode == true) {
$type = 'view'; $type = 'view';
$type2 = 'menu_tab_frame_view'; $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
$separator_class = 'separator'; $separator_class = 'separator';
} else { } else {
$type = 'view'; $type = 'view';
$type2 = 'menu_tab_frame_view'; $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
$separator_class = 'separator_view'; $separator_class = 'separator_view';
} }
$buffer = '<div id="'.$type2.'" style=""><div id="menu_tab_left">'; $buffer = '<div id="'.$type2.'" style="">';
if (!empty($breadcrumbs)) {
$buffer .= '<div class="breadcrumbs_container">'.$breadcrumbs.'</div>';
}
$buffer .= '<div id="menu_tab_left">';
$buffer .= '<ul class="mn"><li class="'.$type.'">'; $buffer .= '<ul class="mn"><li class="'.$type.'">';

View File

@ -364,7 +364,8 @@ function d3_progress_bar(
$text='', $text='',
$fill_color='#FFFFFF', $fill_color='#FFFFFF',
$radiusx=10, $radiusx=10,
$radiusy=10 $radiusy=10,
$transition=1
) { ) {
global $config; global $config;
@ -387,6 +388,7 @@ function d3_progress_bar(
'".$fill_color."', '".$fill_color."',
".(int) $radiusx.', ".(int) $radiusx.',
'.(int) $radiusy.', '.(int) $radiusy.',
'.(int) $transition.'
); );
</script>'; </script>';

View File

@ -1776,7 +1776,8 @@ function progress_bar_d3(
label, label,
label_color, label_color,
radiusx, radiusx,
radiusy radiusy,
transition
) { ) {
var startPercent = 0; var startPercent = 0;
var endPercent = parseInt(percentile) / 100; var endPercent = parseInt(percentile) / 100;
@ -1836,17 +1837,21 @@ function progress_bar_d3(
progress_front.attr("width", width * bar_progress); progress_front.attr("width", width * bar_progress);
} }
var bar_progress = startPercent; if (transition == 0) {
var bar_progress = endPercent;
(function loops() {
updateProgress(bar_progress); updateProgress(bar_progress);
} else {
var bar_progress = startPercent;
(function loops() {
updateProgress(bar_progress);
if (count > 0) { if (count > 0) {
count--; count--;
bar_progress += step; bar_progress += step;
setTimeout(loops, 30); setTimeout(loops, 30);
} }
})(); })();
}
} }
function progress_bubble_d3( function progress_bubble_d3(

View File

@ -83,7 +83,7 @@ function draw_minimap() {
context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false); context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false);
//Check if the pandora point //Check if the pandora point
if (value.id_agent == -1) { if (value.type == 2) {
context_minimap.fillStyle = "#364D1F"; context_minimap.fillStyle = "#364D1F";
} else { } else {
context_minimap.fillStyle = "#000"; context_minimap.fillStyle = "#000";
@ -868,7 +868,7 @@ function edit_node(data_node, dblClick) {
); // It doesn't eval the possible XSS so it's ok ); // It doesn't eval the possible XSS so it's ok
$("#dialog_node_edit").dialog("open"); $("#dialog_node_edit").dialog("open");
if (node_selected.id_agent == undefined || node_selected.id_agent == -2) { if (node_selected.id_agent == undefined || node_selected.type == 3) {
//Fictional node //Fictional node
$("#node_options-fictional_node_name").css("display", ""); $("#node_options-fictional_node_name").css("display", "");
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok $("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
@ -1681,7 +1681,8 @@ function clear_selection() {
function update_networkmap() { function update_networkmap() {
if (enterprise_installed) { if (enterprise_installed) {
node.each(function(d) { node.each(function(d) {
if (d.id_agent != -1) { // Do not update Pandora FMS node.
if (d.type != 2) {
var params = []; var params = [];
params.push("update_node_color=1"); params.push("update_node_color=1");
params.push("id=" + d.id_db); params.push("id=" + d.id_db);
@ -1896,7 +1897,7 @@ function show_menu(item, data) {
icon: "interface_link_children", icon: "interface_link_children",
disabled: function() { disabled: function() {
if (enterprise_installed) { if (enterprise_installed) {
if (data.type == 3) { if (data.type == 3 || data.type == 2) {
return true; return true;
} else { } else {
return false; return false;
@ -1966,7 +1967,7 @@ function show_menu(item, data) {
icon: "interface_link_parent", icon: "interface_link_parent",
disabled: function() { disabled: function() {
if (enterprise_installed) { if (enterprise_installed) {
if (data.type == 3) { if (data.type == 3 || data.type == 2) {
return true; return true;
} else { } else {
return false; return false;
@ -2052,7 +2053,8 @@ function show_menu(item, data) {
}; };
} }
if (data.id_agent != -1) { // Avoid deletion if Pandora FMS node.
if (data.type != 2) {
items_list["delete"] = { items_list["delete"] = {
name: delete_menu, name: delete_menu,
icon: "delete", icon: "delete",
@ -2291,26 +2293,25 @@ function add_interface_link_js() {
cancel_set_parent_interface(); cancel_set_parent_interface();
$("#dialog_interface_link").dialog("close"); $("#dialog_interface_link").dialog("close");
source_value = $("#interface_source_select").val(); var source_value = $("#interface_source_select").val();
source_text = $("#interface_source_select") var source_text = $("#interface_source_select")
.find("option:selected") .find("option:selected")
.text(); .text();
target_value = $("#interface_target_select").val(); var target_value = $("#interface_target_select").val();
target_text = $("#interface_target_select") var target_text = $("#interface_target_select")
.find("option:selected") .find("option:selected")
.text(); .text();
var params = [];
params.push("add_interface_relation=1");
params.push("id=" + networkmap_id);
params.push("source_value=" + source_value);
params.push("target_value=" + target_value);
params.push("source_text=" + source_text);
params.push("target_text=" + target_text);
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
jQuery.ajax({ jQuery.ajax({
data: params.join("&"), data: {
page: "enterprise/operation/agentes/pandora_networkmap.view",
add_interface_relation: 1,
id: networkmap_id,
source_value: source_value,
target_value: target_value,
source_text: source_text,
target_text: target_text
},
dataType: "json", dataType: "json",
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
@ -2326,8 +2327,9 @@ function add_interface_link_js() {
if (data["type_source"] == 1) { if (data["type_source"] == 1) {
temp_link["arrow_start"] = "module"; temp_link["arrow_start"] = "module";
temp_link["id_module_start"] = source_value; temp_link["id_module_start"] = source_value;
temp_link["status_start"] = data["status"]; temp_link["status_start"] = data["status_start"];
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999"; temp_link["link_color"] =
data["status_start"] == "1" ? "#FC4444" : "#999";
} else { } else {
temp_link["arrow_start"] = ""; temp_link["arrow_start"] = "";
temp_link["id_agent_start"] = source_value; temp_link["id_agent_start"] = source_value;
@ -2336,8 +2338,9 @@ function add_interface_link_js() {
if (data["type_target"] == 1) { if (data["type_target"] == 1) {
temp_link["arrow_end"] = "module"; temp_link["arrow_end"] = "module";
temp_link["id_module_end"] = target_value; temp_link["id_module_end"] = target_value;
temp_link["status_end"] = data["status"]; temp_link["status_end"] = data["status_end"];
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999"; temp_link["link_color"] =
data["status_end"] == "1" ? "#FC4444" : "#999";
} else { } else {
temp_link["arrow_end"] = ""; temp_link["arrow_end"] = "";
temp_link["id_agent_end"] = target_value; temp_link["id_agent_end"] = target_value;
@ -2596,8 +2599,9 @@ function proceed_to_restart_map() {
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
success: function(data) { success: function(data) {
$("#restart_map_form").html(data); $("#restart_map_form")
$("#restart_map_form").dialog("open"); .html(data)
.dialog("open");
} }
}); });
} }
@ -2951,6 +2955,13 @@ function init_graph(parameter_object) {
window.height_svg = window.height_svg =
$(window).height() - $("#menu_tab_frame_view").height() - 20; // 20 of margin $(window).height() - $("#menu_tab_frame_view").height() - 20; // 20 of margin
} }
if (!window.height_svg) {
window.height_svg = $("#networkconsole_" + networkmap_id).height();
}
if (typeof parameter_object.font_size != "undefined") {
window.font_size = parameter_object.font_size;
}
window.refresh_period = 5 * 1000; //milliseconds window.refresh_period = 5 * 1000; //milliseconds
if (typeof parameter_object.refresh_period != "undefined") { if (typeof parameter_object.refresh_period != "undefined") {
@ -3964,6 +3975,10 @@ function draw_elements_graph() {
var font_size = node_radius / 1.5; var font_size = node_radius / 1.5;
if (typeof window.font_size != "undefined") {
font_size = window.font_size;
}
node_temp node_temp
.append("text") .append("text")
.attr("class", "node_text") .attr("class", "node_text")

View File

@ -1,44 +1,80 @@
/** /*
* global $
* @param {*} id global jQuery
* @param {*} name */
*/
function progress_task_list(id, name, url) {
var params = [];
params.push("page=include/ajax/task_list.ajax");
params.push("progress_task_discovery=1");
params.push("id=" + id);
jQuery.ajax({ /**
data: params.join("&"), * Function for create modal with progress task
* and recalculate 3 second.
* @param {int} id
* @param {string} name
*/
function progress_task_list(id, title) {
var timeoutRef = null;
var xhr = null;
var $elem = $("#progress_task_" + id);
$elem
.hide()
.empty()
.dialog({
title: title,
draggable: true,
modal: false,
width: 600,
height: 420,
close: function() {
if (xhr != null) xhr.abort();
if (timeoutRef != null) clearTimeout(timeoutRef);
}
});
// Function var.
var handleFetchTaskList = function(err, data) {
if (err) {
// TODO: Show info about the problem.
}
$elem.html(data.html);
if (!$elem.dialog("isOpen")) $elem.dialog("open");
if (data.status != -1) {
timeoutRef = setTimeout(function() {
xhr = fetchTaskList(id, handleFetchTaskList);
}, 3000);
}
};
xhr = fetchTaskList(id, handleFetchTaskList);
}
/**
* Function that performs ajax request to return
* the progress of the task.
* @param {int} id Id task.
* @param {function} callback Function callback.
*/
function fetchTaskList(id, callback) {
return jQuery.ajax({
data: {
page: "include/ajax/task_list.ajax",
progress_task_discovery: 1,
id: id
},
type: "POST", type: "POST",
url: (action = url), url: "ajax.php",
dataType: "html", dataType: "json",
success: function(data) { success: function(data) {
$("#progress_task") callback(null, data);
.hide() },
.empty() error: function() {
.append(data) callback(new Error("cannot fetch the list"));
.dialog({
title: "Task: " + name,
resizable: true,
draggable: true,
modal: false,
width: 600,
height: 400
})
.show();
} }
}); });
} }
function show_map(id, name, url) { function show_map(id, name) {
var params = []; $("#map_task")
params.push("page=include/ajax/task_list.ajax");
params.push("showmap=1");
params.push("id=" + id);
$("#progress_task")
.empty() .empty()
.hide() .hide()
.append("<p>Loading map</p>") .append("<p>Loading map</p>")
@ -53,12 +89,16 @@ function show_map(id, name, url) {
.show(); .show();
jQuery.ajax({ jQuery.ajax({
data: params.join("&"), data: {
page: "include/ajax/task_list.ajax",
showmap: 1,
id: id
},
type: "POST", type: "POST",
url: (action = url), url: "ajax.php",
dataType: "html", dataType: "html",
success: function(data) { success: function(data) {
$("#progress_task") $("#map_task")
.empty() .empty()
.append(data); .append(data);
} }

View File

@ -64,7 +64,6 @@ h1.wizard a:hover {
div.arrow_box { div.arrow_box {
display: inline-block; display: inline-block;
position: relative; position: relative;
background: #ccc;
color: #888; color: #888;
padding: 1.3em; padding: 1.3em;
margin-left: 20px; margin-left: 20px;
@ -72,16 +71,6 @@ div.arrow_box {
padding-left: 3em; padding-left: 3em;
} }
.arrow_box:before {
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
z-index: 1;
}
.arrow_box.selected { .arrow_box.selected {
background: #424242; background: #424242;
color: #ccc; color: #ccc;
@ -110,3 +99,68 @@ div.arrow_box:before {
.arrow_box:hover { .arrow_box:hover {
color: #000; color: #000;
} }
/*
* Breadcrum
*/
#menu_tab_frame_view_bc {
display: flex;
justify-content: space-between;
border-bottom: 2px solid #82b92e;
max-height: 70px;
min-height: 55px;
width: 100%;
padding-right: 0px;
margin-left: 0px !important;
margin-bottom: 20px;
height: 55px;
box-sizing: border-box;
background-color: #fafafa;
border-top-right-radius: 7px;
border-top-left-radius: 7px;
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1);
flex-direction: column;
}
#menu_tab_frame_view_bc .breadcrumbs_container {
align-self: flex-start;
}
.breadcrumbs_container {
padding-left: 10px;
padding-top: 4px;
text-indent: 0.25em;
}
.breadcrumb_link {
color: #848484;
font-size: 10pt !important;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
text-decoration: none !important;
}
span.breadcrumb_link {
color: #d0d0d0;
font-size: 12pt !important;
}
.breadcrumb_link.selected {
color: #95b750;
}
.breadcrumb_link.selected:hover {
color: #95b750;
}
.breadcrumb_link:hover {
color: #95b750;
}
.form_grid_items {
overflow: hidden;
}
.form_grid_items .form_grid_item {
float: left;
box-sizing: border-box;
padding: 10px;
}

View File

@ -72,6 +72,7 @@ div.new_task_cluster > div {
} }
#description_task { #description_task {
font-size: 12px; font-size: 12px;
line-height: 1.8em;
} }
#fuerte { #fuerte {

View File

@ -31,8 +31,7 @@
.operation .menu_icon ul.submenu > li, .operation .menu_icon ul.submenu > li,
.godmode .menu_icon ul.submenu > li { .godmode .menu_icon ul.submenu > li {
background-color: #282828; background-color: #282828;
padding-left: 10px; padding-left: 1.5em;
padding-right: 10px;
} }
.menu ul { .menu ul {
@ -58,7 +57,7 @@ li:hover ul {
.submenu_text { .submenu_text {
margin-left: 0px; margin-left: 0px;
width: 100%; width: 100%;
color: #9ca4a6; color: #b9b9b9;
font-family: "Open Sans", sans-serif; font-family: "Open Sans", sans-serif;
font-size: 9.4pt; font-size: 9.4pt;
} }
@ -71,21 +70,20 @@ li:hover ul {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
position: absolute; position: absolute;
z-index: 999; z-index: 999;
width: 214px; width: 240px;
} }
.submenu2 { .submenu2 {
position: absolute; position: absolute;
z-index: 999; z-index: 999;
left: 214px; left: 240px;
width: 214px; width: 240px;
} }
.sub_subMenu { .sub_subMenu {
font-weight: normal !important; font-weight: normal !important;
background-color: #202020; background-color: #202020;
padding-left: 10px; padding-left: 1.5em;
padding-right: 10px;
} }
.sub_subMenu.selected { .sub_subMenu.selected {
@ -291,7 +289,7 @@ ul li a:hover {
} }
.operation { .operation {
background-color: #343434 !important; background-color: #3d3d3d !important;
padding-top: 20px !important; padding-top: 20px !important;
} }
@ -468,11 +466,11 @@ ul li a:hover {
} }
.header_table_classic { .header_table_classic {
padding-left: 250px !important; /* 215 + 35 */ padding-left: 235px !important; /* 215 + 35 */
} }
.header_table_collapsed { .header_table_collapsed {
padding-left: 95px !important; /* 60 + 35 */ padding-left: 80px !important; /* 60 + 35 */
} }
.title_menu_classic { .title_menu_classic {

View File

@ -404,10 +404,10 @@ div#page {
background-image: none; background-image: none;
clear: both; clear: both;
width: auto; width: auto;
padding-top: 20px !important; padding-top: 5px !important;
padding-left: 60px; /* This is overwritten by the classic menu (215px)*/ padding-left: 60px; /* This is overwritten by the classic menu (215px)*/
padding-right: 35px; padding-right: 35px;
margin-left: 35px; margin-left: 20px;
} }
body.pure { body.pure {
@ -1266,7 +1266,7 @@ div.title_line {
margin-bottom: 20px; margin-bottom: 20px;
height: 50px; height: 50px;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fafafa;
border-top-right-radius: 7px; border-top-right-radius: 7px;
border-top-left-radius: 7px; border-top-left-radius: 7px;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1); box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
@ -1305,6 +1305,7 @@ div.title_line {
text-decoration: none; text-decoration: none;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
padding-top: 6px;
} }
#menu_tab li.nomn:hover a, #menu_tab li.nomn:hover a,
#menu_tab li:hover ul a:hover { #menu_tab li:hover ul a:hover {
@ -1410,7 +1411,8 @@ div#agent_wizard_subtabs {
#menu_tab_left li a, #menu_tab_left li a,
#menu_tab_left li span { #menu_tab_left li span {
color: #343434; color: #343434;
font-size: 14pt; font-size: 16pt;
line-height: 16pt;
} }
/* /*
@ -2019,6 +2021,7 @@ div#pandora_logo_header {
#header_table_inner { #header_table_inner {
height: 60px; height: 60px;
min-width: 790px;
/*width: 100%;*/ /*width: 100%;*/
display: flex; display: flex;
align-items: center; align-items: center;
@ -3251,7 +3254,7 @@ div.div_groups_status {
} }
#title_menu { #title_menu {
color: #9ca4a6; color: #b9b9b9;
float: right; float: right;
width: 72%; width: 72%;
letter-spacing: 0pt; letter-spacing: 0pt;
@ -3267,16 +3270,15 @@ div.div_groups_status {
#menu_tab li.nomn, #menu_tab li.nomn,
#menu_tab li.nomn_high { #menu_tab li.nomn_high {
background-color: #fff; padding-right: 8px;
padding-right: 3px; padding-left: 8px;
padding-left: 3px;
padding-top: 6px; padding-top: 6px;
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
font-size: 14px; font-size: 14px;
margin-top: 0; margin-top: 0;
min-width: 30px; min-width: 30px;
height: 29px; height: 40px;
} }
#menu_tab li:hover { #menu_tab li:hover {
@ -3287,6 +3289,7 @@ div.div_groups_status {
#menu_tab li.nomn_high span { #menu_tab li.nomn_high span {
color: #fff; color: #fff;
box-shadow: inset 0px 4px #82b92e; box-shadow: inset 0px 4px #82b92e;
background-color: #fff;
} }
#menu_tab li.nomn img, #menu_tab li.nomn img,
@ -4427,21 +4430,7 @@ div#dialog_messages table th:last-child {
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
*/ */
div#header_discovery {
border-radius: 50%;
box-shadow: 0 0 15px 0px #949494;
width: 9px;
font-weight: bold;
color: #fff;
margin-right: 15px;
}
div#header_discovery:hover {
box-shadow: 0 0 5px 2px #949494;
}
.notification-ball { .notification-ball {
border: #fff solid 2px;
border-radius: 50%; border-radius: 50%;
width: 24px; width: 24px;
height: 24px; height: 24px;
@ -4453,6 +4442,10 @@ div#header_discovery:hover {
font-weight: bold; font-weight: bold;
} }
.notification-ball.notification-ball-new-messages:hover {
box-shadow: 0 0 3px #888;
}
.notification-ball-no-messages { .notification-ball-no-messages {
background-color: #82b92e; background-color: #82b92e;
cursor: pointer; cursor: pointer;
@ -4466,10 +4459,9 @@ div#header_discovery:hover {
border: #a5a5a5 solid 1px; border: #a5a5a5 solid 1px;
z-index: 900000; z-index: 900000;
position: absolute; position: absolute;
width: 590px; width: 550px;
margin-top: -5px; margin-top: -5px;
border-radius: 5px; border-radius: 5px;
margin-left: -146px;
} }
#notification-wrapper::before { #notification-wrapper::before {
content: ""; content: "";
@ -4481,8 +4473,7 @@ div#header_discovery:hover {
border-width: 12px; border-width: 12px;
border-style: solid; border-style: solid;
bottom: 100%; bottom: 100%;
left: 78%; left: calc(58% - 7px);
left: calc(78% - 2px);
margin-left: -12px; margin-left: -12px;
border-bottom-color: white; border-bottom-color: white;
} }
@ -4775,8 +4766,8 @@ input:checked + .p-slider:before {
/* New white rounded boxes */ /* New white rounded boxes */
.white_box { .white_box {
background-color: #fff; background-color: #fff;
border: 1px solid #d7d9da; border: 1px solid #f3f3f3;
border-radius: 10px; border-radius: 5px;
padding: 20px 50px; padding: 20px 50px;
} }

View File

@ -53,7 +53,7 @@ if ($new_networkmap) {
$recon_task_id = 0; $recon_task_id = 0;
$source = 'group'; $source = 'group';
$ip_mask = ''; $ip_mask = '';
$dont_show_subgroups = false; $dont_show_subgroups = 0;
$offset_x = ''; $offset_x = '';
$offset_y = ''; $offset_y = '';
$scale_z = 0.5; $scale_z = 0.5;
@ -330,7 +330,13 @@ if ($not_found) {
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:'); $table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox('dont_show_subgroups', '1', $dont_show_subgroups, true, $disabled_source); $table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox(
'dont_show_subgroups',
'1',
$dont_show_subgroups,
true,
$disabled_source
);
$methods = [ $methods = [
'twopi' => 'radial', 'twopi' => 'radial',

View File

@ -76,7 +76,10 @@ if (enterprise_installed()) {
$method = (string) get_parameter('method', 'fdp'); $method = (string) get_parameter('method', 'fdp');
$dont_show_subgroups = 0; $dont_show_subgroups = (int) get_parameter_checkbox(
'dont_show_subgroups',
0
);
$node_radius = (int) get_parameter('node_radius', 40); $node_radius = (int) get_parameter('node_radius', 40);
$description = get_parameter('description', ''); $description = get_parameter('description', '');
@ -168,7 +171,10 @@ if (enterprise_installed()) {
$description = get_parameter('description', ''); $description = get_parameter('description', '');
$values['description'] = $description; $values['description'] = $description;
$dont_show_subgroups = 0; $dont_show_subgroups = (int) get_parameter_checkbox(
'dont_show_subgroups',
0
);
$node_radius = (int) get_parameter('node_radius', 40); $node_radius = (int) get_parameter('node_radius', 40);
$row = db_get_row('tmap', 'id', $id); $row = db_get_row('tmap', 'id', $id);
$filter = json_decode($row['filter'], true); $filter = json_decode($row['filter'], true);
@ -247,7 +253,10 @@ if ($new_networkmap || $save_networkmap) {
'' ''
); );
$source = (string) get_parameter('source', 'group'); $source = (string) get_parameter('source', 'group');
$dont_show_subgroups = (int) get_parameter('dont_show_subgroups', 0); $dont_show_subgroups = (int) get_parameter_checkbox(
'dont_show_subgroups',
0
);
$node_radius = (int) get_parameter('node_radius', 40); $node_radius = (int) get_parameter('node_radius', 40);
$description = get_parameter('description', ''); $description = get_parameter('description', '');

View File

@ -384,11 +384,6 @@ if (check_acl($config['id_user'], 0, 'ER')
$sub['operation/events/events_marquee.php']['type'] = 'direct'; $sub['operation/events/events_marquee.php']['type'] = 'direct';
} }
// CSV.
$sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['text'] = __('CSV File');
$sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['id'] = 'CSV File';
$sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['type'] = 'direct';
// Sound Events. // Sound Events.
$javascript = "javascript: window.open('operation/events/sound_events.php');"; $javascript = "javascript: window.open('operation/events/sound_events.php');";
$javascript = 'javascript: alert(111);'; $javascript = 'javascript: alert(111);';

View File

@ -785,6 +785,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
`wmi_enabled` tinyint(1) unsigned DEFAULT '0', `wmi_enabled` tinyint(1) unsigned DEFAULT '0',
`auth_strings` text, `auth_strings` text,
`autoconfiguration_enabled` tinyint(1) unsigned default '0', `autoconfiguration_enabled` tinyint(1) unsigned default '0',
`summary` text,
PRIMARY KEY (`id_rt`), PRIMARY KEY (`id_rt`),
KEY `recon_task_daemon` (`id_recon_server`) KEY `recon_task_daemon` (`id_recon_server`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -834,7 +834,17 @@ sub PandoraFMS::Recon::Base::wmi_module {
sub PandoraFMS::Recon::Base::update_progress ($$) { sub PandoraFMS::Recon::Base::update_progress ($$) {
my ($self, $progress) = @_; my ($self, $progress) = @_;
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ? WHERE id_rt = ?', time (), $progress, $self->{'task_id'}); my $stats = {};
if (defined($self->{'summary'}) && $self->{'summary'} ne '') {
$stats->{'summary'} = $self->{'summary'};
}
$stats->{'step'} = $self->{'step'};
$stats->{'c_network_name'} = $self->{'c_network_name'};
$stats->{'c_network_percent'} = $self->{'c_network_percent'};
# Store progress, last contact and overall status.
db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ?, summary = ? WHERE id_rt = ?',
time (), $progress, encode_json($stats), $self->{'task_id'});
} }
1; 1;

View File

@ -15,6 +15,14 @@ use PandoraFMS::Recon::NmapParser;
use PandoraFMS::Recon::Util; use PandoraFMS::Recon::Util;
use Socket qw/inet_aton/; use Socket qw/inet_aton/;
# Constants.
use constant {
STEP_SCANNING => 1,
STEP_AFT => 2,
STEP_TRACEROUTE => 3,
STEP_GATEWAY => 4
};
# /dev/null # /dev/null
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null'; my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
@ -47,33 +55,33 @@ our $SYSUPTIME = ".1.3.6.1.2.1.1.3";
our $VTPVLANIFINDEX = ".1.3.6.1.4.1.9.9.46.1.3.1.1.18.1"; our $VTPVLANIFINDEX = ".1.3.6.1.4.1.9.9.46.1.3.1.1.18.1";
our @ISA = ("Exporter"); our @ISA = ("Exporter");
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); our %EXPORT_TAGS = ( 'all' => [qw( )] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw( our @EXPORT = qw(
$DOT1DBASEBRIDGEADDRESS $DOT1DBASEBRIDGEADDRESS
$DOT1DBASEPORTIFINDEX $DOT1DBASEPORTIFINDEX
$DOT1DTPFDBADDRESS $DOT1DTPFDBADDRESS
$DOT1DTPFDBPORT $DOT1DTPFDBPORT
$IFDESC $IFDESC
$IFHCINOCTECTS $IFHCINOCTECTS
$IFHCOUTOCTECTS $IFHCOUTOCTECTS
$IFINDEX $IFINDEX
$IFINOCTECTS $IFINOCTECTS
$IFOPERSTATUS $IFOPERSTATUS
$IFOUTOCTECTS $IFOUTOCTECTS
$IPADENTIFINDEX $IPADENTIFINDEX
$IPENTADDR $IPENTADDR
$IFNAME $IFNAME
$IPNETTOMEDIAPHYSADDRESS $IPNETTOMEDIAPHYSADDRESS
$IFPHYSADDRESS $IFPHYSADDRESS
$IPADENTIFINDEX $IPADENTIFINDEX
$IPROUTEIFINDEX $IPROUTEIFINDEX
$IPROUTENEXTHOP $IPROUTENEXTHOP
$IPROUTETYPE $IPROUTETYPE
$PRTMARKERINDEX $PRTMARKERINDEX
$SYSDESCR $SYSDESCR
$SYSSERVICES $SYSSERVICES
$SYSUPTIME $SYSUPTIME
); );
####################################################################### #######################################################################
@ -167,6 +175,18 @@ sub new {
snmp_version => 1, snmp_version => 1,
subnets => [], subnets => [],
autoconfiguration_enabled => 0, autoconfiguration_enabled => 0,
# Store progress summary - Discovery progress view.
step => 0,
c_network_name => '',
c_network_percent => 0.0,
summary => {
SNMP => 0,
WMI => 0,
discovered => 0,
alive => 0,
not_alive => 0
},
@_, @_,
}; };
@ -176,25 +196,26 @@ sub new {
# Check SNMP params id SNMP is enabled # Check SNMP params id SNMP is enabled
if ($self->{'snmp_enabled'}) { if ($self->{'snmp_enabled'}) {
# Check SNMP version # Check SNMP version
if ($self->{'snmp_version'} ne '1' && $self->{'snmp_version'} ne '2' if ( $self->{'snmp_version'} ne '1'
&& $self->{'snmp_version'} ne '2c' && $self->{'snmp_version'} ne '3' && $self->{'snmp_version'} ne '2'
) { && $self->{'snmp_version'} ne '2c'
&& $self->{'snmp_version'} ne '3') {
$self->{'snmp_enabled'} = 0; $self->{'snmp_enabled'} = 0;
$self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5); $self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5);
} }
# Check the version 3 parameters # Check the version 3 parameters
if ($self->{'snmp_version'} eq '3') { if ($self->{'snmp_version'} eq '3') {
# Fixed some vars # Fixed some vars
$self->{'communities'} = []; $self->{'communities'} = [];
# SNMP v3 checks # SNMP v3 checks
if ( if ( $self->{'snmp_security_level'} ne 'noAuthNoPriv'
$self->{'snmp_security_level'} ne 'noAuthNoPriv' && &&$self->{'snmp_security_level'} ne 'authNoPriv'
$self->{'snmp_security_level'} ne 'authNoPriv' && &&$self->{'snmp_security_level'} ne 'authPriv') {
$self->{'snmp_security_level'} ne 'authPriv'
) {
$self->{'snmp_enabled'} = 0; $self->{'snmp_enabled'} = 0;
$self->call('message', "Invalid SNMP security level " . $self->{'snmp_security_level'} . ".", 5); $self->call('message', "Invalid SNMP security level " . $self->{'snmp_security_level'} . ".", 5);
} }
@ -207,6 +228,7 @@ sub new {
$self->call('message', "Invalid SNMP authentication method " . $self->{'snmp_auth_method'} . ".", 5); $self->call('message', "Invalid SNMP authentication method " . $self->{'snmp_auth_method'} . ".", 5);
} }
} else { } else {
# Fixed some vars # Fixed some vars
$self->{'snmp_auth_user'} = ''; $self->{'snmp_auth_user'} = '';
$self->{'snmp_auth_pass'} = ''; $self->{'snmp_auth_pass'} = '';
@ -296,6 +318,7 @@ sub aft_connectivity($$) {
foreach my $mac ($self->snmp_get_value_array($switch, $DOT1DTPFDBADDRESS)) { foreach my $mac ($self->snmp_get_value_array($switch, $DOT1DTPFDBADDRESS)) {
push(@aft, parse_mac($mac)); push(@aft, parse_mac($mac));
} }
# Search for matching entries. # Search for matching entries.
foreach my $aft_mac (@aft) { foreach my $aft_mac (@aft) {
@ -309,7 +332,7 @@ sub aft_connectivity($$) {
# Get the interface associated to the port were we found the MAC address. # Get the interface associated to the port were we found the MAC address.
my $switch_if_name = $self->get_if_from_aft($switch, $aft_mac); my $switch_if_name = $self->get_if_from_aft($switch, $aft_mac);
next unless defined ($switch_if_name) and ($switch_if_name ne ''); next unless defined($switch_if_name) and ($switch_if_name ne '');
# Do not connect a host to a switch twice using the same interface. # Do not connect a host to a switch twice using the same interface.
# The switch is probably connected to another switch. # The switch is probably connected to another switch.
@ -342,8 +365,8 @@ sub are_connected($$$$$) {
$if_1 = "ping" if $if_1 eq ''; $if_1 = "ping" if $if_1 eq '';
$if_2 = "ping" if $if_2 eq ''; $if_2 = "ping" if $if_2 eq '';
if (defined($self->{'connections'}->{"${dev_1}\t${if_1}\t${dev_2}\t${if_2}"}) || if ( defined($self->{'connections'}->{"${dev_1}\t${if_1}\t${dev_2}\t${if_2}"})
defined($self->{'connections'}->{"${dev_2}\t${if_2}\t${dev_1}\t${if_1}"})) { ||defined($self->{'connections'}->{"${dev_2}\t${if_2}\t${dev_1}\t${if_1}"})) {
return 1; return 1;
} }
@ -367,19 +390,20 @@ sub snmp_discovery($$) {
# Try to find the MAC with an ARP request. # Try to find the MAC with an ARP request.
$self->get_mac_from_ip($device); $self->get_mac_from_ip($device);
# Check if the device responds to SNMP. # Check if the device responds to SNMP.
if ($self->snmp_responds($device)) { if ($self->snmp_responds($device)) {
$self->{'summary'}->{'SNMP'} += 1;
# Fill the VLAN cache. # Fill the VLAN cache.
$self->find_vlans($device); $self->find_vlans($device);
# Guess the device type. # Guess the device type.
$self->guess_device_type($device); $self->guess_device_type($device);
# Find aliases for the device. # Find aliases for the device.
$self->find_aliases($device); $self->find_aliases($device);
# Find interfaces for the device. # Find interfaces for the device.
$self->find_ifaces($device); $self->find_ifaces($device);
@ -655,12 +679,12 @@ sub get_if_from_ip($$$) {
# Get the port associated to the IP address. # Get the port associated to the IP address.
my $if_index = $self->snmp_get_value($device, "$IPROUTEIFINDEX.$ip_addr"); my $if_index = $self->snmp_get_value($device, "$IPROUTEIFINDEX.$ip_addr");
return '' unless defined ($if_index); return '' unless defined($if_index);
# Get the name of the interface associated to the port. # Get the name of the interface associated to the port.
my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index"); my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index");
return '' unless defined ($if_name); return '' unless defined($if_name);
$if_name =~ s/"//g; $if_name =~ s/"//g;
return $if_name; return $if_name;
} }
@ -686,12 +710,12 @@ sub get_if_from_mac($$$) {
# Get the name of the interface associated to the port. # Get the name of the interface associated to the port.
my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index"); my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index");
return '' unless defined ($if_name); return '' unless defined($if_name);
$if_name =~ s/"//g; $if_name =~ s/"//g;
return $if_name; return $if_name;
} }
return ''; return '';
} }
@ -718,13 +742,13 @@ sub get_if_from_port($$$) {
######################################################################################## ########################################################################################
sub get_if_ip($$$) { sub get_if_ip($$$) {
my ($self, $device, $if_index) = @_; my ($self, $device, $if_index) = @_;
my @output = $self->snmp_get($device, $IPADENTIFINDEX); my @output = $self->snmp_get($device, $IPADENTIFINDEX);
foreach my $line (@output) { foreach my $line (@output) {
chomp ($line); chomp($line);
return $1 if ($line =~ m/^$IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/); return $1 if ($line =~ m/^$IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/);
} }
return ''; return '';
} }
@ -748,7 +772,7 @@ sub get_if_mac($$$) {
######################################################################################## ########################################################################################
sub get_if_type($$$) { sub get_if_type($$$) {
my ($self, $device, $if_index) = @_; my ($self, $device, $if_index) = @_;
my $type = $self->snmp_get_value($device, "$IFTYPE.$if_index"); my $type = $self->snmp_get_value($device, "$IFTYPE.$if_index");
return '' unless defined($type); return '' unless defined($type);
@ -769,7 +793,7 @@ sub get_ip_from_mac($$) {
} }
######################################################################################## ########################################################################################
# Attemtps to find # Attemtps to find
######################################################################################## ########################################################################################
sub get_mac_from_ip($$) { sub get_mac_from_ip($$) {
my ($self, $host) = @_; my ($self, $host) = @_;
@ -824,7 +848,7 @@ sub get_routes($) {
} }
# Replace 0.0.0.0 with the default gateway's IP. # Replace 0.0.0.0 with the default gateway's IP.
return unless defined ($self->{'default_gw'}); return unless defined($self->{'default_gw'});
foreach my $route (@{$self->{'routes'}}) { foreach my $route (@{$self->{'routes'}}) {
$route->{gw} = $self->{'default_gw'} if ($route->{'gw'} eq '0.0.0.0'); $route->{gw} = $self->{'default_gw'} if ($route->{'gw'} eq '0.0.0.0');
} }
@ -906,12 +930,15 @@ sub guess_device_type($$) {
# L2? # L2?
my $device_type; my $device_type;
if ($service_bits[1] == 1) { if ($service_bits[1] == 1) {
# L3? # L3?
if ($service_bits[2] == 1) { if ($service_bits[2] == 1) {
# Bridge MIB? # Bridge MIB?
if (defined($bridge_mib)) { if (defined($bridge_mib)) {
$device_type = 'switch'; $device_type = 'switch';
} else { } else {
# L7? # L7?
if ($service_bits[6] == 1) { if ($service_bits[6] == 1) {
$device_type = 'host'; $device_type = 'host';
@ -919,8 +946,8 @@ sub guess_device_type($$) {
$device_type = 'router'; $device_type = 'router';
} }
} }
} }else {
else {
# Bridge MIB? # Bridge MIB?
if (defined($bridge_mib)) { if (defined($bridge_mib)) {
$device_type = 'switch'; $device_type = 'switch';
@ -928,14 +955,16 @@ sub guess_device_type($$) {
$device_type = 'host'; $device_type = 'host';
} }
} }
} }else {
else {
# L3? # L3?
if ($service_bits[2] == 1) { if ($service_bits[2] == 1) {
# L4? # L4?
if ($service_bits[3] == 1) { if ($service_bits[3] == 1) {
$device_type = 'switch'; $device_type = 'switch';
} else { } else {
# L7? # L7?
if ($service_bits[6] == 1) { if ($service_bits[6] == 1) {
$device_type = 'host'; $device_type = 'host';
@ -943,8 +972,8 @@ sub guess_device_type($$) {
$device_type = 'router'; $device_type = 'router';
} }
} }
} }else {
else {
# Printer MIB? # Printer MIB?
my $printer_mib = $self->snmp_get_value($device, $PRTMARKERINDEX); my $printer_mib = $self->snmp_get_value($device, $PRTMARKERINDEX);
if (defined($printer_mib)) { if (defined($printer_mib)) {
@ -1016,7 +1045,7 @@ sub is_switch_connected($$$) {
# Check for aliases! # Check for aliases!
$device = $self->{'aliases'}->{$device} if defined($self->{'aliases'}->{$device}); $device = $self->{'aliases'}->{$device} if defined($self->{'aliases'}->{$device});
return 1 if defined ($self->{'switch_to_switch'}->{"${device}\t${iface}"}); return 1 if defined($self->{'switch_to_switch'}->{"${device}\t${iface}"});
return 0; return 0;
} }
@ -1069,8 +1098,8 @@ sub mark_connected($$;$$$) {
} }
# Prevent parent-child loops. # Prevent parent-child loops.
if (!defined($self->{'parents'}->{$parent}) || if (!defined($self->{'parents'}->{$parent})
$self->{'parents'}->{$parent} ne $child) { ||$self->{'parents'}->{$parent} ne $child) {
# A parent-child relationship is always created to help complete the map with # A parent-child relationship is always created to help complete the map with
# layer 3 information. # layer 3 information.
@ -1097,8 +1126,10 @@ sub mark_switch_connected($$$) {
sub mark_visited($$) { sub mark_visited($$) {
my ($self, $device) = @_; my ($self, $device) = @_;
$self->{'visited_devices'}->{$device} = { 'addr' => { $device => '' }, $self->{'visited_devices'}->{$device} = {
'type' => 'host' }; 'addr' => { $device => '' },
'type' => 'host'
};
} }
######################################################################################## ########################################################################################
@ -1121,8 +1152,8 @@ sub snmp_responds($$) {
return 1 if($self->is_snmp_discovered($device)); return 1 if($self->is_snmp_discovered($device));
return ($self->{'snmp_version'} eq "3") return ($self->{'snmp_version'} eq "3")
? $self->snmp_responds_v3($device) ? $self->snmp_responds_v3($device)
: $self->snmp_responds_v122c($device); : $self->snmp_responds_v122c($device);
} }
######################################################################################## ########################################################################################
@ -1221,11 +1252,7 @@ sub remote_arp($$) {
############################################################################## ##############################################################################
sub ping ($$$) { sub ping ($$$) {
my ($self, $host) = @_; my ($self, $host) = @_;
my ($timeout, $retries, $packets) = ( my ($timeout, $retries, $packets) = ($self->{'icmp_timeout'},$self->{'icmp_checks'},1,);
$self->{'icmp_timeout'},
$self->{'icmp_checks'},
1,
);
# Windows # Windows
if (($^O eq "MSWin32") || ($^O eq "MSWin32-x64") || ($^O eq "cygwin")){ if (($^O eq "MSWin32") || ($^O eq "MSWin32-x64") || ($^O eq "cygwin")){
@ -1237,11 +1264,12 @@ sub ping ($$$) {
return 0; return 0;
} }
# Solaris # Solaris
if ($^O eq "solaris"){ if ($^O eq "solaris"){
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping -A inet6" : "ping"; my $ping_command = $host =~ /\d+:|:\d+/ ? "ping -A inet6" : "ping";
for (my $i = 0; $i < $retries; $i++) { for (my $i = 0; $i < $retries; $i++) {
# Note: There is no timeout option. # Note: There is no timeout option.
`$ping_command -s -n $host 56 $packets >/dev/null 2>&1`; `$ping_command -s -n $host 56 $packets >/dev/null 2>&1`;
return 1 if ($? == 0); return 1 if ($? == 0);
@ -1249,11 +1277,12 @@ sub ping ($$$) {
return 0; return 0;
} }
# FreeBSD # FreeBSD
if ($^O eq "freebsd"){ if ($^O eq "freebsd"){
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -t $timeout"; my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -t $timeout";
for (my $i = 0; $i < $retries; $i++) { for (my $i = 0; $i < $retries; $i++) {
# Note: There is no timeout option for ping6. # Note: There is no timeout option for ping6.
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`; `$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
return 1 if ($? == 0); return 1 if ($? == 0);
@ -1263,9 +1292,10 @@ sub ping ($$$) {
} }
# NetBSD # NetBSD
if ($^O eq "netbsd"){ if ($^O eq "netbsd"){
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -w $timeout"; my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -w $timeout";
for (my $i = 0; $i < $retries; $i++) { for (my $i = 0; $i < $retries; $i++) {
# Note: There is no timeout option for ping6. # Note: There is no timeout option for ping6.
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`; `$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
if ($? == 0) { if ($? == 0) {
@ -1275,11 +1305,11 @@ sub ping ($$$) {
return 0; return 0;
} }
# Assume Linux by default. # Assume Linux by default.
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping"; my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping";
for (my $i = 0; $i < $retries; $i++) { for (my $i = 0; $i < $retries; $i++) {
`$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`; `$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`;
return 1 if ($? == 0); return 1 if ($? == 0);
} }
@ -1295,11 +1325,13 @@ sub scan_subnet($) {
my @subnets = @{$self->get_subnets()}; my @subnets = @{$self->get_subnets()};
foreach my $subnet (@subnets) { foreach my $subnet (@subnets) {
$self->{'c_network_percent'} = 0;
$self->{'c_network_name'} = $subnet;
# Clean blanks. # Clean blanks.
$subnet =~ s/\s+//g; $subnet =~ s/\s+//g;
my $net_addr = new NetAddr::IP ($subnet); my $net_addr = new NetAddr::IP($subnet);
if (!defined($net_addr)) { if (!defined($net_addr)) {
$self->call('message', "Invalid network: $subnet", 3); $self->call('message', "Invalid network: $subnet", 3);
next; next;
@ -1312,46 +1344,68 @@ sub scan_subnet($) {
# fping scan. # fping scan.
if (-x $self->{'fping'} && $net_addr->num() > 1) { if (-x $self->{'fping'} && $net_addr->num() > 1) {
$self->call('message', "Calling fping...", 5); $self->call('message', "Calling fping...", 5);
my @hosts = `"$self->{'fping'}" -ga "$subnet" 2>DEVNULL`; my @hosts = `"$self->{'fping'}" -ga "$subnet" 2>DEVNULL`;
next if (scalar(@hosts) == 0); next if (scalar(@hosts) == 0);
$self->{'summary'}->{'discovered'} += scalar(@hosts);
my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx. my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx.
my $subnet_step = 100.0 / scalar(@hosts);
foreach my $line (@hosts) { foreach my $line (@hosts) {
chomp($line); chomp($line);
my @temp = split(/ /, $line); my @temp = split(/ /, $line);
next if (scalar(@temp) != 1); # Junk is shown for broadcast addresses. if (scalar(@temp) != 1) {
# Junk is shown for broadcast addresses.
# Increase summary.not_alive hosts.
$self->{'summary'}->{'not_alive'} += 1;
next;
}
my $host = $temp[0]; my $host = $temp[0];
# Skip network and broadcast addresses. # Skip network and broadcast addresses.
next if ($host eq $network->addr() || $host eq $broadcast->addr()); next if ($host eq $network->addr() || $host eq $broadcast->addr());
# Increase self summary.alive hosts.
$self->{'summary'}->{'alive'} += 1;
$self->call('message', "Scanning host: $host", 5); $self->call('message', "Scanning host: $host", 5);
$self->call('update_progress', ceil($progress)); $self->call('update_progress', ceil($progress));
$progress += $step; $progress += $step;
$self->{'c_network_percent'} += $subnet_step;
$self->snmp_discovery($host); $self->snmp_discovery($host);
# Add wmi scan if enabled. # Add wmi scan if enabled.
$self->wmi_scan($host) if ($self->{'wmi_enabled'} == 1); $self->wmi_scan($host) if ($self->{'wmi_enabled'} == 1);
} }
} }
# ping scan. # ping scan.
else { else {
my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum; my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum;
next if (scalar(@hosts) == 0); next if (scalar(@hosts) == 0);
$self->{'summary'}->{'discovered'} += scalar(@hosts);
my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx. my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx.
my $subnet_step = 100.0 / scalar(@hosts);
foreach my $host (@hosts) { foreach my $host (@hosts) {
$self->call('message', "Scanning host: $host", 5); $self->call('message', "Scanning host: $host", 5);
$self->call('update_progress', ceil($progress)); $self->call('update_progress', ceil($progress));
$progress += $step; $progress += $step;
# Check if the host is up. # Check if the host is up.
next if ($self->ping($host) == 0); if ($self->ping($host) == 0) {
$self->{'summary'}->{'not_alive'} += 1;
next;
}
$self->{'summary'}->{'alive'} += 1;
$self->{'c_network_percent'} += $subnet_step;
$self->snmp_discovery($host); $self->snmp_discovery($host);
# Add wmi scan if enabled. # Add wmi scan if enabled.
@ -1373,6 +1427,8 @@ sub scan($) {
# Find devices. # Find devices.
$self->call('message', "[1/5] Scanning the network...", 3); $self->call('message', "[1/5] Scanning the network...", 3);
$self->{'step'} = STEP_SCANNING;
$self->call('update_progress', $progress);
$self->scan_subnet(); $self->scan_subnet();
# Read the local ARP cache. # Read the local ARP cache.
@ -1381,20 +1437,23 @@ sub scan($) {
# Get a list of found hosts. # Get a list of found hosts.
my @hosts = @{$self->get_hosts()}; my @hosts = @{$self->get_hosts()};
if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) { if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) {
# Delete previous connections.
# Delete previous connections.
$self->call('delete_connections'); $self->call('delete_connections');
# Connectivity from address forwarding tables. # Connectivity from address forwarding tables.
$self->call('message', "[1/4] Finding address forwarding table connectivity...", 3); $self->call('message', "[1/4] Finding address forwarding table connectivity...", 3);
$self->{'step'} = STEP_AFT;
($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%. ($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%.
for (my $i = 0; defined($hosts[$i]); $i++) { for (my $i = 0; defined($hosts[$i]); $i++) {
$self->call('update_progress', $progress); $self->call('update_progress', $progress);
$progress += $step; $progress += $step;
$self->aft_connectivity($hosts[$i]); $self->aft_connectivity($hosts[$i]);
} }
# Connect hosts that are still unconnected using traceroute. # Connect hosts that are still unconnected using traceroute.
$self->call('message', "[3/4] Finding traceroute connectivity.", 3); $self->call('message', "[3/4] Finding traceroute connectivity.", 3);
$self->{'step'} = STEP_TRACEROUTE;
($progress, $step) = (70, 20.0 / scalar(@hosts)); # From 70% to 90%. ($progress, $step) = (70, 20.0 / scalar(@hosts)); # From 70% to 90%.
foreach my $host (@hosts) { foreach my $host (@hosts) {
$self->call('update_progress', $progress); $self->call('update_progress', $progress);
@ -1402,9 +1461,10 @@ sub scan($) {
next if ($self->has_parent($host) || $self->has_children($host)); next if ($self->has_parent($host) || $self->has_children($host));
$self->traceroute_connectivity($host); $self->traceroute_connectivity($host);
} }
# Connect hosts that are still unconnected using known gateways. # Connect hosts that are still unconnected using known gateways.
$self->call('message', "[4/4] Finding host to gateway connectivity.", 3); $self->call('message', "[4/4] Finding host to gateway connectivity.", 3);
$self->{'step'} = STEP_GATEWAY;
($progress, $step) = (90, 10.0 / scalar(@hosts)); # From 70% to 90%. ($progress, $step) = (90, 10.0 / scalar(@hosts)); # From 70% to 90%.
$self->get_routes(); # Update the route cache. $self->get_routes(); # Update the route cache.
foreach my $host (@hosts) { foreach my $host (@hosts) {
@ -1416,8 +1476,9 @@ sub scan($) {
} }
# Done! # Done!
$self->{'step'} = '';
$self->call('update_progress', -1); $self->call('update_progress', -1);
# Print debug information on found devices. # Print debug information on found devices.
$self->call('message', "[Summary]", 3); $self->call('message', "[Summary]", 3);
foreach my $host (@hosts) { foreach my $host (@hosts) {
@ -1425,7 +1486,7 @@ sub scan($) {
next unless defined($device); next unless defined($device);
# Print device information. # Print device information.
my $dev_info = "Device: " . $device->{'type'} . " ("; my $dev_info = "Device: " . $device->{'type'} . " (";
foreach my $ip_address ($self->get_addresses($host)) { foreach my $ip_address ($self->get_addresses($host)) {
$dev_info .= "$ip_address,"; $dev_info .= "$ip_address,";
} }
@ -1473,8 +1534,8 @@ sub snmp_get($$$) {
if (scalar(@vlans) == 0) { if (scalar(@vlans) == 0) {
my $command = $self->snmp_get_command($device, $oid, $community); my $command = $self->snmp_get_command($device, $oid, $community);
@output = `$command`; @output = `$command`;
} }else {
else {
# Handle duplicate lines. # Handle duplicate lines.
my %output_hash; my %output_hash;
foreach my $vlan (@vlans) { foreach my $vlan (@vlans) {
@ -1528,7 +1589,7 @@ sub snmp_get_value($$$) {
my @output = $self->snmp_get($device, $oid); my @output = $self->snmp_get($device, $oid);
foreach my $line (@output) { foreach my $line (@output) {
chomp ($line); chomp($line);
return $1 if ($line =~ /^$oid\s+=\s+\S+:\s+(.*)$/); return $1 if ($line =~ /^$oid\s+=\s+\S+:\s+(.*)$/);
} }
@ -1544,7 +1605,7 @@ sub snmp_get_value_array($$$) {
my @output = $self->snmp_get($device, $oid); my @output = $self->snmp_get($device, $oid);
foreach my $line (@output) { foreach my $line (@output) {
chomp ($line); chomp($line);
push(@values, $1) if ($line =~ /^$oid\S*\s+=\s+\S+:\s+(.*)$/); push(@values, $1) if ($line =~ /^$oid\S*\s+=\s+\S+:\s+(.*)$/);
} }
@ -1575,22 +1636,20 @@ sub traceroute_connectivity($$) {
# Perform a traceroute. # Perform a traceroute.
my $nmap_args = '-nsP -PE --traceroute --max-retries '.$self->{'icmp_checks'}.' --host-timeout '.$self->{'icmp_timeout'}.'s -T'.$self->{'recon_timing_template'}; my $nmap_args = '-nsP -PE --traceroute --max-retries '.$self->{'icmp_checks'}.' --host-timeout '.$self->{'icmp_timeout'}.'s -T'.$self->{'recon_timing_template'};
my $np = PandoraFMS::Recon::NmapParser->new(); my $np = PandoraFMS::Recon::NmapParser->new();
eval { eval {$np->parsescan($self->{'nmap'}, $nmap_args, ($host));};
$np->parsescan($self->{'nmap'}, $nmap_args, ($host));
};
return if ($@); return if ($@);
# Get hops to the host. # Get hops to the host.
my ($h) = $np->all_hosts (); my ($h) = $np->all_hosts();
return unless defined ($h); return unless defined($h);
my @hops = $h->all_trace_hops (); my @hops = $h->all_trace_hops();
# Skip the target host. # Skip the target host.
pop(@hops); pop(@hops);
# Reverse the host order (closest hosts first). # Reverse the host order (closest hosts first).
@hops = reverse(@hops); @hops = reverse(@hops);
# Look for parents. # Look for parents.
my $device = $host; my $device = $host;
for (my $i = 0; $i < $self->{'parent_recursion'}; $i++) { for (my $i = 0; $i < $self->{'parent_recursion'}; $i++) {
@ -1601,7 +1660,7 @@ sub traceroute_connectivity($$) {
$self->call('create_agent', $parent); $self->call('create_agent', $parent);
$self->call('message', "Host $device is one hop away from host $parent.", 5); $self->call('message', "Host $device is one hop away from host $parent.", 5);
$self->mark_connected($parent, '', $device, ''); $self->mark_connected($parent, '', $device, '');
# Move on to the next hop. # Move on to the next hop.
$device = $parent; $device = $parent;
@ -1643,7 +1702,10 @@ sub wmi_scan {
my $auth = $self->responds_to_wmi($target); my $auth = $self->responds_to_wmi($target);
return unless defined($auth); return unless defined($auth);
$self->{'summary'}->{'WMI'} += 1;
$self->call('message', "[".$target."] WMI available.", 10); $self->call('message', "[".$target."] WMI available.", 10);
# Create the agent if it does not exist. # Create the agent if it does not exist.
my $agent_id = $self->call('create_agent', $target); my $agent_id = $self->call('create_agent', $target);
next unless defined($agent_id); next unless defined($agent_id);
@ -1651,56 +1713,19 @@ sub wmi_scan {
# CPU. # CPU.
my @cpus = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceId FROM Win32_Processor', 0); my @cpus = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceId FROM Win32_Processor', 0);
foreach my $cpu (@cpus) { foreach my $cpu (@cpus) {
$self->call( $self->call('wmi_module',($agent_id,$target,"SELECT LoadPercentage FROM Win32_Processor WHERE DeviceId='$cpu'",$auth,1,"CPU Load $cpu","Load for $cpu (%)",'generic_data'));
'wmi_module',
(
$agent_id,
$target,
"SELECT LoadPercentage FROM Win32_Processor WHERE DeviceId='$cpu'",
$auth,
1,
"CPU Load $cpu",
"Load for $cpu (%)",
'generic_data'
)
);
} }
# Memory. # Memory.
my $mem = $self->wmi_get_value($target, $auth, 'SELECT FreePhysicalMemory FROM Win32_OperatingSystem', 0); my $mem = $self->wmi_get_value($target, $auth, 'SELECT FreePhysicalMemory FROM Win32_OperatingSystem', 0);
if (defined($mem)) { if (defined($mem)) {
$self->call('wmi_module', $self->call('wmi_module',($agent_id,$target,"SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",$auth,0,'FreeMemory','Free memory','generic_data','KB'));
(
$agent_id,
$target,
"SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",
$auth,
0,
'FreeMemory',
'Free memory',
'generic_data',
'KB'
)
);
} }
# Disk. # Disk.
my @units = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceID FROM Win32_LogicalDisk', 0); my @units = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceID FROM Win32_LogicalDisk', 0);
foreach my $unit (@units) { foreach my $unit (@units) {
$self->call( $self->call('wmi_module',($agent_id,$target,"SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID='$unit'",$auth,1,"FreeDisk $unit",'Available disk space in kilobytes','generic_data','KB'));
'wmi_module',
(
$agent_id,
$target,
"SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID='$unit'",
$auth,
1,
"FreeDisk $unit",
'Available disk space in kilobytes',
'generic_data',
'KB'
)
);
} }
} }