From 7036b37b27519ecec8848889bb393340f86a8ece Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 26 Oct 2020 01:22:46 -0700 Subject: [PATCH] Added .PDB downloading. --- webserver.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/webserver.js b/webserver.js index 3403a875..1e4a48ba 100644 --- a/webserver.js +++ b/webserver.js @@ -4026,6 +4026,13 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Send a specific mesh agent back var argentInfo = obj.parent.meshAgentBinaries[req.query.id]; if (argentInfo == null) { res.sendStatus(404); return; } + + // Download PDB debug files, only allowed for administrator or accounts with agent dump access + if ((req.query.pdb == 1) && ((user.siteadmin == 0xFFFFFFFF) || ((Array.isArray(obj.parent.config.settings.agentcoredumpusers)) && (obj.parent.config.settings.agentcoredumpusers.indexOf(user._id) >= 0)))) { + if (argentInfo.id == 3) { setContentDispositionHeader(res, 'application/octet-stream', 'MeshService.pdb', null, 'MeshService.pdb'); res.sendFile(argentInfo.path.split('MeshService-signed.exe').join('MeshService.pdb')); return; } + if (argentInfo.id == 4) { setContentDispositionHeader(res, 'application/octet-stream', 'MeshService64.pdb', null, 'MeshService64.pdb'); res.sendFile(argentInfo.path.split('MeshService64-signed.exe').join('MeshService64.pdb')); return; } + } + if ((req.query.meshid == null) || (argentInfo.platform != 'win32')) { setContentDispositionHeader(res, 'application/octet-stream', argentInfo.rname, null, 'meshagent'); if (argentInfo.data == null) { res.sendFile(argentInfo.path); } else { res.end(argentInfo.data); } @@ -4269,7 +4276,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if (agentid >= 10000) continue; var agentinfo = obj.parent.meshAgentBinaries[agentid]; response += '' + agentinfo.id + '' + agentinfo.desc.split(' ').join(' ') + ''; - response += '' + agentinfo.rname + ''; + response += '' + agentinfo.rname + ''; + if ((user.siteadmin == 0xFFFFFFFF) || ((Array.isArray(obj.parent.config.settings.agentcoredumpusers)) && (obj.parent.config.settings.agentcoredumpusers.indexOf(user._id) >= 0))) { + if ((agentid == 3) || (agentid == 4)) { response += ', PDB'; } + } + response += ''; response += '' + agentinfo.size + '' + agentinfo.hashhex + ''; response += '' + agentinfo.rname.replace('agent', 'cmd') + ''; }