SNMP views fix

This commit is contained in:
Jonathan 2023-02-23 17:09:58 +01:00
parent f08fc6a8b7
commit a09c423284
5 changed files with 260 additions and 181 deletions

View File

@ -333,7 +333,20 @@ if ($edit_filter > -2) {
echo '<div class="right w100p">';
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter=-1">';
html_print_submit_button(__('Create'), 'submit_button', false, 'class="sub next"');
html_print_action_buttons(
html_print_submit_button(
__('Create'),
'crt',
false,
[ 'icon' => 'next' ],
true
),
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
]
);
echo '</form></div>';
}
?>

View File

@ -752,7 +752,7 @@ function filemanager_file_explorer(
&& ($readOnly === false)
) {
$data[4] .= '<form method="post" action="'.$url.'" style="">';
$data[4] .= '<input type="image" class="invert_filter" src="images/cross.png" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[4] .= '<input type="image" style="margin-top: 2px;height:21px" class="invert_filter" src="images/cross.png" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_input_hidden('filename', $fileinfo['realpath'], true);
$data[4] .= html_print_input_hidden('hash', md5($fileinfo['realpath'].$config['server_unique_identifier']), true);
$data[4] .= html_print_input_hidden('delete_file', 1, true);
@ -857,7 +857,7 @@ function filemanager_file_explorer(
$createFolderElements = $tabs_dialog;
$createFolderElements .= sprintf('<form method="POST" action="%s">', $url);
$createFolderElements .= html_print_input_text('dirname', '', '', 30, 255, true);
$createFolderElements .= html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true);
$createFolderElements .= html_print_submit_button(__('Create'), 'crt', false, 'class="submitButton"', true);
$createFolderElements .= html_print_input_hidden('directory', $relative_directory, true);
$createFolderElements .= html_print_input_hidden('create_dir', 1, true);
$createFolderElements .= html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true);
@ -897,7 +897,7 @@ function filemanager_file_explorer(
$uploadFileElements .= html_print_input_hidden('upload_file', 1, true);
}
$uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true);
$uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, 'class="mrgn_lft_10px submitButton" style="display: inline;"', true);
$uploadFileElements .= html_print_input_hidden('real_directory', $real_directory, true);
$uploadFileElements .= html_print_input_hidden('directory', $relative_directory, true);
$uploadFileElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true);
@ -918,7 +918,7 @@ function filemanager_file_explorer(
$createTextElements = $tabs_dialog;
$createTextElements .= '<form method="post" action="'.$url.'">';
$createTextElements .= html_print_input_text('name_file', '', '', 30, 50, true);
$createTextElements .= html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true);
$createTextElements .= html_print_submit_button(__('Create'), 'create', false, 'class="submitButton"', true);
$createTextElements .= html_print_input_hidden('real_directory', $real_directory, true);
$createTextElements .= html_print_input_hidden('directory', $relative_directory, true);
$createTextElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true);

View File

