2019-10-14 07:59:29 +02:00
|
|
|
<?php
|
2019-10-21 17:36:26 +02:00
|
|
|
/**
|
|
|
|
* Quick Shell extension.
|
|
|
|
*
|
|
|
|
* @category Extension
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage QuickShell
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
2020-11-27 13:52:35 +01:00
|
|
|
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
2019-10-21 17:36:26 +02:00
|
|
|
* Please see http://pandorafms.org for full contribution list
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation for version 2.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Begin.
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
require_once $config['homedir'].'/include/functions_agents.php';
|
|
|
|
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
|
|
|
|
|
|
|
|
2022-01-21 17:39:11 +01:00
|
|
|
/**
|
|
|
|
* Undocumented function
|
|
|
|
*
|
|
|
|
* @param string $url Url.
|
|
|
|
* @param array $params Params.
|
|
|
|
*
|
|
|
|
* @return mixed Result
|
|
|
|
*/
|
|
|
|
function curl(string $url, array $params)
|
|
|
|
{
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
|
|
|
$get_result = curl_exec($ch);
|
|
|
|
|
|
|
|
curl_close($ch);
|
|
|
|
|
|
|
|
return $get_result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-21 17:36:26 +02:00
|
|
|
/**
|
|
|
|
* Show Quick Shell interface.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function quickShell()
|
2019-10-14 07:59:29 +02:00
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
2019-10-21 17:36:26 +02:00
|
|
|
check_login();
|
|
|
|
|
2019-10-21 21:10:26 +02:00
|
|
|
if (check_acl($config['id_user'], 0, 'PM') === false) {
|
2019-10-21 17:36:26 +02:00
|
|
|
db_pandora_audit(
|
2022-01-20 10:55:23 +01:00
|
|
|
AUDIT_LOG_ACL_VIOLATION,
|
2019-10-21 17:36:26 +02:00
|
|
|
'Trying to access Profile Management'
|
|
|
|
);
|
|
|
|
include 'general/noaccess.php';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$agent_id = get_parameter('id_agente', 0);
|
|
|
|
$username = get_parameter('username', null);
|
|
|
|
$method = get_parameter('method', null);
|
|
|
|
$method_port = get_parameter('port', null);
|
|
|
|
|
|
|
|
// Retrieve main IP Address.
|
|
|
|
$address = agents_get_address($agent_id);
|
|
|
|
|
|
|
|
ui_require_css_file('wizard');
|
|
|
|
ui_require_css_file('discovery');
|
|
|
|
|
2019-10-23 15:23:21 +02:00
|
|
|
// Settings.
|
2019-12-13 11:46:44 +01:00
|
|
|
// WebSocket host, where client should connect.
|
2019-10-23 15:23:21 +02:00
|
|
|
if (isset($config['ws_port']) === false) {
|
|
|
|
config_update_value('ws_port', 8080);
|
|
|
|
}
|
|
|
|
|
2019-10-29 15:44:46 +01:00
|
|
|
if (empty($config['ws_proxy_url']) === true) {
|
2019-12-13 11:46:44 +01:00
|
|
|
$ws_url = 'http://'.$_SERVER['SERVER_ADDR'].':'.$config['ws_port'];
|
2019-10-23 15:23:21 +02:00
|
|
|
} else {
|
2019-10-23 19:19:38 +02:00
|
|
|
preg_match('/\/\/(.*)/', $config['ws_proxy_url'], $matches);
|
2019-10-23 19:56:48 +02:00
|
|
|
if (isset($_SERVER['HTTPS']) === true) {
|
|
|
|
$ws_url = 'https://'.$matches[1];
|
|
|
|
} else {
|
|
|
|
$ws_url = 'http://'.$matches[1];
|
|
|
|
}
|
2019-10-23 15:23:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Gotty settings. Internal communication (WS).
|
|
|
|
if (isset($config['gotty_host']) === false) {
|
|
|
|
config_update_value('gotty_host', '127.0.0.1');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($config['gotty_telnet_port']) === false) {
|
|
|
|
config_update_value('gotty_telnet_port', 8082);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($config['gotty_ssh_port']) === false) {
|
|
|
|
config_update_value('gotty_ssh_port', 8081);
|
|
|
|
}
|
|
|
|
|
2020-11-17 17:06:36 +01:00
|
|
|
// Context to allow self-signed certs.
|
|
|
|
$context = stream_context_create(
|
|
|
|
[
|
|
|
|
'http' => [ 'method' => 'GET'],
|
|
|
|
'ssl' => [
|
|
|
|
'verify_peer' => false,
|
|
|
|
'verify_peer_name' => false,
|
|
|
|
],
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2019-10-21 17:36:26 +02:00
|
|
|
// Username. Retrieve from form.
|
|
|
|
if (empty($username) === true) {
|
|
|
|
// No username provided, ask for it.
|
|
|
|
$wiz = new Wizard();
|
2019-10-23 15:23:21 +02:00
|
|
|
|
2022-01-21 17:39:11 +01:00
|
|
|
$test = curl($ws_url, []);
|
2019-10-23 15:23:21 +02:00
|
|
|
if ($test === false) {
|
|
|
|
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
|
|
|
|
$wiz->printForm(
|
|
|
|
[
|
2023-03-13 17:39:58 +01:00
|
|
|
'form' => [
|
2019-10-23 15:23:21 +02:00
|
|
|
'method' => 'POST',
|
|
|
|
'action' => '#',
|
2023-03-13 17:39:58 +01:00
|
|
|
'id' => 'retry_form',
|
2019-10-23 15:23:21 +02:00
|
|
|
],
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2023-03-13 17:39:58 +01:00
|
|
|
html_print_action_buttons(
|
|
|
|
html_print_submit_button(
|
|
|
|
__('Retry'),
|
|
|
|
'submit',
|
|
|
|
false,
|
|
|
|
[
|
|
|
|
'icon' => 'next',
|
|
|
|
'form' => 'retry_form',
|
|
|
|
],
|
|
|
|
true
|
|
|
|
)
|
|
|
|
);
|
2019-10-23 15:23:21 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-21 17:36:26 +02:00
|
|
|
$wiz->printForm(
|
|
|
|
[
|
|
|
|
'form' => [
|
|
|
|
'action' => '#',
|
|
|
|
'class' => 'wizard',
|
|
|
|
'method' => 'post',
|
2023-03-13 17:39:58 +01:00
|
|
|
'id' => 'connect_form',
|
2019-10-21 17:36:26 +02:00
|
|
|
],
|
|
|
|
'inputs' => [
|
|
|
|
[
|
|
|
|
'label' => __('Username'),
|
|
|
|
'arguments' => [
|
|
|
|
'type' => 'text',
|
|
|
|
'name' => 'username',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'label' => __('Port'),
|
|
|
|
'arguments' => [
|
|
|
|
'type' => 'text',
|
|
|
|
'id' => 'port',
|
|
|
|
'name' => 'port',
|
|
|
|
'value' => 22,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'label' => __('Method'),
|
|
|
|
'arguments' => [
|
|
|
|
'type' => 'select',
|
|
|
|
'name' => 'method',
|
|
|
|
'fields' => [
|
|
|
|
'ssh' => __('SSH'),
|
|
|
|
'telnet' => __('Telnet'),
|
|
|
|
],
|
2019-10-21 21:10:26 +02:00
|
|
|
'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);",
|
2019-10-21 17:36:26 +02:00
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
false,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2023-03-13 17:39:58 +01:00
|
|
|
html_print_action_buttons(
|
|
|
|
html_print_submit_button(
|
|
|
|
__('Connect'),
|
|
|
|
'submit',
|
|
|
|
false,
|
|
|
|
[
|
|
|
|
'icon' => 'cog',
|
|
|
|
'form' => 'connect_form',
|
|
|
|
],
|
|
|
|
true
|
|
|
|
)
|
|
|
|
);
|
2019-10-21 17:36:26 +02:00
|
|
|
return;
|
2019-10-14 07:59:29 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 21:10:26 +02:00
|
|
|
// Initialize Gotty Client.
|
2019-10-21 17:36:26 +02:00
|
|
|
$host = $config['gotty_host'];
|
|
|
|
if ($method == 'ssh') {
|
|
|
|
// SSH.
|
|
|
|
$port = $config['gotty_ssh_port'];
|
|
|
|
$command_arguments = "var args = '?arg=".$username.'@'.$address;
|
|
|
|
$command_arguments .= '&arg=-p '.$method_port."';";
|
|
|
|
} else if ($method == 'telnet') {
|
|
|
|
// Telnet.
|
|
|
|
$port = $config['gotty_telnet_port'];
|
2020-04-17 11:18:49 +02:00
|
|
|
$username = preg_replace('/[^a-zA-Z0-9\-\.]/', '', $username);
|
2019-10-21 17:36:26 +02:00
|
|
|
$command_arguments = "var args = '?arg=-l ".$username;
|
2019-10-21 21:10:26 +02:00
|
|
|
$command_arguments .= '&arg='.$address;
|
2020-04-17 11:18:49 +02:00
|
|
|
$command_arguments .= '&arg='.$method_port."&arg=-E';";
|
2019-10-21 17:36:26 +02:00
|
|
|
} else {
|
|
|
|
ui_print_error_message(__('Please use SSH or Telnet.'));
|
|
|
|
return;
|
|
|
|
}
|
2019-10-17 15:31:17 +02:00
|
|
|
|
2020-11-17 17:06:36 +01:00
|
|
|
// If rediretion is enabled, we will try to connect using
|
|
|
|
// http:// or https:// endpoint.
|
2022-01-21 17:39:11 +01:00
|
|
|
$test = get_headers($ws_url, false, $context);
|
2019-10-23 15:23:21 +02:00
|
|
|
if ($test === false) {
|
|
|
|
if (empty($wiz) === true) {
|
|
|
|
$wiz = new Wizard();
|
|
|
|
}
|
|
|
|
|
|
|
|
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
|
|
|
|
echo $wiz->printGoBackButton('#');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-24 12:05:00 +02:00
|
|
|
// Check credentials.
|
|
|
|
$auth_str = '';
|
|
|
|
$gotty_url = $host.':'.$port;
|
|
|
|
if (empty($config['gotty_user']) === false
|
|
|
|
&& empty($config['gotty_pass']) === false
|
|
|
|
) {
|
2019-11-21 18:21:46 +01:00
|
|
|
$auth_str = io_safe_output($config['gotty_user']);
|
|
|
|
$auth_str .= ':'.io_output_password($config['gotty_pass']);
|
2019-10-24 12:05:00 +02:00
|
|
|
$gotty_url = $auth_str.'@'.$host.':'.$port;
|
|
|
|
}
|
|
|
|
|
|
|
|
$r = file_get_contents('http://'.$gotty_url.'/js/hterm.js');
|
2019-10-21 17:36:26 +02:00
|
|
|
if (empty($r) === true) {
|
2019-10-23 15:23:21 +02:00
|
|
|
if (empty($wiz) === true) {
|
|
|
|
$wiz = new Wizard();
|
|
|
|
}
|
|
|
|
|
|
|
|
ui_print_error_message(__('WebService engine is not working properly, please check documentation.'));
|
2019-10-21 21:10:26 +02:00
|
|
|
echo $wiz->printGoBackButton('#');
|
2019-10-21 17:36:26 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-21 21:10:26 +02:00
|
|
|
// Override gotty client settings.
|
2019-10-24 12:05:00 +02:00
|
|
|
if (empty($auth_str) === true) {
|
2019-10-21 17:36:26 +02:00
|
|
|
$r .= "var gotty_auth_token = '';";
|
|
|
|
} else {
|
|
|
|
$r .= "var gotty_auth_token = '";
|
2019-10-24 12:05:00 +02:00
|
|
|
$r .= $auth_str."';";
|
2019-10-21 17:36:26 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 21:10:26 +02:00
|
|
|
// Set websocket target and method.
|
2019-10-24 12:05:00 +02:00
|
|
|
$gotty = file_get_contents('http://'.$gotty_url.'/js/gotty.js');
|
2019-10-17 15:31:17 +02:00
|
|
|
$url = "var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';";
|
2019-10-21 17:36:26 +02:00
|
|
|
if (empty($config['ws_proxy_url']) === true) {
|
|
|
|
$new = "var url = (httpsEnabled ? 'wss://' : 'ws://')";
|
|
|
|
$new .= " + window.location.host + ':";
|
|
|
|
$new .= $config['ws_port'].'/'.$method."';";
|
|
|
|
} else {
|
2019-10-23 19:19:38 +02:00
|
|
|
$new = "var url = '";
|
|
|
|
$new .= $config['ws_proxy_url'].'/'.$method."';";
|
2019-10-21 17:36:26 +02:00
|
|
|
}
|
2019-10-17 15:31:17 +02:00
|
|
|
|
2020-12-02 13:42:23 +01:00
|
|
|
// Update firefox issue.
|
|
|
|
$original = ' this.iframe_.src = \'#\';';
|
|
|
|
$trick = 'this.iframe_.src = \'javascript:\';';
|
|
|
|
|
|
|
|
$r = str_replace($original, $trick, $r);
|
|
|
|
|
2019-10-21 17:36:26 +02:00
|
|
|
// Update url.
|
2019-10-17 15:31:17 +02:00
|
|
|
$gotty = str_replace($url, $new, $gotty);
|
|
|
|
|
2019-10-21 17:36:26 +02:00
|
|
|
// Update websocket arguments.
|
|
|
|
$args = 'var args = window.location.search;';
|
|
|
|
$new = $command_arguments;
|
|
|
|
|
|
|
|
// Update arguments.
|
|
|
|
$gotty = str_replace($args, $new, $gotty);
|
|
|
|
|
2019-10-17 15:31:17 +02:00
|
|
|
?>
|
|
|
|
<style>#terminal {
|
|
|
|
height: 650px;
|
|
|
|
width: 100%;
|
|
|
|
margin: 0px;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
#terminal > iframe {
|
|
|
|
position: relative!important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div id="terminal"></div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
<?php echo $r; ?>
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
<?php echo $gotty; ?>
|
|
|
|
</script>
|
|
|
|
<?php
|
2019-10-14 07:59:29 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-23 19:56:48 +02:00
|
|
|
/**
|
|
|
|
* Provide an interface where configure all settings.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function quickShellSettings()
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
ui_require_css_file('wizard');
|
|
|
|
ui_require_css_file('discovery');
|
|
|
|
|
|
|
|
// Gotty settings. Internal communication (WS).
|
2019-11-12 13:19:03 +01:00
|
|
|
if (isset($config['gotty_host']) === false) {
|
|
|
|
config_update_value('gotty_host', '127.0.0.1');
|
2019-10-23 19:56:48 +02:00
|
|
|
}
|
|
|
|
|
2019-11-12 13:19:03 +01:00
|
|
|
if (isset($config['gotty_telnet_port']) === false) {
|
|
|
|
config_update_value('gotty_telnet_port', 8082);
|
2019-10-23 19:56:48 +02:00
|
|
|
}
|
|
|
|
|
2019-11-12 13:19:03 +01:00
|
|
|
if (isset($config['gotty_ssh_port']) === false) {
|
|
|
|
config_update_value('gotty_ssh_port', 8081);
|
2019-10-23 19:56:48 +02:00
|
|
|
}
|
|
|
|
|
2019-11-12 13:19:03 +01:00
|
|
|
// Parser.
|
2019-12-13 13:11:38 +01:00
|
|
|
if (get_parameter('update_config', false) !== false) {
|
2019-11-12 13:19:03 +01:00
|
|
|
// Gotty settings. Internal communication (WS).
|
|
|
|
$gotty = get_parameter(
|
|
|
|
'gotty',
|
|
|
|
''
|
|
|
|
);
|
|
|
|
$gotty_host = get_parameter(
|
|
|
|
'gotty_host',
|
2020-05-26 13:48:43 +02:00
|
|
|
''
|
2019-11-12 13:19:03 +01:00
|
|
|
);
|
|
|
|
$gotty_ssh_port = get_parameter(
|
|
|
|
'gotty_ssh_port',
|
2020-05-26 13:48:43 +02:00
|
|
|
''
|
2019-11-12 13:19:03 +01:00
|
|
|
);
|
|
|
|
$gotty_telnet_port = get_parameter(
|
|
|
|
'gotty_telnet_port',
|
2020-05-26 13:48:43 +02:00
|
|
|
''
|
2019-11-12 13:19:03 +01:00
|
|
|
);
|
2019-10-23 19:56:48 +02:00
|
|
|
|
2019-11-12 13:19:03 +01:00
|
|
|
$gotty_user = get_parameter(
|
|
|
|
'gotty_user',
|
|
|
|
''
|
|
|
|
);
|
|
|
|
|
|
|
|
$gotty_pass = get_parameter(
|
|
|
|
'gotty_pass',
|
|
|
|
''
|
|
|
|
);
|
2019-10-24 10:59:08 +02:00
|
|
|
|
2019-11-12 13:19:03 +01:00
|
|
|
$gotty_pass = io_input_password($gotty_pass);
|
|
|
|
|
|
|
|
$changes = 0;
|
|
|
|
$critical = 0;
|
|
|
|
if ($config['gotty'] != $gotty) {
|
|
|
|
config_update_value('gotty', $gotty);
|
|
|
|
$changes++;
|
|
|
|
$critical++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config['gotty_host'] != $gotty_host) {
|
|
|
|
config_update_value('gotty_host', $gotty_host);
|
|
|
|
$changes++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config['gotty_telnet_port'] != $gotty_telnet_port) {
|
|
|
|
config_update_value('gotty_telnet_port', $gotty_telnet_port);
|
|
|
|
$changes++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config['gotty_ssh_port'] != $gotty_ssh_port) {
|
|
|
|
config_update_value('gotty_ssh_port', $gotty_ssh_port);
|
|
|
|
$changes++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config['gotty_user'] != $gotty_user) {
|
|
|
|
config_update_value('gotty_user', $gotty_user);
|
|
|
|
$changes++;
|
|
|
|
$critical++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($config['gotty_pass'] != $gotty_pass) {
|
|
|
|
$gotty_pass = io_input_password($gotty_pass);
|
|
|
|
config_update_value('gotty_pass', $gotty_pass);
|
|
|
|
$changes++;
|
|
|
|
$critical++;
|
|
|
|
}
|
2019-10-24 10:59:08 +02:00
|
|
|
}
|
|
|
|
|
2019-10-23 19:56:48 +02:00
|
|
|
if ($changes > 0) {
|
2019-10-24 12:05:00 +02:00
|
|
|
$msg = __('%d Updated', $changes);
|
2019-10-24 10:59:08 +02:00
|
|
|
if ($critical > 0) {
|
2019-10-24 12:05:00 +02:00
|
|
|
$msg = __(
|
|
|
|
'%d Updated, please restart WebSocket engine service',
|
|
|
|
$changes
|
|
|
|
);
|
2019-10-24 10:59:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ui_print_success_message($msg);
|
2019-10-23 19:56:48 +02:00
|
|
|
}
|
|
|
|
|
2019-12-13 13:11:38 +01:00
|
|
|
// Form. Using old style.
|
2023-03-16 17:49:57 +01:00
|
|
|
echo '<fieldset class="margin-bottom-10">';
|
2019-12-13 13:11:38 +01:00
|
|
|
echo '<legend>'.__('Quickshell').'</legend>';
|
|
|
|
|
|
|
|
$t = new StdClass();
|
|
|
|
$t->data = [];
|
|
|
|
$t->width = '100%';
|
2023-03-16 17:49:57 +01:00
|
|
|
$t->class = 'filter-table-adv';
|
2019-12-13 13:11:38 +01:00
|
|
|
$t->data = [];
|
2019-12-16 16:48:29 +01:00
|
|
|
$t->style = [];
|
2023-03-16 17:49:57 +01:00
|
|
|
$t->style[0] = 'width: 50%;';
|
|
|
|
|
|
|
|
$t->data[0][] = html_print_label_input_block(
|
|
|
|
__('Gotty path'),
|
|
|
|
html_print_input_text(
|
|
|
|
'gotty',
|
|
|
|
$config['gotty'],
|
|
|
|
'',
|
|
|
|
30,
|
|
|
|
100,
|
|
|
|
true
|
|
|
|
)
|
2019-12-13 13:11:38 +01:00
|
|
|
);
|
2019-10-23 19:56:48 +02:00
|
|
|
|
2023-03-16 17:49:57 +01:00
|
|
|
$t->data[0][] = html_print_label_input_block(
|
|
|
|
__('Gotty host'),
|
|
|
|
html_print_input_text(
|
|
|
|
'gotty_host',
|
|
|
|
$config['gotty_host'],
|
|
|
|
'',
|
|
|
|
30,
|
|
|
|
100,
|
|
|
|
true
|
|
|
|
)
|
2019-12-13 13:11:38 +01:00
|
|
|
);
|
|
|
|
|
2023-03-16 17:49:57 +01:00
|
|
|
$t->data[1][] = html_print_label_input_block(
|
|
|
|
__('Gotty ssh port'),
|
|
|
|
html_print_input_text(
|
|
|
|
'gotty_ssh_port',
|
|
|
|
$config['gotty_ssh_port'],
|
|
|
|
'',
|
|
|
|
30,
|
|
|
|
100,
|
|
|
|
true
|
|
|
|
)
|
2019-12-13 13:11:38 +01:00
|
|
|
);
|
|
|
|
|
2023-03-16 17:49:57 +01:00
|
|
|
$t->data[1][] = html_print_label_input_block(
|
|
|
|
__('Gotty telnet port'),
|
|
|
|
html_print_input_text(
|
|
|
|
'gotty_telnet_port',
|
|
|
|
$config['gotty_telnet_port'],
|
|
|
|
'',
|
|
|
|
30,
|
|
|
|
100,
|
|
|
|
true
|
|
|
|
)
|
2019-12-13 13:11:38 +01:00
|
|
|
);
|
|
|
|
|
2023-03-16 17:49:57 +01:00
|
|
|
$hidden = new stdClass();
|
2019-12-13 13:11:38 +01:00
|
|
|
$hidden->data = [];
|
|
|
|
$hidden->width = '100%';
|
2023-03-16 17:49:57 +01:00
|
|
|
$hidden->class = 'filter-table-adv';
|
2019-12-13 13:11:38 +01:00
|
|
|
$hidden->data = [];
|
2023-03-16 17:49:57 +01:00
|
|
|
$hidden->style[0] = 'width: 50%;';
|
|
|
|
|
|
|
|
$hidden->data[0][] = html_print_label_input_block(
|
|
|
|
__('Gotty user'),
|
|
|
|
html_print_input_text(
|
|
|
|
'gotty_user',
|
|
|
|
$config['gotty_user'],
|
|
|
|
'',
|
|
|
|
30,
|
|
|
|
100,
|
|
|
|
true
|
|
|
|
)
|
2019-12-13 13:11:38 +01:00
|
|
|
);
|
|
|
|
|
2023-03-16 17:49:57 +01:00
|
|
|
$hidden->data[0][] = html_print_label_input_block(
|
|
|
|
__('Gotty password'),
|
|
|
|
html_print_input_password(
|
|
|
|
'gotty_pass',
|
|
|
|
io_output_password($config['gotty_pass']),
|
|
|
|
'',
|
|
|
|
30,
|
|
|
|
100,
|
|
|
|
true
|
|
|
|
)
|
2019-12-13 13:11:38 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
html_print_table($t);
|
|
|
|
|
|
|
|
ui_print_toggle(
|
|
|
|
[
|
|
|
|
'content' => html_print_table($hidden, true),
|
|
|
|
'name' => __('Advanced options'),
|
|
|
|
'clean' => false,
|
|
|
|
'main_class' => 'no-border-imp',
|
|
|
|
'container_class' => 'no-border-imp',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
echo '</fieldset>';
|
2019-10-23 19:56:48 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// This extension is usefull only if the agent has associated IP.
|
|
|
|
$agent_id = get_parameter('id_agente');
|
|
|
|
if (empty($agent_id) === false
|
|
|
|
&& get_parameter('sec2', '') == 'operation/agentes/ver_agente'
|
|
|
|
) {
|
|
|
|
$address = agents_get_address($agent_id);
|
|
|
|
if (empty($address) === false) {
|
|
|
|
// Extension registration.
|
|
|
|
extensions_add_opemode_tab_agent(
|
|
|
|
// TabId.
|
|
|
|
'quick_shell',
|
|
|
|
// TabName.
|
|
|
|
__('QuickShell'),
|
|
|
|
// TabIcon.
|
2022-12-15 12:42:35 +01:00
|
|
|
'images/quick-shell@svg.svg',
|
2019-10-23 19:56:48 +02:00
|
|
|
// TabFunction.
|
|
|
|
'quickShell',
|
|
|
|
// Version.
|
|
|
|
'N/A',
|
|
|
|
// Acl.
|
|
|
|
'PM'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extensions_add_godmode_function('quickShellSettings');
|