1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Added auto agent crash dump server upload option.

This commit is contained in:
Ylian Saint-Hilaire 2020-07-07 23:56:08 -07:00
parent 5e7bc1d210
commit 815fa1b0bb
3 changed files with 131 additions and 12 deletions

View file

@ -1375,6 +1375,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
//console.log('CoreDump for agent ' + obj.remoteaddrport);
obj.coreDumpPresent = true;
// TODO: We need to look at getting the dump uploaded to the server.
if (typeof command.agenthashhex == 'string') { obj.RequestCoreDump(command.agenthashhex); }
}
break;
}
@ -1555,6 +1556,13 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
});
}
// Request that the core dump file on this agent be uploaded to the server
obj.RequestCoreDump = function (agenthashhex) {
if (agenthashhex.length > 16) { agenthashhex = agenthashhex.substring(0, 16); }
const cookie = parent.parent.encodeCookie({ a: 'aft', b: 'coredump', c: obj.agentInfo.agentId + '-' + agenthashhex + '-' + obj.nodeid + '.dmp' }, parent.parent.loginCookieEncryptionKey);
obj.send('{"action":"msg","type":"tunnel","value":"*/' + (((domain.dns == null) && (domain.id != '')) ? (domain.id + '/') : '') + 'agenttransfer.ashx?c=' + cookie + '","rights":"4294967295"}');
}
// Generate a random Intel AMT password
function checkAmtPassword(p) { return (p.length > 7) && (/\d/.test(p)) && (/[a-z]/.test(p)) && (/[A-Z]/.test(p)) && (/\W/.test(p)); }
function getRandomAmtPassword() { var p; do { p = Buffer.from(parent.crypto.randomBytes(9), 'binary').toString('base64').split('/').join('@'); } while (checkAmtPassword(p) == false); return p; }