BitLocker fixes, added drive volumes to details tab.
This commit is contained in:
parent
4637e6b3b3
commit
e5e86fee19
|
@ -656,14 +656,14 @@ try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; meshCoreO
|
|||
|
||||
// Get Volumes and BitLocker if Windows
|
||||
try {
|
||||
if (process.platform == 'win32'){
|
||||
if (require('computer-identifiers').volumes_promise != null){
|
||||
if (process.platform == 'win32') {
|
||||
if (require('computer-identifiers').volumes_promise != null) {
|
||||
var p = require('computer-identifiers').volumes_promise();
|
||||
p.then(function (res){
|
||||
p.then(function (res) {
|
||||
meshCoreObj.volumes = res;
|
||||
meshCoreObjChanged();
|
||||
});
|
||||
}else if (require('computer-identifiers').volumes != null){
|
||||
} else if (require('computer-identifiers').volumes != null) {
|
||||
meshCoreObj.volumes = require('computer-identifiers').volumes();
|
||||
meshCoreObjChanged();
|
||||
}
|
||||
|
|
16
meshagent.js
16
meshagent.js
|
@ -1941,9 +1941,19 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||
}
|
||||
|
||||
// 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 (command.volumes != null) {
|
||||
for (var i in command.volumes) {
|
||||
// Fix the incoming data and cut down how much data we use
|
||||
const v = command.volumes[i];
|
||||
if (typeof v.size == 'string') { v.size = parseInt(v.size); }
|
||||
if (v.recoveryPassword == '') { delete v.recoveryPassword; }
|
||||
if (v.identifier == '') { delete v.identifier; }
|
||||
if (v.name == '') { delete v.name; }
|
||||
if (v.removable != true) { delete v.removable; }
|
||||
if (v.protectionStatus == 'On') { v.protectionStatus = true; } else { delete v.protectionStatus; }
|
||||
if (v.volumeStatus == "FullyDecrypted") { delete v.volumeStatus; }
|
||||
}
|
||||
if (JSON.stringify(device.volumes) != JSON.stringify(command.volumes)) { device.volumes = command.volumes; change = 1; }
|
||||
}
|
||||
|
||||
// If there are changes, event the new device
|
||||
|
|
|
@ -4785,8 +4785,6 @@
|
|||
if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { var ip = ''; if (node.mtype == 3) { ip = node.host; } else if (node.ip) { ip = node.ip; } r += '<td style=text-align:center>' + ip; } // IP address
|
||||
if (deviceViewSettings.devsCols.indexOf('conn') >= 0) { r += '<td style=text-align:center>' + states.join(' + '); } // Connectivity
|
||||
if (deviceViewSettings.devsCols.indexOf('lastseen') >= 0) { r += '<td style=text-align:center;font-size:x-small>'; if (node.conn > 0) { r += "Connected"; } else if (node.lastconnect != null) { r += printDateTime(new Date(node.lastconnect)); } }
|
||||
|
||||
console.log(node.intelamt);
|
||||
if (deviceViewSettings.devsCols.indexOf('amthost') >= 0) { r += '<td style=text-align:center>' + (((node.intelamt == null) || (node.intelamt.host == null)) ? '' : EscapeHtml(node.intelamt.host)); }
|
||||
if (deviceViewSettings.devsCols.indexOf('amtstate') >= 0) {
|
||||
var amtstate = '';
|
||||
|
@ -7453,20 +7451,20 @@
|
|||
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('<div style=margin-bottom:2px>' + addKeyLinkConditional(i + ' - <span style=color:green>' + node.volumes[i].volumeStatus + '</span>',"p10showBitlockerKey('"+i+"')", (userinfo.siteadmin == 0xFFFFFFFF)) + '</div>');
|
||||
}else if (typeof node.volumes[i].protectionStatus !== 'undefined'){
|
||||
bitlocker.push('<div style=margin-bottom:2px>' + i + ' - <span style=color:red>' + node.volumes[i].volumeStatus + '</span>' + '</div>');
|
||||
bitlocker.push('<div style=margin-bottom:2px>' + addKeyLinkConditional(i + ' - <span style=color:green>' + EscapeHtml(node.volumes[i].volumeStatus) + '</span>', 'p10showBitlockerKey(\'' + i + '\')', (userinfo.siteadmin == 0xFFFFFFFF)) + '</div>');
|
||||
} else if (typeof node.volumes[i].protectionStatus !== 'undefined') {
|
||||
bitlocker.push('<div style=margin-bottom:2px>' + i + ' - <span style=color:red>' + EscapeHtml(node.volumes[i].volumeStatus) + '</span>' + '</div>');
|
||||
}
|
||||
}
|
||||
if(bitlocker.length > 0){
|
||||
x += addDeviceAttribute("BitLocker", bitlocker.join(' '));
|
||||
}
|
||||
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(', '))); }
|
||||
|
@ -7922,14 +7920,9 @@
|
|||
|
||||
function p10showBitlockerKey(drive) {
|
||||
if (xxdialogMode) return false;
|
||||
var x = '<div>';
|
||||
x += '<p>BitLocker Identifier For <b>' + drive + ':</b></p>';
|
||||
x += '<p style=user-select:text;font-weight:bold>' + (currentNode.volumes[drive].identifier ? currentNode.volumes[drive].identifier : 'Unknown') + '</p>';
|
||||
|
||||
x += '<p>BitLocker Recovery Password For <b>' + drive + ':</b></p>';
|
||||
x += '<p style=user-select:text;font-weight:bold>' + (currentNode.volumes[drive].recoveryPassword ? currentNode.volumes[drive].recoveryPassword : 'Unknown') + '</p>';
|
||||
x += '</div>'
|
||||
setDialogMode(2, "BitLocker Information", 1, null, x, '');
|
||||
var x = '<div><p>' + "Identifier" + '</p><p style=user-select:text;font-weight:bold>' + EscapeHtml(currentNode.volumes[drive].identifier ? currentNode.volumes[drive].identifier : "Unknown") + '</p>';
|
||||
x += '<p>' + "Recovery Password" + '</p><p style=user-select:text;font-weight:bold>' + EscapeHtml(currentNode.volumes[drive].recoveryPassword ? currentNode.volumes[drive].recoveryPassword : "Unknown") + '</p></div>';
|
||||
setDialogMode(2, EscapeHtml(drive) + ': ' + "BitLocker Information", 1, null, x, '');
|
||||
}
|
||||
|
||||
function p20editDeviceNotify() {
|
||||
|
@ -11062,15 +11055,15 @@
|
|||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
const i = parseInt(Math.floor(Math.log(Math.abs(f.s)) / Math.log(1024)), 10);
|
||||
const option = Q('p13sizedropdown').options[Q('p13sizedropdown').selectedIndex];
|
||||
if(Q('p13sizedropdown').value==0){
|
||||
if (Q('p13sizedropdown').value == 0) {
|
||||
if (f.s === 0){
|
||||
fsize = 'n/a';
|
||||
}else{
|
||||
} else {
|
||||
fsize = (i === 0 ? `${f.s} ${sizes[i]}` : `${(f.s / (1024 ** i)).toFixed(2)} ${sizes[i]}`);
|
||||
}
|
||||
}else if(Q('p13sizedropdown').value==1){
|
||||
} else if (Q('p13sizedropdown').value==1) {
|
||||
fsize = getFileSizeStr(f.s);
|
||||
}else{
|
||||
} else {
|
||||
fsize = `${(f.s / (2 ** option.value)).toFixed(2)} ${option.title}`;
|
||||
}
|
||||
}
|
||||
|
@ -12129,6 +12122,31 @@
|
|||
if (x != '') { sections.push({ name: "Storage", html: x, img: 'storage64.png'}); }
|
||||
}
|
||||
|
||||
// Volumes and Bitlocker
|
||||
if (node.volumes) {
|
||||
var x = '';
|
||||
for (var i in node.volumes) {
|
||||
var m = node.volumes[i];
|
||||
x += '<tr><td><div class=style10 style=border-radius:5px;padding:8px>';
|
||||
x += '<div style=margin-bottom:3px><b>' + i + ':' + (((m.name == null) || (m.name == '')) ? '' : (' - ' + EscapeHtml(m.name))) + '</b></div>';
|
||||
if (m.size) {
|
||||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
var i = parseInt(Math.floor(Math.log(Math.abs(m.size)) / Math.log(1024)), 10);
|
||||
var fsize = (i === 0 ? `${m.size} ${sizes[i]}` : `${(m.size / (1024 ** i)).toFixed(2)} ${sizes[i]}`);
|
||||
x += addDetailItem("Capacity", EscapeHtml(fsize), s);
|
||||
}
|
||||
if (m.type) { x += addDetailItem("File System", (m.removable == true ? ("Removable" + ' / ') : '') + EscapeHtml(m.type), s); }
|
||||
if (m.protectionStatus || m.volumeStatus) {
|
||||
var bitlockerState = [];
|
||||
if (m.protectionStatus) bitlockerState.push("Enabled");
|
||||
if (m.volumeStatus) bitlockerState.push(EscapeHtml(m.volumeStatus));
|
||||
x += addDetailItem("BitLocker", bitlockerState.join(' - '), s);
|
||||
}
|
||||
x += '</div>';
|
||||
}
|
||||
if (x != '') { sections.push({ name: "Storage Volumes", html: '<table style=width:100%>' + x + '</table>', img: 'storage64.png'}); }
|
||||
}
|
||||
|
||||
// Render the sections
|
||||
var x = '';
|
||||
for (var i in sections) {
|
||||
|
|
Loading…
Reference in New Issue