From 4fb8e4713dc8988d249dae5d76aa6911329932c6 Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Sun, 1 Oct 2023 19:50:27 +0000 Subject: [PATCH] add volumes to database Signed-off-by: Simon Smith --- agents/meshcore.js | 15 +++++++++++++++ meshagent.js | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/agents/meshcore.js b/agents/meshcore.js index 9c282281..07370b88 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -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 { diff --git a/meshagent.js b/meshagent.js index 88c0b01f..bd8e29f8 100644 --- a/meshagent.js +++ b/meshagent.js @@ -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.