This commit is contained in:
Ylian Saint-Hilaire 2020-05-19 19:02:35 -07:00
commit 1a3380a0d3
1 changed files with 32 additions and 3 deletions

View File

@ -1185,6 +1185,8 @@ function createMeshCore(agent) {
this.end = function () this.end = function ()
{ {
if (this.httprequest.tpromise._consent) { this.httprequest.tpromise._consent.close(); } if (this.httprequest.tpromise._consent) { this.httprequest.tpromise._consent.close(); }
if (this.httprequest.connectionPromise) { this.httprequest.connectionPromise._rej('Closed'); }
// Remove the terminal session to the count to update the server // Remove the terminal session to the count to update the server
if (this.httprequest.userid != null) if (this.httprequest.userid != null)
{ {
@ -1271,8 +1273,15 @@ function createMeshCore(agent) {
this.httprequest._dispatcher = require('win-dispatcher').dispatch({ modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } }); this.httprequest._dispatcher = require('win-dispatcher').dispatch({ modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } });
this.httprequest._dispatcher.httprequest = this.httprequest; this.httprequest._dispatcher.httprequest = this.httprequest;
this.httprequest._dispatcher.on('connection', function (c) this.httprequest._dispatcher.on('connection', function (c)
{
if (this.httprequest.connectionPromise.completed)
{
c.end();
}
else
{ {
this.httprequest.connectionPromise._res(c); this.httprequest.connectionPromise._res(c);
}
}); });
} }
else else
@ -1304,8 +1313,15 @@ function createMeshCore(agent) {
} }
that.httprequest._dispatcher.ws = that; that.httprequest._dispatcher.ws = that;
that.httprequest._dispatcher.on('connection', function (c) that.httprequest._dispatcher.on('connection', function (c)
{
if (this.ws.httprequest.connectionPromise.completed)
{
c.end();
}
else
{ {
this.ws.httprequest.connectionPromise._res(c); this.ws.httprequest.connectionPromise._res(c);
}
}); });
} }
}); });
@ -2126,7 +2142,7 @@ function createMeshCore(agent) {
var response = null; var response = null;
switch (cmd) { switch (cmd) {
case 'help': { // Displays available commands case 'help': { // Displays available commands
var fin = '', f = '', availcommands = 'startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt,wallpaper'; var fin = '', f = '', availcommands = 'fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt,wallpaper';
if (process.platform == 'win32') { availcommands += ',safemode,wpfhwacceleration,uac'; } if (process.platform == 'win32') { availcommands += ',safemode,wpfhwacceleration,uac'; }
if (process.platform != 'freebsd') { availcommands += ',vm';} if (process.platform != 'freebsd') { availcommands += ',vm';}
if (require('MeshAgent').maxKvmTileSize != null) { availcommands += ',kvmmode'; } if (require('MeshAgent').maxKvmTileSize != null) { availcommands += ',kvmmode'; }
@ -2140,6 +2156,19 @@ function createMeshCore(agent) {
response = "Available commands: \r\n" + fin + "."; response = "Available commands: \r\n" + fin + ".";
break; break;
} }
case 'fdsnapshot':
require('ChainViewer').getSnapshot().then(function (c) { sendConsoleText(c, this.sessionid); }).parentPromise.sessionid = sessionid;
break;
case 'fdcount':
require('DescriptorEvents').getDescriptorCount().then(
function (c)
{
sendConsoleText('Descriptor Count: ' + c, this.sessionid);
}, function (e)
{
sendConsoleText('Error fetching descriptor count: ' + e, this.sessionid);
}).parentPromise.sessionid = sessionid;
break;
case 'uac': case 'uac':
if (process.platform != 'win32') if (process.platform != 'win32')
{ {