Quick shell telnet improvements
This commit is contained in:
parent
47e6f4adb5
commit
c963681098
|
@ -44,7 +44,7 @@ function quickShell()
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (check_acl($config['id_user'], 0, 'PM') === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
'Trying to access Profile Management'
|
'Trying to access Profile Management'
|
||||||
|
@ -102,6 +102,7 @@ function quickShell()
|
||||||
'ssh' => __('SSH'),
|
'ssh' => __('SSH'),
|
||||||
'telnet' => __('Telnet'),
|
'telnet' => __('Telnet'),
|
||||||
],
|
],
|
||||||
|
'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -129,6 +130,7 @@ function quickShell()
|
||||||
config_update_value('ws_port', 8080);
|
config_update_value('ws_port', 8080);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gotty settings. Internal communication (WS).
|
||||||
if (isset($config['gotty_host']) === false) {
|
if (isset($config['gotty_host']) === false) {
|
||||||
config_update_value('gotty_host', '127.0.0.1');
|
config_update_value('gotty_host', '127.0.0.1');
|
||||||
}
|
}
|
||||||
|
@ -141,6 +143,7 @@ function quickShell()
|
||||||
config_update_value('gotty_ssh_port', 8081);
|
config_update_value('gotty_ssh_port', 8081);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize Gotty Client.
|
||||||
$host = $config['gotty_host'];
|
$host = $config['gotty_host'];
|
||||||
if ($method == 'ssh') {
|
if ($method == 'ssh') {
|
||||||
// SSH.
|
// SSH.
|
||||||
|
@ -151,20 +154,21 @@ function quickShell()
|
||||||
// Telnet.
|
// Telnet.
|
||||||
$port = $config['gotty_telnet_port'];
|
$port = $config['gotty_telnet_port'];
|
||||||
$command_arguments = "var args = '?arg=-l ".$username;
|
$command_arguments = "var args = '?arg=-l ".$username;
|
||||||
$command_arguments .= '&arg= '.$address;
|
$command_arguments .= '&arg='.$address;
|
||||||
$command_arguments .= '&arg= '.$method_port."';";
|
$command_arguments .= '&arg='.$method_port."';";
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('Please use SSH or Telnet.'));
|
ui_print_error_message(__('Please use SSH or Telnet.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = file_get_contents('http://'.$host.':'.$port.'/js/hterm.js');
|
$r = file_get_contents('http://'.$host.':'.$port.'/js/hterm.js');
|
||||||
|
|
||||||
if (empty($r) === true) {
|
if (empty($r) === true) {
|
||||||
echo 'No hay nadie al volante, peligro constante';
|
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
|
||||||
|
echo $wiz->printGoBackButton('#');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override gotty client settings.
|
||||||
if (empty($config['gotty_user'])
|
if (empty($config['gotty_user'])
|
||||||
&& empty($config['gotty_pass'])
|
&& empty($config['gotty_pass'])
|
||||||
) {
|
) {
|
||||||
|
@ -174,9 +178,8 @@ function quickShell()
|
||||||
$r .= $config['gotty_user'].':'.$gotty_pass."';";
|
$r .= $config['gotty_user'].':'.$gotty_pass."';";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set websocket target and method.
|
||||||
$gotty = file_get_contents('http://'.$host.':'.$port.'/js/gotty.js');
|
$gotty = file_get_contents('http://'.$host.':'.$port.'/js/gotty.js');
|
||||||
|
|
||||||
// Set websocket target.
|
|
||||||
$url = "var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';";
|
$url = "var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';";
|
||||||
if (empty($config['ws_proxy_url']) === true) {
|
if (empty($config['ws_proxy_url']) === true) {
|
||||||
$new = "var url = (httpsEnabled ? 'wss://' : 'ws://')";
|
$new = "var url = (httpsEnabled ? 'wss://' : 'ws://')";
|
||||||
|
|
Loading…
Reference in New Issue