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

Added MeshCentral Assistant download from agent.

This commit is contained in:
Ylian Saint-Hilaire 2021-04-27 00:53:04 -07:00
parent 7e1b1a68d4
commit b4a42b03d5
2 changed files with 55 additions and 2 deletions

View file

@ -1479,13 +1479,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
break;
}
case 'meshToolInfo': {
// Return information about a MeshCentral tool. Current tools are 'MeshCentralRouter' and 'MeshCentralAssistant'
// Information includes file hash and download location URL
if (typeof command.name != 'string') break;
var info = parent.parent.meshToolsBinaries[command.name];
if ((command.hash != null) && (info.hash == command.hash)) return;
const responseCmd = { action: 'meshToolInfo', name: command.name, hash: info.hash, size: info.size, url: info.url };
const responseCmd = { action: 'meshToolInfo', name: command.name, tag: command.tag, sessionid: command.sessionid, hash: info.hash, size: info.size, url: info.url };
if (command.cookie === true) { responseCmd.url += ('&auth=' + parent.parent.encodeCookie({ download: info.dlname }, parent.parent.loginCookieEncryptionKey)); }
if (command.pipe === true) { responseCmd.pipe = true; }
if (parent.webCertificateHashs[domain.id] != null) { responseCmd.serverhash = Buffer.from(parent.webCertificateHashs[domain.id], 'binary').toString('hex'); }
if (parent.webCertificateHashs[domain.id] != null) { responseCmd.serverhash = Buffer.from(parent.webCertificateHashs[domain.id],'binary').toString('hex'); }
try { ws.send(JSON.stringify(responseCmd)); } catch (ex) { }
break;
}