mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
SNMP Browser and agent module SNMP walk
This commit is contained in:
parent
bc501ec552
commit
91a708dfb8
@ -325,7 +325,7 @@ if ($edit === false) {
|
|||||||
|
|
||||||
$table_simple->data['module_n_type'][1] = '<span class="result_info_text">'.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')</span>';
|
$table_simple->data['module_n_type'][1] = '<span class="result_info_text">'.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')</span>';
|
||||||
} else {
|
} else {
|
||||||
$idModuleType = (isset($id_module_type) === true) ? $idModuleType : '';
|
$idModuleType = (isset($id_module_type) === true) ? $id_module_type : '';
|
||||||
// Removed web analysis and log4x from select.
|
// Removed web analysis and log4x from select.
|
||||||
$tipe_not_in = '24, 25';
|
$tipe_not_in = '24, 25';
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
|
@ -128,6 +128,7 @@ if ($page === 'enterprise/godmode/policies/policy_modules') {
|
|||||||
|
|
||||||
// In ICMP modules, port is not configurable.
|
// In ICMP modules, port is not configurable.
|
||||||
if ($id_module_type !== 6 && $id_module_type !== 7) {
|
if ($id_module_type !== 6 && $id_module_type !== 7) {
|
||||||
|
$tcp_port = (empty($tcp_port) === false) ? $tcp_port : get_parameter('tcp_port');
|
||||||
$data[1] = html_print_input_text(
|
$data[1] = html_print_input_text(
|
||||||
'tcp_port',
|
'tcp_port',
|
||||||
$tcp_port,
|
$tcp_port,
|
||||||
|
@ -612,8 +612,8 @@ function snmp_browser_print_oid(
|
|||||||
$table->head[1] = __('OID Information');
|
$table->head[1] = __('OID Information');
|
||||||
$output .= html_print_table($table, true);
|
$output .= html_print_table($table, true);
|
||||||
|
|
||||||
$url = 'index.php?'.'sec=gmodules&'.'sec2=godmode/modules/manage_network_components';
|
$url = 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components';
|
||||||
$output .= '<form id="snmp_create_module" class="center mrgn_10px" target="_blank" method="post" action="'.$url.'">';
|
$output .= '<form id="snmp_create_module" class="center mrgn_10px flex" target="_blank" method="post" action="'.$url.'">';
|
||||||
$output .= html_print_input_hidden('create_network_from_snmp_browser', 1, true);
|
$output .= html_print_input_hidden('create_network_from_snmp_browser', 1, true);
|
||||||
$output .= html_print_input_hidden('id_component_type', 2, true);
|
$output .= html_print_input_hidden('id_component_type', 2, true);
|
||||||
$output .= html_print_input_hidden('type', 17, true);
|
$output .= html_print_input_hidden('type', 17, true);
|
||||||
@ -638,19 +638,21 @@ function snmp_browser_print_oid(
|
|||||||
__('Create network component'),
|
__('Create network component'),
|
||||||
'create_network_component',
|
'create_network_component',
|
||||||
false,
|
false,
|
||||||
'class="sub add float-left mrgn_right_20px"',
|
'class="buttonButton mrgn_right_20px"',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Hidden by default.
|
if (isset($_POST['print_create_agent_module'])) {
|
||||||
$output .= html_print_button(
|
// Hidden by default.
|
||||||
__('Create agent module'),
|
$output .= html_print_button(
|
||||||
'create_module_agent_single',
|
__('Create agent module'),
|
||||||
false,
|
'create_module_agent_single',
|
||||||
'show_add_module()',
|
false,
|
||||||
'class="sub add invisible"',
|
'show_add_module()',
|
||||||
true
|
'class="sub add invisible"',
|
||||||
);
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Select agent modal.
|
// Select agent modal.
|
||||||
$output .= snmp_browser_print_create_modules(true);
|
$output .= snmp_browser_print_create_modules(true);
|
||||||
@ -685,7 +687,8 @@ function snmp_browser_print_container(
|
|||||||
$width='100%',
|
$width='100%',
|
||||||
$height='60%',
|
$height='60%',
|
||||||
$display='',
|
$display='',
|
||||||
$show_massive_buttons=false
|
$show_massive_buttons=false,
|
||||||
|
$toggle=false
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -948,8 +951,22 @@ function snmp_browser_print_container(
|
|||||||
);
|
);
|
||||||
$table->data[2] .= '</div>';
|
$table->data[2] .= '</div>';
|
||||||
|
|
||||||
|
if ($toggle == true) {
|
||||||
|
$print_create_agent_module = 1;
|
||||||
|
} else {
|
||||||
|
$print_create_agent_module = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$searchForm = '<form onsubmit="snmpBrowse(); return false;">';
|
$searchForm = '<form onsubmit="snmpBrowse(); return false;">';
|
||||||
$searchForm .= html_print_table($table, true);
|
$searchForm .= html_print_table($table, true);
|
||||||
|
$searchForm .= html_print_input_hidden(
|
||||||
|
'print_create_agent_module',
|
||||||
|
$print_create_agent_module,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'print_create_agent_module'
|
||||||
|
);
|
||||||
$searchForm .= html_print_div(
|
$searchForm .= html_print_div(
|
||||||
[
|
[
|
||||||
'class' => 'action-buttons',
|
'class' => 'action-buttons',
|
||||||
@ -969,17 +986,19 @@ function snmp_browser_print_container(
|
|||||||
|
|
||||||
$searchForm .= '</form>';
|
$searchForm .= '</form>';
|
||||||
|
|
||||||
ui_toggle(
|
if ($toggle == true) {
|
||||||
$searchForm,
|
ui_toggle(
|
||||||
'<span class="subsection_header_title">'.__('Filters').'</span>',
|
$searchForm,
|
||||||
'filter_form',
|
'<span class="subsection_header_title">'.__('Filters').'</span>',
|
||||||
'',
|
'filter_form',
|
||||||
false,
|
'',
|
||||||
false,
|
false,
|
||||||
'',
|
false,
|
||||||
'white-box-content',
|
'',
|
||||||
'box-flat white_table_graph fixed_filter_bar'
|
'white-box-content',
|
||||||
);
|
'box-flat white_table_graph fixed_filter_bar'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Search tools.
|
// Search tools.
|
||||||
$table2 = new stdClass();
|
$table2 = new stdClass();
|
||||||
@ -1101,6 +1120,62 @@ function snmp_browser_print_container(
|
|||||||
);
|
);
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
|
|
||||||
|
if ($toggle === false) {
|
||||||
|
// This extra div that can be handled by jquery's dialog.
|
||||||
|
$output .= '<div id="snmp_browser_container" style="display:none">';
|
||||||
|
$output .= '<div style="text-align: left; width: '.$width.'; height: '.$height.';">';
|
||||||
|
$output .= '<div class="w100p">';
|
||||||
|
$output .= '<form onsubmit="snmpBrowse(); return false;">';
|
||||||
|
$output .= html_print_table($table, true);
|
||||||
|
$output .= html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'action-buttons',
|
||||||
|
'content' => html_print_submit_button(
|
||||||
|
__('Execute'),
|
||||||
|
'srcbutton',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'mode' => 'mini',
|
||||||
|
'icon' => 'cog',
|
||||||
|
],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</form></div>';
|
||||||
|
|
||||||
|
if (isset($snmp_version) === false) {
|
||||||
|
$snmp_version = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($snmp_version == 3) {
|
||||||
|
$output .= '<div id="snmp3_browser_options">';
|
||||||
|
} else {
|
||||||
|
$output .= '<div id="snmp3_browser_options" style="display: none;">';
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= ui_toggle(
|
||||||
|
html_print_table($table3, true),
|
||||||
|
__('SNMP v3 options'),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
$output .= '<div class="search_options">';
|
||||||
|
$output .= ui_toggle(
|
||||||
|
html_print_table($table2, true),
|
||||||
|
__('Search options'),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
// SNMP tree container.
|
// SNMP tree container.
|
||||||
$output .= '<div class="snmp_tree_container" id="snmp_tree_container" style="display:none">';
|
$output .= '<div class="snmp_tree_container" id="snmp_tree_container" style="display:none">';
|
||||||
$output .= html_print_input_hidden('search_count', 0, true);
|
$output .= html_print_input_hidden('search_count', 0, true);
|
||||||
|
@ -257,6 +257,8 @@ function snmpGet(oid) {
|
|||||||
var snmp3_privacy_pass = $("#password-snmp3_browser_privacy_pass").val();
|
var snmp3_privacy_pass = $("#password-snmp3_browser_privacy_pass").val();
|
||||||
var ajax_url = $("#hidden-ajax_url").val();
|
var ajax_url = $("#hidden-ajax_url").val();
|
||||||
var server_to_exec = $("#server_to_exec").val();
|
var server_to_exec = $("#server_to_exec").val();
|
||||||
|
var target_port = $("#target_port").val();
|
||||||
|
var print_create_agent_module = $("#print_create_agent_module").val();
|
||||||
|
|
||||||
// Check for a custom action
|
// Check for a custom action
|
||||||
var custom_action = $("#hidden-custom_action").val();
|
var custom_action = $("#hidden-custom_action").val();
|
||||||
@ -280,6 +282,8 @@ function snmpGet(oid) {
|
|||||||
params["action"] = "snmpget";
|
params["action"] = "snmpget";
|
||||||
params["custom_action"] = custom_action;
|
params["custom_action"] = custom_action;
|
||||||
params["page"] = "include/ajax/snmp_browser.ajax";
|
params["page"] = "include/ajax/snmp_browser.ajax";
|
||||||
|
params["target_port"] = target_port;
|
||||||
|
params["print_create_agent_module"] = print_create_agent_module;
|
||||||
|
|
||||||
// SNMP get!
|
// SNMP get!
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
@ -560,7 +564,7 @@ function snmpBrowserWindow() {
|
|||||||
background: "black"
|
background: "black"
|
||||||
},
|
},
|
||||||
width: 1000,
|
width: 1000,
|
||||||
height: 500
|
height: 800
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ ui_print_standard_header(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// SNMP tree container.
|
// SNMP tree container.
|
||||||
snmp_browser_print_container(false, '100%', '60%', '', true);
|
snmp_browser_print_container(false, '100%', '60%', '', true, true);
|
||||||
|
|
||||||
// Div for modal.
|
// Div for modal.
|
||||||
echo '<div id="modal" style="display:none"></div>';
|
echo '<div id="modal" style="display:none"></div>';
|
||||||
@ -655,7 +655,7 @@ function show_add_module() {
|
|||||||
snmp3_auth_pass : $('#password-snmp3_browser_auth_pass').val(),
|
snmp3_auth_pass : $('#password-snmp3_browser_auth_pass').val(),
|
||||||
snmp3_privacy_method : $('#snmp3_browser_privacy_method').val(),
|
snmp3_privacy_method : $('#snmp3_browser_privacy_method').val(),
|
||||||
snmp3_privacy_pass : $('#password-snmp3_browser_privacy_pass').val(),
|
snmp3_privacy_pass : $('#password-snmp3_browser_privacy_pass').val(),
|
||||||
|
tcp_port : $('#target_port').val(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Append values to form.
|
// Append values to form.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user