From 128919b851b67f4601419768f2de3187eabaa687 Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Tue, 3 Oct 2023 20:11:35 +0000 Subject: [PATCH] add bitlocker to csv Signed-off-by: Simon Smith --- meshuser.js | 9 ++++++++- views/default.handlebars | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/meshuser.js b/meshuser.js index d81ca46f..f240d967 100644 --- a/meshuser.js +++ b/meshuser.js @@ -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 diff --git a/views/default.handlebars b/views/default.handlebars index ecb1af25..2a313469 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -5744,13 +5744,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 {