Merge pull request #5387 from Ylianst/add-volume-info
Add Volumes+Bitlocker
This commit is contained in:
commit
0e671bbe81
|
@ -654,6 +654,21 @@ var meshCoreObj = { action: 'coreinfo', value: (require('MeshAgent').coreHash ?
|
|||
// Get the operating system description string
|
||||
try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; meshCoreObjChanged(); }); } catch (ex) { }
|
||||
|
||||
// Get Volumes and BitLocker if Windows
|
||||
try {
|
||||
if (process.platform == 'win32'){
|
||||
if (require('identifiers').volumes_promise != null){
|
||||
var p = require('identifiers').volumes_promise();
|
||||
p.then(function (res){
|
||||
meshCoreObj.volumes = res;
|
||||
meshCoreObjChanged();
|
||||
});
|
||||
}else if (require('identifiers').volumes != null){
|
||||
meshCoreObj.volumes = require('identifiers').volumes();
|
||||
meshCoreObjChanged();
|
||||
}
|
||||
}
|
||||
} catch(e) { }
|
||||
|
||||
// Setup logged in user monitoring (THIS IS BROKEN IN WIN7)
|
||||
try {
|
||||
|
@ -1814,10 +1829,10 @@ function getSystemInformation(func) {
|
|||
results.hardware.agentvers = process.versions;
|
||||
replaceSpacesWithUnderscoresRec(results);
|
||||
var hasher = require('SHA384Stream').create();
|
||||
results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
|
||||
func(results);
|
||||
// results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
|
||||
// func(results);
|
||||
|
||||
|
||||
/*
|
||||
// On Windows platforms, get volume information - Needs more testing.
|
||||
if (process.platform == 'win32')
|
||||
{
|
||||
|
@ -1828,14 +1843,14 @@ function getSystemInformation(func) {
|
|||
var p = require('identifiers').volumes_promise();
|
||||
p.then(function (res)
|
||||
{
|
||||
results.volumes = res;
|
||||
results.hardware.windows.volumes = res;
|
||||
results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
|
||||
func(results);
|
||||
});
|
||||
}
|
||||
else if (require('identifiers').volumes != null)
|
||||
{
|
||||
results.volumes = require('identifiers').volumes();
|
||||
results.hardware.windows.volumes = require('identifiers').volumes();
|
||||
results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
|
||||
func(results);
|
||||
}
|
||||
|
@ -1850,7 +1865,7 @@ function getSystemInformation(func) {
|
|||
results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
|
||||
func(results);
|
||||
}
|
||||
*/
|
||||
|
||||
} catch (ex) { func(null, ex); }
|
||||
}
|
||||
|
||||
|
|
|
@ -1936,6 +1936,12 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||
// TODO: Check that the agent has an interface that is the same as the one we got this websocket connection on. Only set if we have a match.
|
||||
}
|
||||
|
||||
// Volumes and BitLocker
|
||||
if(command.volumes != null){
|
||||
if(!device.volumes) { device.volumes = {}; }
|
||||
if (JSON.stringify(device.volumes) != JSON.stringify(command.volumes)) { /*changes.push('Volumes status');*/ device.volumes = command.volumes; change = 1; log = 1; }
|
||||
}
|
||||
|
||||
// If there are changes, event the new device
|
||||
if (change == 1) {
|
||||
// Do some clean up if needed, these values should not be in the database.
|
||||
|
|
11
meshuser.js
11
meshuser.js
|
@ -4928,7 +4928,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
if (type == 'csv') {
|
||||
try {
|
||||
// Create the CSV file
|
||||
output = 'id,name,rname,host,icon,ip,osdesc,groupname,av,update,firewall,avdetails,cpu,osbuild,biosDate,biosVendor,biosVersion,boardName,boardVendor,boardVersion,productUuid,totalMemory,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses,lastConnectTime,lastConnectAddr\r\n';
|
||||
output = 'id,name,rname,host,icon,ip,osdesc,groupname,av,update,firewall,bitlocker,avdetails,cpu,osbuild,biosDate,biosVendor,biosVersion,boardName,boardVendor,boardVersion,productUuid,totalMemory,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses,lastConnectTime,lastConnectAddr\r\n';
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
const nodeinfo = results[i];
|
||||
|
||||
|
@ -4939,6 +4939,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
if (typeof n.wsc == 'object') {
|
||||
output += ',' + csvClean(n.wsc.antiVirus ? n.wsc.antiVirus : '') + ',' + csvClean(n.wsc.autoUpdate ? n.wsc.autoUpdate : '') + ',' + csvClean(n.wsc.firewall ? n.wsc.firewall : '')
|
||||
} else { output += ',,,'; }
|
||||
if (typeof n.volumes == 'object') {
|
||||
var bitlockerdetails = '', firstbitlocker = true;
|
||||
for (var a in n.volumes) { if (typeof n.volumes[a].protectionStatus !== 'undefined') { if (firstbitlocker) { firstbitlocker = false; } else { bitlockerdetails += '|'; } bitlockerdetails += a + '/' + n.volumes[a].volumeStatus; } }
|
||||
output += ',' + csvClean(bitlockerdetails);
|
||||
} else {
|
||||
output += ',';
|
||||
}
|
||||
if (typeof n.av == 'object') {
|
||||
var avdetails = '', firstav = true;
|
||||
for (var a in n.av) { if (typeof n.av[a].product == 'string') { if (firstav) { firstav = false; } else { avdetails += '|'; } avdetails += (n.av[a].product + '/' + ((n.av[a].enabled) ? 'enabled' : 'disabled') + '/' + ((n.av[a].updated) ? 'updated' : 'notupdated')); } }
|
||||
|
@ -4946,7 +4953,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
}
|
||||
else { output += ','; }
|
||||
} else {
|
||||
output += ',,,,,,,,,,,';
|
||||
output += ',,,,,,,,,,,,';
|
||||
}
|
||||
|
||||
// System infomation
|
||||
|
|
|
@ -5840,6 +5840,21 @@
|
|||
x += addDetailItem("Antivirus", y.join('<br />'));
|
||||
}
|
||||
|
||||
// Volumes and Bitlocker
|
||||
if (node.volumes){
|
||||
var bitlocker = [];
|
||||
for (var i in node.volumes) {
|
||||
if (typeof node.volumes[i].protectionStatus !== 'undefined' && node.volumes[i].protectionStatus == 'On'){
|
||||
bitlocker.push(i + ' - <span style=color:green>' + node.volumes[i].volumeStatus + '</span>');
|
||||
}else if (typeof node.volumes[i].protectionStatus !== 'undefined'){
|
||||
bitlocker.push(i + ' - <span style=color:red>' + node.volumes[i].volumeStatus + '</span>');
|
||||
}
|
||||
}
|
||||
if(bitlocker.length > 0){
|
||||
x += addDetailItem("BitLocker", bitlocker.join('<br />'));
|
||||
}
|
||||
}
|
||||
|
||||
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software' }); }
|
||||
}
|
||||
|
||||
|
|
|
@ -5758,13 +5758,20 @@
|
|||
meshserver.send({ action: 'getDeviceDetails', nodeids: chkNodeIds, tz: tz, tf: new Date().getTimezoneOffset(), l: getLang(), type: 'csv' }); // With details
|
||||
} else {
|
||||
// Without details
|
||||
var csv = "id, name, rname, host, icon, ip, osdesc, state, groupname, conn, pwr, av, update, firewall, avdetails" + '\r\n', r = [];
|
||||
var csv = "id,name,rname,host,icon,ip,osdesc,state,groupname,conn,pwr,av,update,firewall,bitlocker,avdetails" + '\r\n', r = [];
|
||||
for (var i in chkNodeIds) {
|
||||
var n = getNodeFromId(chkNodeIds[i]);
|
||||
csv += '"' + n._id.split(',').join('') + '","' + n.name.split(',').join('') + '","' + (n.rname?(n.rname.split(',').join('')):'') + '","' + (n.host?(n.host.split(',').join('')):'') + '","' + n.icon + '","' + (n.ip?n.ip:'') + '","' + (n.osdesc?(n.osdesc.split(',').join('')):'') + '","' + n.state + '","' + meshes[n.meshid].name.split(',').join('') + '","' + (n.conn?n.conn:'') + '","' + (n.pwr?n.pwr:'') + '"';
|
||||
if (typeof n.wsc == 'object') { csv += ',"' + csvClean(n.wsc.antiVirus) + '","' + csvClean(n.wsc.autoUpdate) + '","' + csvClean(n.wsc.firewall) + '"'; } else { csv += ',,,'; }
|
||||
if (typeof n.volumes == 'object') {
|
||||
var bitlockerdetails = '', firstbitlocker = true;
|
||||
for (var a in n.volumes) { if (typeof n.volumes[a].protectionStatus !== 'undefined') { if (firstbitlocker) { firstbitlocker = false; } else { bitlockerdetails += '|'; } bitlockerdetails += a + '/' + n.volumes[a].volumeStatus; } }
|
||||
csv += ',"' + csvClean(bitlockerdetails) + '"'; }
|
||||
else {
|
||||
csv += ',';
|
||||
}
|
||||
if (typeof n.av == 'object') {
|
||||
var avdetails = '', firstav= true;
|
||||
var avdetails = '', firstav = true;
|
||||
for (var a in n.av) { if (typeof n.av[a].product == 'string') { if (firstav) { firstav = false; } else { avdetails += '|'; } avdetails += (n.av[a].product + '/' + ((n.av[a].enabled)?'enabled':'disabled') + '/' + ((n.av[a].updated)?'updated':'notupdated')); } }
|
||||
csv += ',"' + csvClean(avdetails) + '"'; }
|
||||
else {
|
||||
|
@ -7272,6 +7279,21 @@
|
|||
x += addDeviceAttribute("Antivirus", y.join('<br />'));
|
||||
}
|
||||
|
||||
// Volumes and Bitlocker
|
||||
if (node.volumes){
|
||||
var bitlocker = [];
|
||||
for (var i in node.volumes) {
|
||||
if (typeof node.volumes[i].protectionStatus !== 'undefined' && node.volumes[i].protectionStatus == 'On'){
|
||||
bitlocker.push(i + ' - <span style=color:green>' + node.volumes[i].volumeStatus + '</span>');
|
||||
}else if (typeof node.volumes[i].protectionStatus !== 'undefined'){
|
||||
bitlocker.push(i + ' - <span style=color:red>' + node.volumes[i].volumeStatus + '</span>');
|
||||
}
|
||||
}
|
||||
if(bitlocker.length > 0){
|
||||
x += addDeviceAttribute("BitLocker", bitlocker.join(', '));
|
||||
}
|
||||
}
|
||||
|
||||
// Active Users
|
||||
if (node.users && node.conn && (node.users.length > 0) && (node.conn & 1)) { x += addDeviceAttribute(((node.users.length > 1)?"Active Users":"Active User"), EscapeHtml(node.users.join(', '))); }
|
||||
|
||||
|
|
Loading…
Reference in New Issue