Merge branch 'master' of https://github.com/Ylianst/MeshCentral
This commit is contained in:
commit
4ec9a3bfcd
|
@ -1081,14 +1081,33 @@ function createMeshCore(agent) {
|
|||
};
|
||||
|
||||
// Remote terminal using native pipes
|
||||
if (process.platform == "win32") {
|
||||
try {
|
||||
if (((this.httprequest.protocol == 6) || (this.httprequest.protocol == 9)) && (require('win-terminal').PowerShellCapable() == true)) {
|
||||
this.httprequest._term = require('win-terminal').StartPowerShell(80, 25); // TODO: Start as logged in used when protocol is 9
|
||||
} else {
|
||||
this.httprequest._term = require('win-terminal').Start(80, 25); // TODO: Start as logged in used when protocol is 8
|
||||
if (process.platform == "win32")
|
||||
{
|
||||
try
|
||||
{
|
||||
if (((this.httprequest.protocol == 6) || (this.httprequest.protocol == 8)) && (require('win-terminal').PowerShellCapable() == true))
|
||||
{
|
||||
//if (require('win-virtual-terminal').supported)
|
||||
//{
|
||||
// this.httprequest._term = require('win-virtual-terminal').StartPowerShell(80, 25);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.httprequest._term = require('win-terminal').StartPowerShell(80, 25); // TODO: Start as logged in used when protocol is 8
|
||||
//}
|
||||
} else
|
||||
{
|
||||
//if (require('win-virtual-terminal').supported)
|
||||
//{
|
||||
// this.httprequest._term = require('win-virtual-terminal').Start(80, 25);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this.httprequest._term = require('win-terminal').Start(80, 25); // TODO: Start as logged in used when protocol is 7
|
||||
//}
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e)
|
||||
{
|
||||
MeshServerLog('Failed to start remote terminal session, ' + e.toString() + ' (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
this.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString() }));
|
||||
this.end();
|
||||
|
@ -1097,8 +1116,11 @@ function createMeshCore(agent) {
|
|||
this.httprequest._term.pipe(this, { dataTypeSkip: 1 });
|
||||
this.pipe(this.httprequest._term, { dataTypeSkip: 1, end: false });
|
||||
this.prependListener('end', function () { this.httprequest._term.end(function () { console.log("Terminal was closed"); }); });
|
||||
} else {
|
||||
try {
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if (fs.existsSync('/usr/bin/python') && fs.existsSync('/bin/bash')) {
|
||||
this.httprequest.process = childProcess.execFile('/usr/bin/python', ['python', '-c', "import pty; pty.spawn([\"/bin/bash\"])"], { uid: (this.httprequest.protocol == 8) ? require('user-sessions').consoleUid() : null }); // Start as active user
|
||||
if (process.platform == 'linux') { this.httprequest.process.stdin.write("export TERM='xterm'\nalias ls='ls --color=auto'\nclear\n"); }
|
||||
|
@ -1109,7 +1131,8 @@ function createMeshCore(agent) {
|
|||
this.httprequest.process = childProcess.execFile('/bin/sh', ['sh'], { type: childProcess.SpawnTypes.TERM, uid: (this.httprequest.protocol == 8)?require('user-sessions').consoleUid():null }); // Start as active user
|
||||
if (process.platform == 'linux') { this.httprequest.process.stdin.write("stty erase ^H\nalias ls='ls --color=auto'\nPS1='\\u@\\h:\\w\\$ '\nclear\n"); }
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e)
|
||||
{
|
||||
MeshServerLog("Failed to start remote terminal session, " + e.toString() + ' (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
this.write(JSON.stringify({ ctrlChannel: '102938', type: 'console', msg: e.toString() }));
|
||||
this.end();
|
||||
|
|
Loading…
Reference in New Issue