| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_apps/leo/ui/lib/terminal/ |
Upload File : |
$(function(){ terminal.init(); });
var terminal = {
// Controller
controller : base_url + 'terminal/command/',
// DOM Objects
command : $('#command input'),
screen : $('#terminal'),
output : $('#terminal>#output'),
// Command History
command_history : [],
command_counter : -1,
history_counter : -1,
init : function(){
terminal.listener();
// Start with authentication
terminal.process_command();
},
listener : function(){
terminal.command.focus().keydown(function(e){
var code = (e.keyCode ? e.keyCode : e.which);
var command = terminal.get_command();
switch(code){
// Enter key, process command
case 13:
if(command=='clear'){
terminal.clear();
}else{
terminal.command_history[++terminal.command_counter] = command;
terminal.history_counter = terminal.command_counter;
terminal.process_command();
}
terminal.command.val('').focus();
break;
// Up arrow, reverse history
case 38:
if(terminal.history_counter>=0){
$(this).val(terminal.command_history[terminal.history_counter--]);
}
break;
// Down arrow, forward history
case 40:
if (terminal.history_counter <= terminal.command_counter) {
$(this).val(terminal.command_history[++terminal.history_counter]);
}
break;
}
});
},
process_command : function(){
var command = terminal.get_command();
terminal.screen.block({ message: block_msg });
$.post(terminal.controller,{command:command},function(data){
switch(data){
case '[CLEAR]':
terminal.clear();
break;
case '[CLOSED]':
terminal.clear();
terminal.process_command();
break;
case '[AUTHENTICATED]':
terminal.command_history = [];
terminal.command_counter = -1;
terminal.history_counter = -1;
terminal.clear();
break;
case 'Enter Password:':
terminal.clear();
terminal.display_output('Authentication Required',data);
terminal.command.css({'color':'#333'});
break;
default:
terminal.display_output(command,data);
}
terminal.screen.unblock();
});
},
get_command : function(){
return terminal.command.val();
},
display_output : function(command,data){
terminal.output.append('<pre class="command">'+command+'</pre><pre class="data">'+data+'</pre>');
terminal.screen.scrollTop(terminal.output.height());
},
clear : function(){
terminal.output.html('');
terminal.command.css({ 'color':'#fff' });
}
};