More work on Intel AMT Click Once Recovery.

This commit is contained in:
Ylian Saint-Hilaire 2021-03-22 19:00:50 -07:00
parent a3f85bd042
commit 1c47f13090
2 changed files with 28 additions and 3 deletions

View File

@ -5492,8 +5492,30 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
break;
}
case 'clickoncerecovery': {
console.log(command); // TODO
case 'clickoncerecovery': { // Intel(R) AMT Click once recovery
if (common.validateStrArray(command.nodeids, 1) == false) break; // Check nodeids
if (common.validateString(command.path, 1, 2048) == false) break; // Check file path
if (command.type != 'diskimage') break; // Make sure type is correct
var file = parent.getServerFilePath(user, domain, command.path);
if (file == null) return;
// For each nodeid, change the group
for (var i = 0; i < command.nodeids.length; i++) {
var xnodeid = command.nodeids[i];
if (xnodeid.indexOf('/') == -1) { xnodeid = 'node/' + domain.id + '/' + xnodeid; }
// Get the node and the rights for this node
parent.GetNodeWithRights(domain, user, xnodeid, function (node, rights, visible) {
// Check if we found this device and if we have full rights
if ((node == null) || (rights != 0xFFFFFFFF)) return;
// Perform Intel AMT Click Once Recovery
console.log('ClickOnceRecovery', node._id, file.fullpath);
});
}
//console.log(command, file);
break;
}
default: {

View File

@ -3438,7 +3438,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if ((node == null) || (rights != 0xFFFFFFFF) || (visible == false)) { res.sendStatus(404); return; } // We don't have remote control rights to this device
for (var i in files.files) {
var file = files.files[i];
console.log('ClickOnceRecovery', file); // TODO
// Perform Intel AMT Click Once Recovery
console.log('ClickOnceRecovery', node._id, file.path);
try { obj.fs.unlinkSync(file.path); } catch (e) { }
}
res.send('');