Added descriptor tracking to console command

Bryan Roe committed May 19, 2020 at 14:56 UTC 419ae09d437840704b24589d1cac4e968cdb6203
1 file changed +14 -1
agents/meshcore.js
+14 -1
@@ -2142,7 +2142,7 @@ function createMeshCore(agent) {
2142 var response = null;
2143 switch (cmd) {
2144 case 'help': { // Displays available commands
2145 - 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';
2145 + 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';
2146 if (process.platform == 'win32') { availcommands += ',safemode,wpfhwacceleration,uac'; }
2147 if (process.platform != 'freebsd') { availcommands += ',vm';}
2148 if (require('MeshAgent').maxKvmTileSize != null) { availcommands += ',kvmmode'; }
@@ -2156,6 +2156,19 @@ function createMeshCore(agent) {
2156 response = "Available commands: \r\n" + fin + ".";
2157 break;
2158 }
2159 + case 'fdsnapshot':
2160 + require('ChainViewer').getSnapshot().then(function (c) { sendConsoleText(c, this.sessionid); }).parentPromise.sessionid = sessionid;
2161 + break;
2162 + case 'fdcount':
2163 + require('DescriptorEvents').getDescriptorCount().then(
2164 + function (c)
2165 + {
2166 + sendConsoleText('Descriptor Count: ' + c, this.sessionid);
2167 + }, function (e)
2168 + {
2169 + sendConsoleText('Error fetching descriptor count: ' + e, this.sessionid);
2170 + }).parentPromise.sessionid = sessionid;
2171 + break;
2172 case 'uac':
2173 if (process.platform != 'win32')
2174 {