Updated Windows agents
This commit is contained in:
parent
523bbf1bb7
commit
9b2f2fc2ee
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -822,7 +822,6 @@ function createMeshCore(agent)
|
||||||
sendConsoleText('getScript: ' + JSON.stringify(data));
|
sendConsoleText('getScript: ' + JSON.stringify(data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case 'sysinfo': {
|
case 'sysinfo': {
|
||||||
// Fetch system information
|
// Fetch system information
|
||||||
if (process.platform != 'win32') break; // Remove this when Linux/MacOS support this.
|
if (process.platform != 'win32') break; // Remove this when Linux/MacOS support this.
|
||||||
|
@ -838,6 +837,7 @@ function createMeshCore(agent)
|
||||||
try { delete x.TotalVirtualMemorySize; } catch (ex) { }
|
try { delete x.TotalVirtualMemorySize; } catch (ex) { }
|
||||||
try { delete x.TotalVisibleMemorySize; } catch (ex) { }
|
try { delete x.TotalVisibleMemorySize; } catch (ex) { }
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (process.platform == 'win32')
|
if (process.platform == 'win32')
|
||||||
{
|
{
|
||||||
var defragResult = function (r)
|
var defragResult = function (r)
|
||||||
|
@ -862,13 +862,13 @@ function createMeshCore(agent)
|
||||||
pr.sessionid = data.sessionid;
|
pr.sessionid = data.sessionid;
|
||||||
pr.then(defragResult, defragResult);
|
pr.then(defragResult, defragResult);
|
||||||
} else {
|
} else {
|
||||||
|
*/
|
||||||
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
||||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||||
}
|
//}
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||||
case 'pong': { break; }
|
case 'pong': { break; }
|
||||||
default:
|
default:
|
||||||
|
@ -1650,7 +1650,7 @@ function createMeshCore(agent)
|
||||||
var response = null;
|
var response = null;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 'help': { // Displays available commands
|
case 'help': { // Displays available commands
|
||||||
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av.'; // cpuinfo, sysinfo
|
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo.';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -1814,7 +1814,6 @@ function createMeshCore(agent)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case 'cpuinfo': { // Return system information
|
case 'cpuinfo': { // Return system information
|
||||||
// CPU & memory utilization
|
// CPU & memory utilization
|
||||||
pr = require('sysinfo').cpuUtilization();
|
pr = require('sysinfo').cpuUtilization();
|
||||||
|
@ -1850,7 +1849,6 @@ function createMeshCore(agent)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case 'info': { // Return information about the agent and agent core module
|
case 'info': { // Return information about the agent and agent core module
|
||||||
response = 'Current Core: ' + meshCoreObj.value + '.\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
|
response = 'Current Core: ' + meshCoreObj.value + '.\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
|
||||||
if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; }
|
if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; }
|
||||||
|
|
|
@ -822,7 +822,6 @@ function createMeshCore(agent)
|
||||||
sendConsoleText('getScript: ' + JSON.stringify(data));
|
sendConsoleText('getScript: ' + JSON.stringify(data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case 'sysinfo': {
|
case 'sysinfo': {
|
||||||
// Fetch system information
|
// Fetch system information
|
||||||
if (process.platform != 'win32') break; // Remove this when Linux/MacOS support this.
|
if (process.platform != 'win32') break; // Remove this when Linux/MacOS support this.
|
||||||
|
@ -838,6 +837,7 @@ function createMeshCore(agent)
|
||||||
try { delete x.TotalVirtualMemorySize; } catch (ex) { }
|
try { delete x.TotalVirtualMemorySize; } catch (ex) { }
|
||||||
try { delete x.TotalVisibleMemorySize; } catch (ex) { }
|
try { delete x.TotalVisibleMemorySize; } catch (ex) { }
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (process.platform == 'win32')
|
if (process.platform == 'win32')
|
||||||
{
|
{
|
||||||
var defragResult = function (r)
|
var defragResult = function (r)
|
||||||
|
@ -862,13 +862,13 @@ function createMeshCore(agent)
|
||||||
pr.sessionid = data.sessionid;
|
pr.sessionid = data.sessionid;
|
||||||
pr.then(defragResult, defragResult);
|
pr.then(defragResult, defragResult);
|
||||||
} else {
|
} else {
|
||||||
|
*/
|
||||||
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
||||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||||
}
|
//}
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||||
case 'pong': { break; }
|
case 'pong': { break; }
|
||||||
default:
|
default:
|
||||||
|
@ -1650,7 +1650,7 @@ function createMeshCore(agent)
|
||||||
var response = null;
|
var response = null;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 'help': { // Displays available commands
|
case 'help': { // Displays available commands
|
||||||
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av.'; // cpuinfo, sysinfo
|
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo.';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -1814,7 +1814,6 @@ function createMeshCore(agent)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case 'cpuinfo': { // Return system information
|
case 'cpuinfo': { // Return system information
|
||||||
// CPU & memory utilization
|
// CPU & memory utilization
|
||||||
pr = require('sysinfo').cpuUtilization();
|
pr = require('sysinfo').cpuUtilization();
|
||||||
|
@ -1850,7 +1849,6 @@ function createMeshCore(agent)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case 'info': { // Return information about the agent and agent core module
|
case 'info': { // Return information about the agent and agent core module
|
||||||
response = 'Current Core: ' + meshCoreObj.value + '.\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
|
response = 'Current Core: ' + meshCoreObj.value + '.\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
|
||||||
if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; }
|
if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; }
|
||||||
|
|
|
@ -910,8 +910,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
try { obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(mesh.amt)) })); } catch (ex) { }
|
try { obj.send(JSON.stringify({ action: 'amtPolicy', amtPolicy: completeIntelAmtPolicy(common.Clone(mesh.amt)) })); } catch (ex) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch system information
|
|
||||||
/*
|
/*
|
||||||
|
// Fetch system information
|
||||||
db.GetHash('si' + obj.dbNodeKey, function (err, results) {
|
db.GetHash('si' + obj.dbNodeKey, function (err, results) {
|
||||||
if ((results != null) && (results.length == 1)) { obj.send(JSON.stringify({ action: 'sysinfo', hash: results[0].hash })); } else { obj.send(JSON.stringify({ action: 'sysinfo' })); }
|
if ((results != null) && (results.length == 1)) { obj.send(JSON.stringify({ action: 'sysinfo', hash: results[0].hash })); } else { obj.send(JSON.stringify({ action: 'sysinfo' })); }
|
||||||
});
|
});
|
||||||
|
@ -1306,9 +1306,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case 'sysinfo': {
|
case 'sysinfo': {
|
||||||
//console.log('sysinfo', obj.nodeid, JSON.stringify(command.data.hash));
|
console.log('sysinfo', obj.nodeid, JSON.stringify(command.data.hash));
|
||||||
command.data._id = 'si' + obj.dbNodeKey;
|
command.data._id = 'si' + obj.dbNodeKey;
|
||||||
db.Set(command.data); // Update system information in the database.
|
db.Set(command.data); // Update system information in the database.
|
||||||
break;
|
break;
|
||||||
|
@ -1320,7 +1319,6 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
default: {
|
default: {
|
||||||
parent.agentStats.unknownAgentActionCount++;
|
parent.agentStats.unknownAgentActionCount++;
|
||||||
console.log('Unknown agent action (' + obj.remoteaddrport + '): ' + command.action + '.');
|
console.log('Unknown agent action (' + obj.remoteaddrport + '): ' + command.action + '.');
|
||||||
|
|
Loading…
Reference in New Issue