Skip to content

Commit

Permalink
add bitlocker recoverykey to sysinfo (#5671)
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 committed Jan 8, 2024
1 parent e967f00 commit 36741c7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions agents/modules_meshcore/computer-identifiers.js
Expand Up @@ -430,6 +430,26 @@ function windows_volumes()
{
ret[key].volumeStatus = tokens[1].split('"')[1];
ret[key].protectionStatus = tokens[2].split('"')[1];
try {
var str = '';
var foundMarkedLine = false;
var password = '';
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['/c', 'manage-bde -protectors -get ', tokens[0].split('"')[1], ' -Type recoverypassword'], {});
child.stdout.on('data', function (chunk) { str += chunk.toString(); });
child.stderr.on('data', function (chunk) { str += chunk.toString(); });
child.waitExit();
var lines = str.split(/\r?\n/);
for (var i = 0; i < lines.length; i++) {
if (lines[i].trim() !== '' && lines[i].includes('Password:') && !lines[i].includes('Numerical Password:')) {
if (i + 1 < lines.length && lines[i + 1].trim() !== '') {
password = lines[i + 1].trim();
foundMarkedLine = true;
}
if (foundMarkedLine) break;
}
}
ret[key].recoveryPassword = (foundMarkedLine ? password : '');
} catch(ex) { }
}
}
this.promise._res(ret);
Expand Down

0 comments on commit 36741c7

Please sign in to comment.