mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-11 15:03:20 -05:00
Fixed terminal.
This commit is contained in:
parent
4ec9a3bfcd
commit
5a7d097a32
@ -71,6 +71,7 @@
|
||||
<Compile Include="agents\modules_meshcore\win-console.js" />
|
||||
<Compile Include="agents\modules_meshcore\win-info.js" />
|
||||
<Compile Include="agents\modules_meshcore\win-terminal.js" />
|
||||
<Compile Include="agents\modules_meshcore\win-virtual-terminal.js" />
|
||||
<Compile Include="agents\modules_meshcore_min\amt-lme.min.js" />
|
||||
<Compile Include="agents\modules_meshcore_min\amt-mei.min.js" />
|
||||
<Compile Include="agents\modules_meshcore_min\amt-scanner.min.js" />
|
||||
|
Binary file not shown.
BIN
agents/MeshService.exe
Normal file
BIN
agents/MeshService.exe
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1085,24 +1085,16 @@ function createMeshCore(agent) {
|
||||
{
|
||||
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
|
||||
//{
|
||||
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
|
||||
//{
|
||||
} 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
|
||||
//}
|
||||
}
|
||||
|
33
agents/meshcore.min.js
vendored
33
agents/meshcore.min.js
vendored
@ -1081,14 +1081,25 @@ 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
|
||||
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 {
|
||||
this.httprequest._term = require('win-terminal').Start(80, 25); // TODO: Start as logged in used when protocol is 8
|
||||
//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 +1108,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 +1123,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();
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.4.4-x",
|
||||
"version": "0.4.4-y",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
@ -408,14 +408,14 @@ var CreateAmtRemoteTerminal = function (divid, options) {
|
||||
for (var z = 0; z < obj.width; z++) { _tscreen[y][z] = ' '; _scratt[y][z] = (7 << 6); }
|
||||
}
|
||||
break;
|
||||
case 'X': // Erase X characters, default 1 (untested)
|
||||
var x = 1;
|
||||
case 'X': // Erase X characters, default 1
|
||||
var x = 1, xx = _termx, yy = _termy;
|
||||
if (argslen == 1) { x = args[0] }
|
||||
while ((x > 0) && (_termx > 0)) { _tscreen[_termy][_termx] = ' '; _termx--; x--; }
|
||||
while ((x > 0) && (yy < obj.height)) { _tscreen[yy][xx] = ' '; xx++; x--; if (xx >= obj.width) { xx = 0; yy++; } }
|
||||
break;
|
||||
default:
|
||||
//if (code != '@') alert(code);
|
||||
console.log('unknown terminal code', code, args, mode);
|
||||
console.log('Unknown terminal code', code, args, mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user