From fae11011235d226ef9e39c89f38370848f8d15f8 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 17 Aug 2021 15:32:58 -0700 Subject: [PATCH] Added MeshAgent ZIP links when compressed version is available. --- meshcentral.js | 1 - package.json | 15 ++++++++++++++- webserver.js | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/meshcentral.js b/meshcentral.js index d66eb2dc..843c7525 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -27,7 +27,6 @@ function CreateMeshCentralServer(config, args) { obj.mpsserver = null; obj.mqttbroker = null; obj.swarmserver = null; - obj.mailserver = null; obj.smsserver = null; obj.amtEventHandler = null; obj.pluginHandler = null; diff --git a/package.json b/package.json index 29f98d41..6dd77caf 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ "sample-config-advanced.json" ], "dependencies": { + "archiver": "^4.0.2", + "archiver-zip-encrypted": "^1.0.10", "body-parser": "^1.19.0", "cbor": "~5.2.0", "compression": "^1.7.4", @@ -43,14 +45,25 @@ "express": "^4.17.0", "express-handlebars": "^3.1.0", "express-ws": "^4.0.0", + "image-size": "^1.0.0", "ipcheck": "^0.1.0", + "loadavg-windows": "^1.1.1", "minimist": "^1.2.0", + "mongodb": "^4.1.0", "multiparty": "^4.2.1", "nedb": "^1.8.0", "node-forge": "^0.10.0", + "node-rdpjs-2": "^0.3.5", + "node-windows": "^1.0.0-beta.5", + "nodemailer": "^6.6.3", + "otplib": "^10.2.3", + "saslprep": "^1.0.3", + "ssh2": "^1.2.0", + "web-push": "^3.4.5", "ws": "^5.2.3", "xmldom": "^0.5.0", - "yauzl": "^2.10.0" + "yauzl": "^2.10.0", + "yubikeyotp": "^0.2.0" }, "repository": { "type": "git", diff --git a/webserver.js b/webserver.js index 806d7918..57197129 100644 --- a/webserver.js +++ b/webserver.js @@ -4669,6 +4669,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Get the agent filename var meshagentFilename = argentInfo.rname; if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.filename == 'string')) { meshagentFilename = domain.agentcustomization.filename; } + if (req.query.zip == 1) { if (argentInfo.zdata != null) { setContentDispositionHeader(res, 'application/octet-stream', meshagentFilename + '.zip', null, 'meshagent.zip'); res.send(argentInfo.zdata); } else { try { res.sendStatus(404); } catch (ex) { } } return; } // Send compressed agent setContentDispositionHeader(res, 'application/octet-stream', meshagentFilename, null, 'meshagent'); if (argentInfo.data == null) { res.sendFile(argentInfo.path); } else { res.send(argentInfo.data); } return; @@ -5037,6 +5038,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { 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'; } } + if (agentinfo.zdata != null) { response += ', ZIP'; } response += ''; response += '' + agentinfo.size + '' + agentinfo.hashhex + ''; response += '' + agentinfo.rname.replace('agent', 'cmd') + '';