2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_networkmap.php, include/functions_netflow.php, extensions/snmp_explorer.php, operation/netflow/nf_live_view.php, operation/agentes/estado_monitores.php, operation/agentes/networkmap.php, godmode/netflow/nf_report_form.php, godmode/netflow/nf_edit_form.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6760 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f2c0c0762f
commit
2cbd2b69bf
|
@ -1,3 +1,12 @@
|
|||
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_networkmap.php, include/functions_netflow.php,
|
||||
extensions/snmp_explorer.php, operation/netflow/nf_live_view.php,
|
||||
operation/agentes/estado_monitores.php,
|
||||
operation/agentes/networkmap.php,
|
||||
godmode/netflow/nf_report_form.php,
|
||||
godmode/netflow/nf_edit_form.php: cleaned source code style.
|
||||
|
||||
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* install.php, operation/reporting/reporting_xml.php,
|
||||
|
|
|
@ -22,194 +22,194 @@ require_once ('include/functions_reporting.php');
|
|||
require_once ('include/graphs/functions_utils.php');
|
||||
|
||||
function snmp_explorer() {
|
||||
|
||||
$idAgent = (int) get_parameter('id_agente', 0);
|
||||
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
|
||||
check_login ();
|
||||
|
||||
$ip_target = (string) get_parameter ('ip_target', $ipAgent);
|
||||
$snmp_community = (string) get_parameter ('snmp_community', 'public');
|
||||
$snmp_version = get_parameter('snmp_version', '1');
|
||||
$snmp3_auth_user = get_parameter('snmp3_auth_user');
|
||||
$snmp3_security_level = get_parameter('snmp3_security_level');
|
||||
$snmp3_auth_method = get_parameter('snmp3_auth_method');
|
||||
$snmp3_auth_pass = get_parameter('snmp3_auth_pass');
|
||||
$snmp3_privacy_method = get_parameter('snmp3_privacy_method');
|
||||
$snmp3_privacy_pass = get_parameter('snmp3_privacy_pass');
|
||||
$tcp_port = (string) get_parameter ('tcp_port');
|
||||
|
||||
//See if id_agente is set (either POST or GET, otherwise -1
|
||||
$id_agent = $idAgent;
|
||||
|
||||
// Get passed variables
|
||||
$snmpwalk = (int) get_parameter("snmpwalk", 0);
|
||||
$create_modules = (int) get_parameter("create_modules", 0);
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
if($snmpwalk) {
|
||||
|
||||
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
|
||||
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
|
||||
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1", $tcp_port);
|
||||
|
||||
if($snmpis === false) {
|
||||
$snmpis = array();
|
||||
}
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
// We get here only the interface part of the MIB, not full mib
|
||||
foreach($snmpis as $key => $snmp) {
|
||||
|
||||
$data = explode(': ',$snmp);
|
||||
$keydata = explode('::',$key);
|
||||
$keydata2 = explode('.',$keydata[1]);
|
||||
$idAgent = (int) get_parameter('id_agente', 0);
|
||||
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
|
||||
check_login ();
|
||||
|
||||
$ip_target = (string) get_parameter ('ip_target', $ipAgent);
|
||||
$snmp_community = (string) get_parameter ('snmp_community', 'public');
|
||||
$snmp_version = get_parameter('snmp_version', '1');
|
||||
$snmp3_auth_user = get_parameter('snmp3_auth_user');
|
||||
$snmp3_security_level = get_parameter('snmp3_security_level');
|
||||
$snmp3_auth_method = get_parameter('snmp3_auth_method');
|
||||
$snmp3_auth_pass = get_parameter('snmp3_auth_pass');
|
||||
$snmp3_privacy_method = get_parameter('snmp3_privacy_method');
|
||||
$snmp3_privacy_pass = get_parameter('snmp3_privacy_pass');
|
||||
$tcp_port = (string) get_parameter ('tcp_port');
|
||||
|
||||
//See if id_agente is set (either POST or GET, otherwise -1
|
||||
$id_agent = $idAgent;
|
||||
|
||||
// Get passed variables
|
||||
$snmpwalk = (int) get_parameter("snmpwalk", 0);
|
||||
$create_modules = (int) get_parameter("create_modules", 0);
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
if($snmpwalk) {
|
||||
|
||||
if(!isset($keydata2[1])) {
|
||||
continue;
|
||||
}
|
||||
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
|
||||
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
|
||||
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1", $tcp_port);
|
||||
|
||||
if(array_key_exists(1,$data)){
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
}else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
|
||||
}
|
||||
if($snmpis === false) {
|
||||
$snmpis = array();
|
||||
}
|
||||
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['oid'] = $key;
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['checked'] = 0;
|
||||
}
|
||||
$interfaces = array();
|
||||
|
||||
unset($interfaces[0]);
|
||||
}
|
||||
|
||||
if($create_modules) {
|
||||
$id_snmp_serialize = get_parameter_post('id_snmp_serialize');
|
||||
$interfaces = unserialize_in_temp($id_snmp_serialize);
|
||||
|
||||
if(!$interfaces) {
|
||||
// We get here only the interface part of the MIB, not full mib
|
||||
foreach($snmpis as $key => $snmp) {
|
||||
|
||||
$data = explode(': ',$snmp);
|
||||
$keydata = explode('::',$key);
|
||||
$keydata2 = explode('.',$keydata[1]);
|
||||
|
||||
if(!isset($keydata2[1])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(array_key_exists(1,$data)) {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
}
|
||||
else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
|
||||
}
|
||||
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['oid'] = $key;
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['checked'] = 0;
|
||||
}
|
||||
|
||||
unset($interfaces[0]);
|
||||
}
|
||||
|
||||
if ($create_modules) {
|
||||
$id_snmp_serialize = get_parameter_post('id_snmp_serialize');
|
||||
$interfaces = unserialize_in_temp($id_snmp_serialize);
|
||||
|
||||
if(!$interfaces) {
|
||||
$interfaces = array();
|
||||
}
|
||||
|
||||
$values = array();
|
||||
|
||||
if($tcp_port != ''){
|
||||
$values['tcp_port'] = $tcp_port;
|
||||
}
|
||||
$values['snmp_community'] = $snmp_community;
|
||||
$values['ip_target'] = $ip_target;
|
||||
$values['tcp_send'] = $snmp_version;
|
||||
|
||||
if($snmp_version == '3') {
|
||||
$values['plugin_user'] = $snmp3_auth_user;
|
||||
$values['plugin_pass'] = $snmp3_auth_pass;
|
||||
$values['plugin_parameter'] = $snmp3_auth_method;
|
||||
$values['custom_string_1'] = $snmp3_privacy_method;
|
||||
$values['custom_string_2'] = $snmp3_privacy_pass;
|
||||
$values['custom_string_3'] = $snmp3_security_level;
|
||||
}
|
||||
|
||||
$oids = array();
|
||||
foreach($interfaces as $key => $interface) {
|
||||
foreach($interface as $key2 => $module) {
|
||||
$oid = get_parameter($key."-".$key2, '');
|
||||
if($oid != '') {
|
||||
$interfaces[$key][$key2]['checked'] = 1;
|
||||
$oids[$key][] = $interfaces[$key][$key2]['oid'];
|
||||
}
|
||||
else {
|
||||
$interfaces[$key][$key2]['checked'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$modules = get_parameter('module', array());
|
||||
$id_snmp = get_parameter('id_snmp');
|
||||
|
||||
if($id_snmp == false) {
|
||||
ui_print_error_message (__('No modules selected'));
|
||||
$id_snmp = array();
|
||||
}
|
||||
|
||||
if(agents_get_name($id_agent) == false) {
|
||||
ui_print_error_message (__('No agent selected or the agent does not exist'));
|
||||
$id_snmp = array();
|
||||
}
|
||||
|
||||
$result = false;
|
||||
|
||||
$values = array();
|
||||
|
||||
if($tcp_port != '') {
|
||||
$values['tcp_port'] = $tcp_port;
|
||||
}
|
||||
$values['snmp_community'] = $snmp_community;
|
||||
$values['ip_target'] = $ip_target;
|
||||
$values['tcp_send'] = $snmp_version;
|
||||
|
||||
if($snmp_version == '3') {
|
||||
$values['plugin_user'] = $snmp3_auth_user;
|
||||
$values['plugin_pass'] = $snmp3_auth_pass;
|
||||
$values['plugin_parameter'] = $snmp3_auth_method;
|
||||
$values['custom_string_1'] = $snmp3_privacy_method;
|
||||
$values['custom_string_2'] = $snmp3_privacy_pass;
|
||||
$values['custom_string_3'] = $snmp3_security_level;
|
||||
}
|
||||
|
||||
$oids = array();
|
||||
foreach($interfaces as $key => $interface) {
|
||||
foreach($interface as $key2 => $module) {
|
||||
$oid = get_parameter($key."-".$key2, '');
|
||||
if($oid != '') {
|
||||
$interfaces[$key][$key2]['checked'] = 1;
|
||||
$oids[$key][] = $interfaces[$key][$key2]['oid'];
|
||||
}
|
||||
else {
|
||||
$interfaces[$key][$key2]['checked'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$modules = get_parameter('module', array());
|
||||
$id_snmp = get_parameter('id_snmp');
|
||||
|
||||
if($id_snmp == false) {
|
||||
ui_print_error_message (__('No modules selected'));
|
||||
$id_snmp = array();
|
||||
}
|
||||
|
||||
if(agents_get_name($id_agent) == false) {
|
||||
ui_print_error_message (__('No agent selected or the agent does not exist'));
|
||||
$id_snmp = array();
|
||||
}
|
||||
|
||||
$result = false;
|
||||
|
||||
$errors = array();
|
||||
$done = 0;
|
||||
|
||||
foreach($id_snmp as $id) {
|
||||
|
||||
foreach($id_snmp as $id) {
|
||||
if (isset($interfaces[$id]['ifName']) && $interfaces[$id]['ifName']['value'] != ""){
|
||||
$ifname = $interfaces[$id]['ifName']['value'];
|
||||
$ifname = $interfaces[$id]['ifName']['value'];
|
||||
}
|
||||
else if (isset($interfaces[$id]['ifDescr']) && $interfaces[$id]['ifDescr']['value'] != ""){
|
||||
$ifname = $interfaces[$id]['ifDescr']['value'];
|
||||
$ifname = $interfaces[$id]['ifDescr']['value'];
|
||||
}
|
||||
foreach($modules as $module) {
|
||||
|
||||
$oid_array = explode('.',$module);
|
||||
$oid_array[count($oid_array)-1] = $id;
|
||||
$oid = implode('.',$oid_array);
|
||||
|
||||
// Get the name
|
||||
$name_array = explode('::',$oid_array[0]);
|
||||
$name = $name_array[1] . "_" . $ifname;
|
||||
|
||||
// Clean the name
|
||||
$name = str_replace ( "\"" , "" , $name);
|
||||
|
||||
// Proc moduletypes
|
||||
if (preg_match ( "/Status/", $name_array[1]))
|
||||
$module_type = 18;
|
||||
|
||||
elseif (preg_match ( "/Present/", $name_array[1]))
|
||||
$module_type = 18;
|
||||
|
||||
elseif (preg_match ( "/PromiscuousMode/", $name_array[1]))
|
||||
$module_type = 18;
|
||||
|
||||
// String moduletypes
|
||||
elseif (preg_match ( "/Alias/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Address/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Name/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Specific/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Descr/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
// Specific counters (ends in s)
|
||||
elseif (preg_match ( "/s$/", $name_array[1]))
|
||||
$module_type = 16;
|
||||
|
||||
// Otherwise, numeric
|
||||
else
|
||||
$module_type = 15;
|
||||
|
||||
$values['id_tipo_modulo'] = $module_type;
|
||||
$values['descripcion'] = io_safe_input("(" . $ip_target." - ".$name . ") " . $interfaces[$id]['ifDescr']['value']);
|
||||
|
||||
$values['snmp_oid'] = $oid;
|
||||
$values['id_modulo'] = 2;
|
||||
|
||||
$result = modules_create_agent_module ($id_agent, io_safe_input($name), $values);
|
||||
|
||||
if(is_error($result)) {
|
||||
foreach($modules as $module) {
|
||||
$oid_array = explode('.',$module);
|
||||
$oid_array[count($oid_array)-1] = $id;
|
||||
$oid = implode('.',$oid_array);
|
||||
|
||||
// Get the name
|
||||
$name_array = explode('::',$oid_array[0]);
|
||||
$name = $name_array[1] . "_" . $ifname;
|
||||
|
||||
// Clean the name
|
||||
$name = str_replace ( "\"" , "" , $name);
|
||||
|
||||
// Proc moduletypes
|
||||
if (preg_match ( "/Status/", $name_array[1]))
|
||||
$module_type = 18;
|
||||
|
||||
elseif (preg_match ( "/Present/", $name_array[1]))
|
||||
$module_type = 18;
|
||||
|
||||
elseif (preg_match ( "/PromiscuousMode/", $name_array[1]))
|
||||
$module_type = 18;
|
||||
|
||||
// String moduletypes
|
||||
elseif (preg_match ( "/Alias/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Address/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Name/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Specific/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
elseif (preg_match ( "/Descr/", $name_array[1]))
|
||||
$module_type = 17;
|
||||
|
||||
// Specific counters (ends in s)
|
||||
elseif (preg_match ( "/s$/", $name_array[1]))
|
||||
$module_type = 16;
|
||||
|
||||
// Otherwise, numeric
|
||||
else
|
||||
$module_type = 15;
|
||||
|
||||
$values['id_tipo_modulo'] = $module_type;
|
||||
$values['descripcion'] = io_safe_input("(" . $ip_target." - ".$name . ") " . $interfaces[$id]['ifDescr']['value']);
|
||||
|
||||
$values['snmp_oid'] = $oid;
|
||||
$values['id_modulo'] = 2;
|
||||
|
||||
$result = modules_create_agent_module ($id_agent, io_safe_input($name), $values);
|
||||
|
||||
if (is_error($result)) {
|
||||
if(!isset($errors[$result])) {
|
||||
$errors[$result] = 0;
|
||||
}
|
||||
|
@ -218,19 +218,19 @@ function snmp_explorer() {
|
|||
else {
|
||||
$done++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($done > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($done > 0) {
|
||||
ui_print_success_message(__('Successfully modules created')." ($done)");
|
||||
}
|
||||
|
||||
if(!empty($errors)) {
|
||||
if (!empty($errors)) {
|
||||
$msg = __('Could not be created').':';
|
||||
|
||||
|
||||
foreach($errors as $code => $number) {
|
||||
switch($code) {
|
||||
|
||||
|
||||
foreach ($errors as $code => $number) {
|
||||
switch ($code) {
|
||||
case ERR_EXIST:
|
||||
$msg .= '<br>'.__('Another module already exists with the same name')." ($number)";
|
||||
break;
|
||||
|
@ -243,171 +243,169 @@ function snmp_explorer() {
|
|||
$msg .= '<br>'.__('Processing error')." ($number)";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ui_print_error_message($msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Create the interface list for the interface
|
||||
$interfaces_list = array();
|
||||
foreach($interfaces as $interface){
|
||||
// Get the interface name, removing " " characters and avoid "blank" interfaces
|
||||
if (isset($interface['ifName']) && $interface['ifName']['value'] != ""){
|
||||
$ifname = $interface['ifName']['value'];
|
||||
}
|
||||
else if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != ""){
|
||||
$ifname = $interface['ifDescr']['value'];
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
|
||||
$interfaces_list[$interface['ifIndex']['value']] = str_replace ( "\"" , "" , $ifname);
|
||||
|
||||
}
|
||||
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo "<form method='post' id='walk_form' action='index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente=$id_agent&id_extension=snmp_explorer'>";
|
||||
|
||||
$table->width = '98%';
|
||||
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
|
||||
$table->data[0][0] = '<b>' . __('Target IP') . '</b>';
|
||||
$table->data[0][1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
|
||||
|
||||
$table->data[0][2] = '<b>' . __('Port') . '</b>';
|
||||
$table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
|
||||
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
|
||||
$table->data[1][0] = '<b>' . __('SNMP community') . '</b>';
|
||||
$table->data[1][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
|
||||
$table->data[1][2] = '<b>' . _('SNMP version') . '</b>';
|
||||
$table->data[1][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
|
||||
|
||||
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
|
||||
html_print_input_hidden('snmpwalk', 1);
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
unset($table);
|
||||
|
||||
//SNMP3 OPTIONS
|
||||
$table->width = '98%';
|
||||
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
|
||||
$table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
||||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_text ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$table->data[5][2] = '<b>'.__('privacy pass').'</b>';
|
||||
$table->data[5][3] = html_print_input_text ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
|
||||
$table->data[6][0] = '<b>'.__('Auth method').'</b>';
|
||||
$table->data[6][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);
|
||||
$table->data[6][2] = '<b>'.__('Security level').'</b>';
|
||||
$table->data[6][3] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp3_security_level', $snmp3_security_level, '', '', '', true);
|
||||
|
||||
if($snmp_version == 3) {
|
||||
echo '<div id="snmp3_options">';
|
||||
}else {
|
||||
echo '<div id="snmp3_options" style="display: none;">';
|
||||
}
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
echo '<span id="oid_loading" class="invisible">' . html_print_image("images/spinner.gif", true) . '</span>';
|
||||
html_print_submit_button(__('SNMP Walk'), 'snmp_walk', false, array('class' => 'sub next'));
|
||||
echo "</div>";
|
||||
|
||||
if($snmpwalk && !$snmpis) {
|
||||
echo '<span id="no_snmp" style="margin-left:50px" class="error">'.__('Unable to do SNMP walk').'</span>';
|
||||
}
|
||||
|
||||
unset($table);
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//echo "</tr></table>";
|
||||
//echo "</form>";
|
||||
|
||||
if(!empty($interfaces_list)){
|
||||
echo '<span id="form_interfaces">';
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente=$id_agent&id_extension=snmp_explorer'>";
|
||||
|
||||
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user']."_snmp");
|
||||
html_print_input_hidden('id_snmp_serialize', $id_snmp_serialize);
|
||||
|
||||
html_print_input_hidden('create_modules', 1);
|
||||
html_print_input_hidden('ip_target', $ip_target);
|
||||
html_print_input_hidden('tcp_port', $tcp_port);
|
||||
html_print_input_hidden('snmp_community', $snmp_community);
|
||||
html_print_input_hidden('snmp_version', $snmp_version);
|
||||
html_print_input_hidden('snmp3_auth_user', $snmp3_auth_user);
|
||||
html_print_input_hidden('snmp3_auth_pass', $snmp3_auth_pass);
|
||||
html_print_input_hidden('snmp3_auth_method', $snmp3_auth_method);
|
||||
html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method);
|
||||
html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass);
|
||||
html_print_input_hidden('snmp3_security_level', $snmp3_security_level);
|
||||
|
||||
$table->width = '98%';
|
||||
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
|
||||
//Agent selector
|
||||
$table->data[0][0] = '<b>'.__('Interfaces').'</b>';
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
html_print_submit_button(__('Create modules'), '', false, array('class' => 'sub add'));
|
||||
// Create the interface list for the interface
|
||||
$interfaces_list = array();
|
||||
foreach($interfaces as $interface){
|
||||
// Get the interface name, removing " " characters and avoid "blank" interfaces
|
||||
if (isset($interface['ifName']) && $interface['ifName']['value'] != ""){
|
||||
$ifname = $interface['ifName']['value'];
|
||||
}
|
||||
else if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != ""){
|
||||
$ifname = $interface['ifDescr']['value'];
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
|
||||
$interfaces_list[$interface['ifIndex']['value']] = str_replace ( "\"" , "" , $ifname);
|
||||
}
|
||||
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo "<form method='post' id='walk_form' action='index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente=$id_agent&id_extension=snmp_explorer'>";
|
||||
|
||||
$table->width = '98%';
|
||||
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
|
||||
$table->data[0][0] = '<b>' . __('Target IP') . '</b>';
|
||||
$table->data[0][1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
|
||||
|
||||
$table->data[0][2] = '<b>' . __('Port') . '</b>';
|
||||
$table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
|
||||
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
|
||||
$table->data[1][0] = '<b>' . __('SNMP community') . '</b>';
|
||||
$table->data[1][1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
|
||||
$table->data[1][2] = '<b>' . _('SNMP version') . '</b>';
|
||||
$table->data[1][3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
|
||||
|
||||
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
|
||||
html_print_input_hidden('snmpwalk', 1);
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
unset($table);
|
||||
|
||||
//SNMP3 OPTIONS
|
||||
$table->width = '98%';
|
||||
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
|
||||
$table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
||||
$table->data[2][2] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_text ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$table->data[5][2] = '<b>'.__('privacy pass').'</b>';
|
||||
$table->data[5][3] = html_print_input_text ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
|
||||
$table->data[6][0] = '<b>'.__('Auth method').'</b>';
|
||||
$table->data[6][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);
|
||||
$table->data[6][2] = '<b>'.__('Security level').'</b>';
|
||||
$table->data[6][3] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp3_security_level', $snmp3_security_level, '', '', '', true);
|
||||
|
||||
if ($snmp_version == 3) {
|
||||
echo '<div id="snmp3_options">';
|
||||
}
|
||||
else {
|
||||
echo '<div id="snmp3_options" style="display: none;">';
|
||||
}
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
echo '<span id="oid_loading" class="invisible">' . html_print_image("images/spinner.gif", true) . '</span>';
|
||||
html_print_submit_button(__('SNMP Walk'), 'snmp_walk', false, array('class' => 'sub next'));
|
||||
echo "</div>";
|
||||
|
||||
if ($snmpwalk && !$snmpis) {
|
||||
echo '<span id="no_snmp" style="margin-left:50px" class="error">'.__('Unable to do SNMP walk').'</span>';
|
||||
}
|
||||
|
||||
unset($table);
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//echo "</tr></table>";
|
||||
//echo "</form>";
|
||||
|
||||
if (!empty($interfaces_list)) {
|
||||
echo '<span id="form_interfaces">';
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente=$id_agent&id_extension=snmp_explorer'>";
|
||||
|
||||
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user']."_snmp");
|
||||
html_print_input_hidden('id_snmp_serialize', $id_snmp_serialize);
|
||||
|
||||
html_print_input_hidden('create_modules', 1);
|
||||
html_print_input_hidden('ip_target', $ip_target);
|
||||
html_print_input_hidden('tcp_port', $tcp_port);
|
||||
html_print_input_hidden('snmp_community', $snmp_community);
|
||||
html_print_input_hidden('snmp_version', $snmp_version);
|
||||
html_print_input_hidden('snmp3_auth_user', $snmp3_auth_user);
|
||||
html_print_input_hidden('snmp3_auth_pass', $snmp3_auth_pass);
|
||||
html_print_input_hidden('snmp3_auth_method', $snmp3_auth_method);
|
||||
html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method);
|
||||
html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass);
|
||||
html_print_input_hidden('snmp3_security_level', $snmp3_security_level);
|
||||
|
||||
$table->width = '98%';
|
||||
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
|
||||
//Agent selector
|
||||
$table->data[0][0] = '<b>'.__('Interfaces').'</b>';
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
html_print_submit_button(__('Create modules'), '', false, array('class' => 'sub add'));
|
||||
echo "</div>";
|
||||
unset($table);
|
||||
|
||||
echo "</form>";
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
ui_require_jquery_file ('ajaxqueue');
|
||||
ui_require_jquery_file ('bgiframe');
|
||||
unset($table);
|
||||
|
||||
echo "</form>";
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
ui_require_jquery_file ('ajaxqueue');
|
||||
ui_require_jquery_file ('bgiframe');
|
||||
//ui_require_jquery_file ('autocomplete');
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$(document).ready (function () {
|
||||
var inputActive = true;
|
||||
|
||||
|
||||
$(document).data('text_for_module', $("#none_text").html());
|
||||
|
||||
|
||||
$("#id_snmp").change(snmp_changed_by_multiple_snmp);
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
|
@ -418,14 +416,13 @@ $(document).ready (function () {
|
|||
$("#snmp3_options").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#walk_form").submit(function() {
|
||||
$("#submit-snmp_walk").disable ();
|
||||
$("#oid_loading").show ();
|
||||
$("#no_snmp").hide ();
|
||||
$("#form_interfaces").hide ();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
|
@ -437,7 +434,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
|||
$('#module').attr ('disabled', 1);
|
||||
$('#module').empty ();
|
||||
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
||||
|
||||
|
||||
jQuery.post ('ajax.php',
|
||||
{"page" : "godmode/agentes/agent_manager",
|
||||
"get_modules_json_for_multiple_snmp": 1,
|
||||
|
|
|
@ -91,8 +91,9 @@ if ($update) {
|
|||
$advanced_filter = get_parameter('advanced_filter','');
|
||||
|
||||
if ($name == '') {
|
||||
ui_print_error_message (__('Not updated. Blank name'));
|
||||
} else {
|
||||
ui_print_error_message (__('Not updated. Blank name'));
|
||||
}
|
||||
else {
|
||||
$values = array ('id_sg' => $id,
|
||||
'id_name' => $name,
|
||||
'id_group' => $assign_group,
|
||||
|
@ -104,19 +105,19 @@ if ($update) {
|
|||
'advanced_filter' => $advanced_filter,
|
||||
'output' => $output
|
||||
);
|
||||
|
||||
|
||||
// Save filter args
|
||||
$values['filter_args'] = netflow_get_filter_arguments ($values);
|
||||
|
||||
|
||||
$result = db_process_sql_update ('tnetflow_filter', $values, array ('id_sg' => $id));
|
||||
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully updated'),
|
||||
__('Not updated. Error updating data'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($create){
|
||||
if ($create) {
|
||||
$name = (string) get_parameter ('name');
|
||||
$assign_group = (int) get_parameter ('assign_group');
|
||||
$aggregate = get_parameter('aggregate','none');
|
||||
|
@ -126,7 +127,7 @@ if ($create){
|
|||
$dst_port = get_parameter('dst_port','');
|
||||
$src_port = get_parameter('src_port','');
|
||||
$advanced_filter = (string) get_parameter('advanced_filter', '');
|
||||
|
||||
|
||||
$values = array (
|
||||
'id_name'=>$name,
|
||||
'id_group' => $assign_group,
|
||||
|
@ -141,11 +142,12 @@ if ($create){
|
|||
|
||||
// Save filter args
|
||||
$values['filter_args'] = netflow_get_filter_arguments ($values);
|
||||
|
||||
|
||||
$id = db_process_sql_insert('tnetflow_filter', $values);
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating filter');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui_print_success_message ('Filter created successfully');
|
||||
}
|
||||
}
|
||||
|
@ -158,19 +160,20 @@ $table->class = "databox_color";
|
|||
$table->style[0] = 'vertical-align: top;';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
|
||||
$table->data[0][0] = '<b>'.__('Name').'</b>';
|
||||
$table->data[0][1] = html_print_input_text ('name', $name, false, 20, 80, true);
|
||||
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
$table->data[1][0] = '<b>'.__('Group').'</b>';
|
||||
$table->data[1][1] = html_print_select_groups($config['id_user'], "IW",
|
||||
$own_info['is_admin'], 'assign_group', $assign_group, '', '', -1, true,
|
||||
false, false);
|
||||
|
||||
$own_info['is_admin'], 'assign_group', $assign_group, '', '', -1, true,
|
||||
false, false);
|
||||
|
||||
if ($advanced_filter != '') {
|
||||
$filter_type = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$filter_type = 0;
|
||||
}
|
||||
|
||||
|
@ -192,13 +195,13 @@ $table->data[6][1] = html_print_input_text ('src_port', $src_port, false, 40, 80
|
|||
|
||||
$table->data[7][0] = ui_print_help_icon ('pcap_filter', true);
|
||||
$table->data[7][1] = html_print_textarea ('advanced_filter', 4, 40, $advanced_filter, '', true);
|
||||
|
||||
|
||||
$table->data[8][0] = '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true);
|
||||
$aggregate_list = array();
|
||||
$aggregate_list = array ('none' => __('None'), 'proto' => __('Protocol'), 'srcip' =>__('Src Ip Address'), 'dstip' =>__('Dst Ip Address'), 'srcport' =>__('Src Port'), 'dstport' =>__('Dst Port') );
|
||||
|
||||
$table->data[8][1] = html_print_select ($aggregate_list, "aggregate", $aggregate, '', '', 0, true, false, true, '', false);
|
||||
|
||||
|
||||
$table->data[9][0] = '<b>'.__('Output format').'</b>';
|
||||
$show_output = array();
|
||||
$show_output = array ('packets' => __('Packets'), 'bytes' => __('Bytes'), 'flows' =>__('Flows'));
|
||||
|
@ -211,7 +214,8 @@ if ($id) {
|
|||
html_print_input_hidden ('update', 1);
|
||||
html_print_input_hidden ('id', $id);
|
||||
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create', 1);
|
||||
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
|
||||
}
|
||||
|
@ -220,15 +224,13 @@ echo '</form>';
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function displayAdvancedFilter () {
|
||||
|
||||
// Erase the normal filter
|
||||
document.getElementById("text-ip_dst").value = '';
|
||||
document.getElementById("text-ip_src").value = '';
|
||||
document.getElementById("text-dst_port").value = '';
|
||||
document.getElementById("text-src_port").value = '';
|
||||
|
||||
|
||||
// Hide the normal filter
|
||||
document.getElementById("table1-3").style.display = 'none';
|
||||
document.getElementById("table1-4").style.display = 'none';
|
||||
|
@ -238,30 +240,26 @@ echo '</form>';
|
|||
// Show the advanced filter
|
||||
document.getElementById("table1-7").style.display = '';
|
||||
};
|
||||
|
||||
function displayNormalFilter () {
|
||||
|
||||
function displayNormalFilter () {
|
||||
// Erase the advanced filter
|
||||
document.getElementById("textarea_advanced_filter").value = '';
|
||||
|
||||
|
||||
// Hide the advanced filter
|
||||
document.getElementById("table1-7").style.display = 'none';
|
||||
|
||||
|
||||
// Show the normal filter
|
||||
document.getElementById("table1-3").style.display = '';
|
||||
document.getElementById("table1-4").style.display = '';
|
||||
document.getElementById("table1-5").style.display = '';
|
||||
document.getElementById("table1-6").style.display = '';
|
||||
};
|
||||
|
||||
|
||||
var filter_type = <?php echo $filter_type ?>;
|
||||
if (filter_type == 0) {
|
||||
displayNormalFilter ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
displayAdvancedFilter ();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</script>
|
|
@ -36,19 +36,19 @@ $create = (string)get_parameter('create', 0);
|
|||
|
||||
$buttons['report_list']['active'] = false;
|
||||
$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
. '</a>';
|
||||
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['report_items']['active'] = false;
|
||||
$buttons['report_items']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$id.'">'
|
||||
. html_print_image ("images/god6.png", true, array ("title" => __('Report items')))
|
||||
. '</a>';
|
||||
|
||||
. html_print_image ("images/god6.png", true, array ("title" => __('Report items')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['edit_report']['active'] = true;
|
||||
$buttons['edit_report']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_form&id='.$id.'">'
|
||||
. html_print_image ("images/config.png", true, array ("title" => __('Edit report')))
|
||||
. '</a>';
|
||||
|
||||
. html_print_image ("images/config.png", true, array ("title" => __('Edit report')))
|
||||
. '</a>';
|
||||
|
||||
//Header
|
||||
ui_print_page_header (__('Netflow Report'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
||||
|
||||
|
@ -66,7 +66,8 @@ if ($id) {
|
|||
$description = $report['description'];
|
||||
$group = $report['id_group'];
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$name = '';
|
||||
$group = '';
|
||||
$description = '';
|
||||
|
@ -77,10 +78,11 @@ if ($update) {
|
|||
$name = (string) get_parameter ('name');
|
||||
$description = get_parameter ('description');
|
||||
$group = get_parameter('id_group');
|
||||
|
||||
|
||||
if ($name == '') {
|
||||
ui_print_error_message (__('Not updated. Blank name'));
|
||||
} else {
|
||||
ui_print_error_message (__('Not updated. Blank name'));
|
||||
}
|
||||
else {
|
||||
$result = db_process_sql_update ('tnetflow_report',
|
||||
array (
|
||||
'id_name' => $name,
|
||||
|
@ -88,26 +90,28 @@ if ($update) {
|
|||
'description' => $description,
|
||||
),
|
||||
array ('id_report' => $id));
|
||||
ui_print_result_message ($result, __('Report updated successfully'), __('Error updating report'));
|
||||
}
|
||||
ui_print_result_message ($result, __('Report updated successfully'), __('Error updating report'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($create){
|
||||
$name = (string) get_parameter ('name');
|
||||
$group = (int) get_parameter ('id_group');
|
||||
$description = get_parameter('description','');
|
||||
|
||||
|
||||
$values = array (
|
||||
'id_name' => $name,
|
||||
'id_group' => $group,
|
||||
'description' => $description,
|
||||
'id_name' => $name,
|
||||
'id_group' => $group,
|
||||
'description' => $description,
|
||||
);
|
||||
|
||||
$id = db_process_sql_insert('tnetflow_report', $values);
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating report');
|
||||
} else {
|
||||
ui_print_success_message ('Report created successfully');
|
||||
}
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating report');
|
||||
}
|
||||
else {
|
||||
ui_print_success_message ('Report created successfully');
|
||||
}
|
||||
}
|
||||
|
||||
$table->width = '80%';
|
||||
|
@ -118,15 +122,15 @@ $table->class = "databox_color";
|
|||
$table->style[0] = 'vertical-align: top;';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
|
||||
$table->data[0][0] = '<b>'.__('Name').'</b>';
|
||||
$table->data[0][1] = html_print_input_text ('name', $name, false, 30, 80, true);
|
||||
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
$table->data[1][0] = '<b>'.__('Group').'</b>';
|
||||
$table->data[1][1] = html_print_select_groups($config['id_user'], "IW",
|
||||
$own_info['is_admin'], 'id_group', $group, '','', -1, true,
|
||||
false, false);
|
||||
$own_info['is_admin'], 'id_group', $group, '','', -1, true,
|
||||
false, false);
|
||||
|
||||
$table->data[2][0] = '<b>'.__('Description').'</b>';
|
||||
$table->data[2][1] = html_print_textarea ('description', 2, 65, $description, '', true);
|
||||
|
@ -140,11 +144,11 @@ if ($id) {
|
|||
html_print_input_hidden ('update', 1);
|
||||
html_print_input_hidden ('id', $id);
|
||||
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create', 1);
|
||||
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
?>
|
|
@ -182,7 +182,7 @@ function compare_flows ($a, $b) {
|
|||
*
|
||||
*/
|
||||
function sort_netflow_data (&$netflow_data) {
|
||||
usort($netflow_data, "compare_flows");
|
||||
usort($netflow_data, "compare_flows");
|
||||
}
|
||||
|
||||
function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit){
|
||||
|
@ -207,7 +207,8 @@ function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit){
|
|||
$values[$agg] = $data[$j]['data'];
|
||||
$table->data[$x][0] = $agg;
|
||||
$table->data[$x][1] = format_numeric ($data[$j]['data']);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$values[$agg] += $data[$j]['data'];
|
||||
$table->data[$x][0] = $agg;
|
||||
$table->data[$x][1] = format_numeric ($data[$j]['data']);
|
||||
|
@ -215,7 +216,7 @@ function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit){
|
|||
$j++;
|
||||
$x++;
|
||||
}
|
||||
|
||||
|
||||
html_print_table($table);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,10 @@ function networkmap_is_descendant ($node, $ascendant, $parents) {
|
|||
}
|
||||
|
||||
// Generate a dot graph definition for graphviz
|
||||
function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
|
||||
$layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0,
|
||||
$regen = 1, $pure = 0, $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
|
||||
function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0,
|
||||
$font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1,
|
||||
$ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
|
||||
$id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
|
||||
$relative = false) {
|
||||
|
||||
$parents = array();
|
||||
|
@ -136,7 +137,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_
|
|||
continue;
|
||||
}
|
||||
|
||||
switch($node['type']){
|
||||
switch ($node['type']) {
|
||||
case 'agent':
|
||||
$graph .= networkmap_create_agent_node ($node , $simple, $font_size, $cut_names, $relative)."\n\t\t";
|
||||
$stats['agents'][] = $node['id_agente'];
|
||||
|
@ -195,7 +196,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
$groups[] = db_get_row ('tgrupo', 'id_grupo', $id_group);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$filter['id_grupo'] = $id_groups;
|
||||
}
|
||||
else {
|
||||
|
@ -231,18 +232,19 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
// Save node parent information to define edges later
|
||||
if ($node_group['parent'] != "0" && $node_group['id_grupo'] != $group) {
|
||||
$parents[$node_count] = $nodes_groups[$node_group['parent']]['id_node'];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$orphans[$node_count] = 1;
|
||||
}
|
||||
|
||||
$nodes[$node_count] = $node_group;
|
||||
$nodes[$node_count] = $node_group;
|
||||
}
|
||||
|
||||
if($depth != 'group') {
|
||||
if ($depth != 'group') {
|
||||
// Get agents data
|
||||
$agents = agents_get_agents ($filter,
|
||||
array ('id_grupo, nombre, id_os, id_agente'));
|
||||
|
||||
|
||||
if ($agents === false)
|
||||
$agents = array();
|
||||
|
||||
|
@ -252,13 +254,13 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
$node_count ++;
|
||||
// Save node parent information to define edges later
|
||||
$parents[$node_count] = $agent['parent'] = $nodes_groups[$agent['id_grupo']]['id_node'];
|
||||
|
||||
|
||||
$agent['id_node'] = $node_count;
|
||||
$agent['type'] = 'agent';
|
||||
// Add node
|
||||
$nodes[$node_count] = $nodes_agents[$agent['id_agente']] = $agent;
|
||||
|
||||
if($depth == 'agent'){
|
||||
if ($depth == 'agent') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -269,35 +271,37 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
$node_count ++;
|
||||
$agent_module = modules_get_agentmodule($key);
|
||||
$alerts_module = db_get_sql('SELECT count(*) as num
|
||||
FROM talert_template_modules WHERE id_agent_module = '.$key);
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module = ' . $key);
|
||||
|
||||
if($alerts_module == 0 && $modwithalerts){
|
||||
if ($alerts_module == 0 && $modwithalerts) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($agent_module['id_module_group'] != $module_group && $module_group != 0){
|
||||
if ($agent_module['id_module_group'] != $module_group &&
|
||||
$module_group != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($hidepolicymodules && $config['enterprise_installed']){
|
||||
if ($hidepolicymodules && $config['enterprise_installed']) {
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
if(policies_is_module_in_policy($key)) {
|
||||
if (policies_is_module_in_policy($key)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save node parent information to define edges later
|
||||
$parents[$node_count] = $agent_module['parent'] = $agent['id_node'];
|
||||
|
||||
|
||||
$agent_module['id_node'] = $node_count;
|
||||
|
||||
|
||||
$agent_module['type'] = 'module';
|
||||
// Add node
|
||||
$nodes[$node_count] = $agent_module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty ($nodes)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -309,7 +313,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
unset ($nodes[$node_id]);
|
||||
continue;
|
||||
}
|
||||
switch($node['type']){
|
||||
switch ($node['type']) {
|
||||
case 'group':
|
||||
$graph .= networkmap_create_group_node ($node , $simple, $font_size)."\n\t\t";
|
||||
$stats['groups'][] = $node['id_grupo'];
|
||||
|
@ -329,16 +333,17 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
// Verify that the parent is in the graph
|
||||
if (isset ($nodes[$parent_id])) {
|
||||
$graph .= networkmap_create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$orphans[$node] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create a central node if orphan nodes exist
|
||||
if (count ($orphans)) {
|
||||
$graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple, $stats);
|
||||
}
|
||||
|
||||
|
||||
// Define edges for orphan nodes
|
||||
foreach (array_keys($orphans) as $node) {
|
||||
$graph .= networkmap_create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap);
|
||||
|
@ -550,7 +555,7 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $fo
|
|||
$size_y = 5.4;
|
||||
$size = '';
|
||||
|
||||
|
||||
|
||||
if ($layout == 'radial') {
|
||||
$overlap = 'true';
|
||||
}
|
||||
|
@ -560,7 +565,7 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $fo
|
|||
$overlap = 'scalexy';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($zoom > 0) {
|
||||
$size_x *= $zoom;
|
||||
$size_y *= $zoom;
|
||||
|
@ -577,7 +582,7 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $fo
|
|||
$head .= "ratio=fill;";
|
||||
$head .= "root=0;";
|
||||
$head .= "size=\"$size\";";
|
||||
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
@ -588,19 +593,25 @@ function networkmap_close_graph () {
|
|||
|
||||
// Returns the filter used to achieve the desired layout
|
||||
function networkmap_get_filter ($layout) {
|
||||
switch($layout) {
|
||||
case 'flat':
|
||||
return 'dot';
|
||||
case 'radial':
|
||||
return 'twopi';
|
||||
case 'circular':
|
||||
return 'circo';
|
||||
case 'spring1':
|
||||
return 'neato';
|
||||
case 'spring2':
|
||||
return 'fdp';
|
||||
default:
|
||||
return 'twopi';
|
||||
switch ($layout) {
|
||||
case 'flat':
|
||||
return 'dot';
|
||||
break;
|
||||
case 'radial':
|
||||
return 'twopi';
|
||||
break;
|
||||
case 'circular':
|
||||
return 'circo';
|
||||
break;
|
||||
case 'spring1':
|
||||
return 'neato';
|
||||
break;
|
||||
case 'spring2':
|
||||
return 'fdp';
|
||||
break;
|
||||
default:
|
||||
return 'twopi';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -300,11 +300,11 @@ foreach ($modules as $module) {
|
|||
}
|
||||
else {
|
||||
$data[1] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data[2] = servers_show_type ($module['id_modulo']) . ' ';
|
||||
|
||||
|
||||
if (check_acl ($config['id_user'], $id_grupo, "AW"))
|
||||
$data[2] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&id_agent_module='.$module["id_agente_modulo"].'&edit_module='.$module["id_modulo"].'">' . html_print_image("images/config.png", true, array("alt" => '0', "border" => "")) . '</a>';
|
||||
|
||||
|
@ -340,7 +340,7 @@ foreach ($modules as $module) {
|
|||
else {
|
||||
if (is_numeric($module["datos"])){
|
||||
$salida = format_numeric($module["datos"]);
|
||||
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
if (isset($module["unit"])){
|
||||
$salida .= " " . '<i>'. io_safe_output($module["unit"]) . '</i>';
|
||||
|
@ -361,21 +361,21 @@ foreach ($modules as $module) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data[6] = ui_print_module_warn_value ($module["max_warning"], $module["min_warning"], $module["str_warning"], $module["max_critical"], $module["min_critical"], $module["str_critical"]);
|
||||
|
||||
|
||||
$data[7] = $salida;
|
||||
$graph_type = return_graphtype ($module["id_tipo_modulo"]);
|
||||
|
||||
|
||||
$data[8] = " ";
|
||||
if ($module['history_data'] == 1){
|
||||
$nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]);
|
||||
$handle = "stat".$nombre_tipo_modulo."_".$module["id_agente_modulo"];
|
||||
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
|
||||
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||
|
||||
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".base64_encode($module["nombre"])."&refresh=600','day_".$win_handle."')";
|
||||
|
||||
|
||||
// if ($nombre_tipo_modulo != "log4x")
|
||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||
$data[8] .= "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=86400&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("border" => '0', "alt" => "")) . "</a>";
|
||||
|
@ -432,4 +432,4 @@ ui_require_jquery_file ('cluetip');
|
|||
});
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
</script>
|
|
@ -223,31 +223,31 @@ if (!$nomaps && $id_networkmap != 0) {
|
|||
}
|
||||
|
||||
$title = '';
|
||||
switch($activeTab){
|
||||
switch ($activeTab) {
|
||||
case 'topology':
|
||||
$title = __('Topology view');
|
||||
break;
|
||||
$title = __('Topology view');
|
||||
break;
|
||||
case 'groups':
|
||||
$title = __('Groups view');
|
||||
break;
|
||||
$title = __('Groups view');
|
||||
break;
|
||||
case 'policies':
|
||||
$title = __('Policies view');
|
||||
break;
|
||||
$title = __('Policies view');
|
||||
break;
|
||||
}
|
||||
|
||||
if(!empty($name)) {
|
||||
if (!empty($name)) {
|
||||
$title .= " » ". mb_substr($name, 0, 25);
|
||||
}
|
||||
|
||||
ui_print_page_header (__('Network map')." - ".$title, "images/bricks.png", false, "network_map", false, $buttons);
|
||||
|
||||
if($delete_networkmap || $add_networkmap || $save_networkmap) {
|
||||
if ($delete_networkmap || $add_networkmap || $save_networkmap) {
|
||||
echo $message;
|
||||
}
|
||||
|
||||
if($id_networkmap == 0) {
|
||||
echo "<div class='nf'>".__('There are no defined maps in this view')."</div>";
|
||||
return;
|
||||
if ($id_networkmap == 0) {
|
||||
echo "<div class='nf'>".__('There are no defined maps in this view')."</div>";
|
||||
return;
|
||||
}
|
||||
|
||||
// CONFIGURATION FORM
|
||||
|
@ -256,11 +256,11 @@ echo "<br>";
|
|||
|
||||
// Layout selection
|
||||
$layout_array = array (
|
||||
'circular' => 'circular',
|
||||
'radial' => 'radial',
|
||||
'spring1' => 'spring 1',
|
||||
'spring2' => 'spring 2',
|
||||
'flat' => 'flat');
|
||||
'circular' => 'circular',
|
||||
'radial' => 'radial',
|
||||
'spring1' => 'spring 1',
|
||||
'spring2' => 'spring 2',
|
||||
'flat' => 'flat');
|
||||
|
||||
$options_form = '<form action="index.php?sec=network&sec2=operation/agentes/networkmap&id_networkmap='.$id_networkmap.'&tab='.$activeTab.'&pure='.$pure.'&center='.$center.'" method="post">';
|
||||
$options_form .= '<table cellpadding="4" cellspacing="4" class="databox" width="99%">';
|
||||
|
@ -274,13 +274,13 @@ $options_form .= '</td>';
|
|||
$options_form .= '<td valign="top">' . __('Group') . '<br />';
|
||||
$options_form .= html_print_select_groups(false, 'AR', false, 'group', $group, '', 'All', 0, true);
|
||||
$options_form .= '</td>';
|
||||
if($activeTab == 'groups' || $activeTab == 'policies'){
|
||||
if ($activeTab == 'groups' || $activeTab == 'policies') {
|
||||
$options_form .= '<td valign="top">' . __('Module group') . '<br />';
|
||||
$options_form .= html_print_select_from_sql ('SELECT id_mg, name FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true);
|
||||
$options_form .= '</td>';
|
||||
}
|
||||
|
||||
if($activeTab == 'topology') {
|
||||
if ($activeTab == 'topology') {
|
||||
$options_form .= '<td valign="top">' . __('Show interfaces') . '<br />';
|
||||
$options_form .= html_print_checkbox ('show_snmp_modules', '1', $show_snmp_modules, true);
|
||||
$options_form .= '</td>';
|
||||
|
@ -290,14 +290,14 @@ $options_form .= '<td valign="top">' . __('Layout') . '<br />';
|
|||
$options_form .= html_print_select ($layout_array, 'layout', $layout, '', '', '', true);
|
||||
$options_form .= '</td>';
|
||||
|
||||
if($activeTab == 'groups'){
|
||||
if ($activeTab == 'groups') {
|
||||
$options_form .= '<td valign="top">' . __('Depth') . '<br />';
|
||||
$depth_levels = array('all' => __('All'), 'agent' => __('Agents'), 'group' => __('Groups'));
|
||||
$options_form .= html_print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false);
|
||||
$options_form .= '</td>';
|
||||
}
|
||||
|
||||
if($activeTab == 'policies'){
|
||||
if ($activeTab == 'policies') {
|
||||
$options_form .= '<td valign="top">' . __('Depth') . '<br />';
|
||||
$depth_levels = array('all' => __('All'), 'agent' => __('Agents'), 'policy' => __('Policies'));
|
||||
$options_form .= html_print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false);
|
||||
|
@ -311,12 +311,13 @@ $options_form .= '<tr><td valign="top">' . __('No Overlap') . '<br />';
|
|||
$options_form .= html_print_checkbox ('nooverlap', '1', $nooverlap, true);
|
||||
$options_form .= '</td>';
|
||||
|
||||
if(($activeTab == 'groups' || $activeTab == 'policies') && $depth == 'all') {
|
||||
if (($activeTab == 'groups' || $activeTab == 'policies') &&
|
||||
$depth == 'all') {
|
||||
$options_form .= '<td valign="top">' . __('Only modules with alerts') . '<br />';
|
||||
$options_form .= html_print_checkbox ('modwithalerts', '1', $modwithalerts, true);
|
||||
$options_form .= '</td>';
|
||||
|
||||
if($activeTab == 'groups') {
|
||||
|
||||
if ($activeTab == 'groups') {
|
||||
if($config['enterprise_installed']) {
|
||||
$options_form .= '<td valign="top">' . __('Hide policy modules') . '<br />';
|
||||
$options_form .= html_print_checkbox ('hidepolicymodules', '1', $hidepolicymodules, true);
|
||||
|
@ -343,14 +344,13 @@ if ($pure == "1") {
|
|||
'2.5' => 'x5',
|
||||
'5' => 'x10',
|
||||
);
|
||||
|
||||
|
||||
$options_form .= '<td valign="top">' . __('Zoom') . '<br />';
|
||||
$options_form .= html_print_select ($zoom_array, 'zoom', $zoom, '', '', '', true, false, false, false);
|
||||
$options_form .= '</td>';
|
||||
|
||||
}
|
||||
|
||||
if ($nooverlap == 1){
|
||||
if ($nooverlap == 1) {
|
||||
$options_form .= "<td>";
|
||||
$options_form .= __('Distance between nodes') . '<br />';
|
||||
$options_form .= html_print_input_text ('ranksep', $ranksep, __('Separation between elements in the map (in Non-overlap mode)'), 3, 4, true);
|
||||
|
@ -385,5 +385,4 @@ if($id_networkmap != 0) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
|
@ -180,7 +180,8 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_l
|
|||
// Read filter type
|
||||
if ($filter['advanced_filter'] != '') {
|
||||
$filter_type = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$filter_type = 0;
|
||||
}
|
||||
|
||||
|
@ -191,13 +192,13 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_l
|
|||
$user_groups = users_get_groups ($config['id_user'], "AR", $own_info['is_admin'], true);
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
|
||||
$table->data[2][3] = html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('none'), 0, true);
|
||||
|
||||
|
||||
|
||||
$table->data[3][0] = __('Dst Ip'). ui_print_help_tip (__("Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[3][1] = html_print_input_text ('ip_dst', $filter['ip_dst'], false, 40, 80, true);
|
||||
$table->data[3][2] = __('Src Ip'). ui_print_help_tip (__("Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[3][3] = html_print_input_text ('ip_src', $filter['ip_src'], false, 40, 80, true);
|
||||
|
||||
|
||||
$table->data[4][0] = __('Dst Port'). ui_print_help_tip (__("Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
$table->data[4][1] = html_print_input_text ('dst_port', $filter['dst_port'], false, 40, 80, true);
|
||||
$table->data[4][2] = __('Src Port'). ui_print_help_tip (__("Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
|
@ -206,94 +207,91 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_l
|
|||
$table->data[5][0] = ui_print_help_icon ('pcap_filter', true);
|
||||
$table->data[5][1] = html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px;'", true);
|
||||
$table->colspan[5][1] = 3;
|
||||
|
||||
|
||||
$table->data[6][0] = '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true);
|
||||
|
||||
|
||||
$aggregate_list = array();
|
||||
$aggregate_list = array ('none' => __('None'), 'proto' => __('Protocol'), 'srcip' =>__('Src Ip Address'), 'dstip' =>__('Dst Ip Address'), 'srcport' =>__('Src Port'), 'dstport' =>__('Dst Port') );
|
||||
$table->data[6][1] = html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false);
|
||||
|
||||
|
||||
$table->data[6][2] = '<b>'.__('Output format').'</b>';
|
||||
$show_output = array();
|
||||
$show_output = array ('packets' => __('Packets'), 'bytes' => __('Bytes'), 'flows' =>__('Flows'));
|
||||
$table->data[6][3] = html_print_select ($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false);
|
||||
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
|
||||
html_print_submit_button (__('Draw'), 'draw_button', false, 'class="sub upd"');
|
||||
if (check_acl ($config["id_user"], 0, "AW")) {
|
||||
html_print_submit_button (__('Save as new filter'), 'save_button', false, 'class="sub upd" onClick="return defineFilterName();"');
|
||||
|
||||
html_print_submit_button (__('Update current filter'), 'update_button', false, 'class="sub upd"');
|
||||
|
||||
|
||||
html_print_submit_button (__('Update current filter'), 'update_button', false, 'class="sub upd"');
|
||||
}
|
||||
echo'</form>';
|
||||
|
||||
if ($draw != '') {
|
||||
|
||||
// Get the command to call nfdump
|
||||
$command = netflow_get_command ($filter);
|
||||
|
||||
|
||||
// Build a unique id for the cache
|
||||
$unique_id = 'live_view__' . ($end_date - $start_date);
|
||||
|
||||
|
||||
// Draw
|
||||
netflow_draw_item ($start_date, $end_date, $chart_type, $filter, $command, $filter, $max_aggregates, $unique_id);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// Hide the normal filter and display the advanced filter
|
||||
function displayAdvancedFilter () {
|
||||
|
||||
// Erase the normal filter
|
||||
document.getElementById("text-ip_dst").value = '';
|
||||
document.getElementById("text-ip_src").value = '';
|
||||
document.getElementById("text-dst_port").value = '';
|
||||
document.getElementById("text-src_port").value = '';
|
||||
|
||||
|
||||
// Hide the normal filter
|
||||
document.getElementById("table2-3").style.display = 'none';
|
||||
document.getElementById("table2-4").style.display = 'none';
|
||||
|
||||
|
||||
// Show the advanced filter
|
||||
document.getElementById("table2-5").style.display = '';
|
||||
};
|
||||
|
||||
|
||||
// Hide the advanced filter and display the normal filter
|
||||
function displayNormalFilter () {
|
||||
|
||||
// Erase the advanced filter
|
||||
document.getElementById("textarea_advanced_filter").value = '';
|
||||
|
||||
|
||||
// Hide the advanced filter
|
||||
document.getElementById("table2-5").style.display = 'none';
|
||||
|
||||
|
||||
// Show the normal filter
|
||||
document.getElementById("table2-3").style.display = '';
|
||||
document.getElementById("table2-4").style.display = '';
|
||||
};
|
||||
|
||||
|
||||
// Ask the user to define a name for the filter in order to save it
|
||||
function defineFilterName () {
|
||||
if (document.getElementById("text-name").value == '') {
|
||||
document.getElementById("table2-0").style.display = '';
|
||||
document.getElementById("table2-1").style.display = '';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
// Display the appropriate filter
|
||||
var filter_type = <?php echo $filter_type ?>;
|
||||
if (filter_type == 0) {
|
||||
displayNormalFilter ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
displayAdvancedFilter ();
|
||||
}
|
||||
|
||||
|
||||
// Hide filter name and group
|
||||
document.getElementById("table2-0").style.display = 'none';
|
||||
document.getElementById("table2-1").style.display = 'none';
|
||||
|
@ -306,7 +304,7 @@ if ($draw != '') {
|
|||
$("#table2-1").css('display', 'none');
|
||||
|
||||
// Clean fields
|
||||
if ($("#filter_id").val() == 0){
|
||||
if ($("#filter_id").val() == 0) {
|
||||
//displayNormalFilter ();
|
||||
$("#table2-3").css('display', '');
|
||||
$("#table2-4").css('display', '');
|
||||
|
@ -315,7 +313,7 @@ if ($draw != '') {
|
|||
// Check right filter type
|
||||
$("#radiobtn0001").attr("checked", "checked");
|
||||
$("#radiobtn0002").attr("checked", "");
|
||||
|
||||
|
||||
$("#text-ip_dst").val('');
|
||||
$("#text-ip_src").val('');
|
||||
$("#text-dst_port").val('');
|
||||
|
@ -326,8 +324,11 @@ if ($draw != '') {
|
|||
|
||||
// Hide update filter button
|
||||
$("#submit-update_button").css("visibility", "hidden");
|
||||
// Load fields from DB
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
// Load fields from DB
|
||||
|
||||
// Get filter type
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/netflow/nf_live_view",
|
||||
|
@ -345,7 +346,8 @@ if ($draw != '') {
|
|||
// Check right filter type
|
||||
$("#radiobtn0001").attr("checked", "checked");
|
||||
$("#radiobtn0002").attr("checked", "");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#table2-3").css('display', 'none');
|
||||
$("#table2-4").css('display', 'none');
|
||||
$("#table2-5").css('display', '');
|
||||
|
@ -353,7 +355,7 @@ if ($draw != '') {
|
|||
// Check right filter type
|
||||
$("#radiobtn0001").attr("checked", "");
|
||||
$("#radiobtn0002").attr("checked", "checked");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Shows update filter button
|
||||
|
@ -381,9 +383,9 @@ if ($draw != '') {
|
|||
$("#aggregate").val(val);
|
||||
if (i == 'output')
|
||||
$("#output").val(val);
|
||||
});
|
||||
});
|
||||
},
|
||||
"json");
|
||||
"json");
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -399,7 +401,7 @@ if ($draw != '') {
|
|||
|
||||
// Change color of name and group if save button has been pushed
|
||||
$("#submit-save_button").click(function () {
|
||||
if ($("#text-name").val() == ""){
|
||||
if ($("#text-name").val() == "") {
|
||||
$('#filter_name_color').css('color', '#CC0000');
|
||||
$('#filter_group_color').css('color', '#CC0000');
|
||||
}
|
||||
|
@ -407,8 +409,6 @@ if ($draw != '') {
|
|||
$('#filter_name_color').css('color', '#000000');
|
||||
$('#filter_group_color').css('color', '#000000');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
Loading…
Reference in New Issue