@ -690,17 +690,21 @@ function snmp_browser_print_container(
global $config;
$snmp_version = get_parameter('snmp_browser_version', '2c');
// Target selection.
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'filter-table-adv';
$table->size = [];
$table->data = [];
$table->size[0] = '30%';
$table->size[1] = '30%';
$table->size[2] = '30%';
$table->data[0][0] = '<div class="mw500px"><strong>'.__('Target IP').'</strong> &nbsp;&nbsp;';
$table->data[0][0] .= html_print_input(
$table->data[0][0] = html_print_label_input_block(
__('Target IP'),
html_print_input(
[
'type' => 'text',
'name' => 'target_ip',
@ -710,9 +714,12 @@ function snmp_browser_print_container(
'maxlength' => 0,
'return' => true,
]
)
);
$table->data[0][0] .= '&nbsp;&nbsp<strong>'.__('Port').'</strong>&nbsp;&nbsp;';
$table->data[0][0] .= html_print_input(
$table->data[0][1] .= html_print_label_input_block(
__('Port'),
html_print_input(
[
'type' => 'number',
'name' => 'target_port',
@ -721,30 +728,36 @@ function snmp_browser_print_container(
'required' => true,
'return' => true,
]
)
);
$table->data[0][0] .= '</div>';
$table->data[0][1] = '<strong>'.__('Community').'</strong> &nbsp;&nbsp;';
$table->data[0][1] .= html_print_input_text(
$table->data[0][2] = html_print_label_input_block(
__('Community'),
html_print_input_text(
'community',
get_parameter('community', ''),
'',
25,
0,
true
)
);
$table->data[0][2] = '<strong>'.__('Starting OID').'</strong> &nbsp;&nbsp;';
$table->data[0][2] .= html_print_input_text(
$table->data[1][0] = html_print_label_input_block(
__('Starting OID'),
html_print_input_text(
'starting_oid',
get_parameter('starting_oid', '.1.3.6.1.2.1.2.2'),
'',
25,
0,
true
)
);
$table->data[1][0] = '<strong>'.__('Version').'</strong> &nbsp;&nbsp;';
$table->data[1][0] .= html_print_select(
$table->data[1][1] = html_print_label_input_block(
__('Version'),
html_print_select(
[
'1' => 'v. 1',
'2' => 'v. 2',
@ -759,7 +772,10 @@ function snmp_browser_print_container(
true,
false,
false,
''
'',
false,
'width: 100%',
)
);
$servers_to_exec = [];
@ -782,31 +798,22 @@ function snmp_browser_print_container(
}
}
$table->data[1][1] = '<strong>';
$table->data[1][1] .= __('Server to execute');
$table->data[1][1] .= '</strong> &nbsp;&nbsp;';
$table->data[1][1] .= html_print_select(
$table->data[1][2] = html_print_label_input_block(
__('Server to execute'),
html_print_select(
$servers_to_exec,
'server_to_exec',
'',
'',
'',
'',
true
);
$table->data[1][2] = html_print_input(
[
'type' => 'submit',
'label' => __('Browse'),
'name' => 'browse',
'disabled' => false,
'script' => 'snmpBrowse()',
'attributes' => 'class="sub search mrgn_top_0px"',
'return' => true,
],
'div',
true
true,
false,
false,
'',
false,
'width: 100%',
)
);
// SNMP v3 options.
@ -819,39 +826,46 @@ function snmp_browser_print_container(
$table3 = new stdClass();
$table3->width = '100%';
$table3->class = 'filter-table-adv';
$table3->valign[0] = '';
$table3->valign[1] = '';
$table3->size[0] = '30%';
$table3->size[1] = '30%';
$table3->size[2] = '30%';
$table3->data[2][1] = '<b>'.__('Auth user').'</b>';
$table3->data[2][2] = html_print_input_text(
$table3->data[0][0] = html_print_label_input_block(
__('Auth user'),
html_print_input_text(
'snmp3_browser_auth_user',
$snmp3_auth_user,
'',
15,
60,
true
)
);
$table3->data[2][3] = '<b>'.__('Auth password').'</b>';
$table3->data[2][4] = html_print_input_password(
$table3->data[0][1] = html_print_label_input_block(
__('Auth password'),
'<div>'.html_print_input_password(
'snmp3_browser_auth_pass',
$snmp3_auth_pass,
'',
15,
60,
true
).'</div>'
);
$table3->data[2][4] .= html_print_input_hidden_extended(
$table3->data[0][1] .= html_print_input_hidden_extended(
'active_snmp_v3',
0,
'active_snmp_v3_fsb',
true
);
$table3->data[5][0] = '<b>'.__('Privacy method').'</b>';
$table3->data[5][1] = html_print_select(
$table3->data[0][2] = html_print_label_input_block(
__('Privacy method'),
html_print_select(
[
'DES' => __('DES'),
'AES' => __('AES'),
@ -862,20 +876,24 @@ function snmp_browser_print_container(
'',
'',
true
)
);
$table3->data[5][2] = '<b>'.__('Privacy pass').'</b>';
$table3->data[5][3] = html_print_input_password(
$table3->data[1][0] = html_print_label_input_block(
__('Privacy pass'),
'<div>'.html_print_input_password(
'snmp3_browser_privacy_pass',
$snmp3_privacy_pass,
'',
15,
60,
true
).'</div>'
);
$table3->data[6][0] = '<b>'.__('Auth method').'</b>';
$table3->data[6][1] = html_print_select(
$table3->data[1][1] = html_print_label_input_block(
__('Auth method'),
html_print_select(
[
'MD5' => __('MD5'),
'SHA' => __('SHA'),
@ -886,9 +904,12 @@ function snmp_browser_print_container(
'',
'',
true
)
);
$table3->data[6][2] = '<b>'.__('Security level').'</b>';
$table3->data[6][3] = html_print_select(
$table3->data[1][2] = html_print_label_input_block(
__('Security level'),
html_print_select(
[
'noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'),
@ -900,6 +921,64 @@ function snmp_browser_print_container(
'',
'',
true
)
);
if (isset($snmp_version) === false) {
$snmp_version = null;
}
if ($snmp_version == 3) {
$table->data[2] = '<div id="snmp3_browser_options">';
} else {
$table->data[2] = '<div id="snmp3_browser_options" style="display: none;">';
}
$table->colspan[2][0] = 3;
$table->data[2] .= ui_toggle(
html_print_table(
$table3,
true
),
__('SNMP v3 settings'),
'',
'',
true,
true
);
$table->data[2] .= '</div>';
$searchForm = '<form onsubmit="snmpBrowse(); return false;">';
$searchForm .= html_print_table($table, true);
$searchForm .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Execute'),
'srcbutton',
false,
[
'mode' => 'mini',
'icon' => 'cog',
],
true
),
],
true
);
$searchForm .= '</form>';
ui_toggle(
$searchForm,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
false,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
// Search tools.
@ -1011,34 +1090,7 @@ function snmp_browser_print_container(
$table2->data[0][2] .= '</a>';
$table2->cellstyle[0][2] = 'text-align:center;';
// This extra div that can be handled by jquery's dialog.
$output = '<div id="snmp_browser_container" style="'.$display.'">';
$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 .= '</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 = '<div class="search_options" id="search_options" style="display:none">';
$output .= ui_toggle(
html_print_table($table2, true),
__('Search options'),
@ -1050,7 +1102,7 @@ function snmp_browser_print_container(
$output .= '</div>';
// SNMP tree container.
$output .= '<div class="snmp_tree_container">';
$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_index', -1, true);

View File

@ -59,6 +59,11 @@ function snmpBrowse() {
$("#spinner").css("display", "none");
// Load the SNMP tree
$("#snmp_tree_container").show();
$("#search_options").show();
$("#button-srcbutton")
.find("div")
.removeClass("rotation");
$("#snmp_browser").html(data);
// Manage click and select events.
@ -84,7 +89,11 @@ function snmpBrowse() {
errorThrown +
"</p>";
}
$("#snmp_tree_container").show();
$("#search_options").show();
$("#button-srcbutton")
.find("div")
.removeClass("rotation");
$("#snmp_browser").html(htmlError);
}
});

View File

@ -11291,3 +11291,8 @@ form#satellite_conf_edit > fieldset.full-column {
div[role="dialog"] {
z-index: 1115;
}
button[name="go"] {
margin-left: 10px;
display: inline !important;
}