From 5046161a5d0eba05bb7d6d857cb5bcef01b7de34 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 7 Dec 2020 22:55:29 -0800 Subject: [PATCH] Improved macOS strings and agent update. --- meshagent.js | 12 +++++++++++- translate/translate.json | 29 ++++++++++++++++++++--------- views/default.handlebars | 2 +- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/meshagent.js b/meshagent.js index d288ef21..560caeee 100644 --- a/meshagent.js +++ b/meshagent.js @@ -234,7 +234,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { else if (cmdid == 12) { // MeshCommand_AgentHash if ((msg.length == 52) && (obj.agentExeInfo != null) && (obj.agentExeInfo.update == true)) { const agenthash = msg.substring(4); - if ((agenthash != obj.agentExeInfo.hash) && (agenthash != '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0')) { + if (compareAgentBinaryHash(obj.agentExeInfo, agenthash)) { // Mesh agent update required, do it using task limiter so not to flood the network. Medium priority task. parent.parent.taskLimiter.launch(function (argument, taskid, taskLimiterQueue) { if (obj.authenticated != 2) { parent.parent.taskLimiter.completed(taskid); return; } // If agent disconnection, complete and exit now. @@ -1655,6 +1655,16 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { }); } + // Check if we need to update this agent, return true if agent binary update required. + function compareAgentBinaryHash(agentExeInfo, agentHash) { + // If the hash matches or is null, no update required. + if ((agentExeInfo.hash == agentHash) || (agentHash == '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0')) return false; + // If this is a macOS x86 or ARM agent type and it matched the universal binary, no update required. + if (((agentExeInfo.id == 16) || (agentExeInfo.id == 29)) && (parent.parent.meshAgentBinaries[10005].hash == agentHash)) return false; + // No match, update the agent. + return true; + } + // Request that the core dump file on this agent be uploaded to the server obj.RequestCoreDump = function (agenthashhex, corehashhex) { if (agenthashhex.length > 16) { agenthashhex = agenthashhex.substring(0, 16); } diff --git a/translate/translate.json b/translate/translate.json index bd49e297..7a4c48ac 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -4865,6 +4865,12 @@ "default.handlebars->29->327" ] }, + { + "en": "Apple Silicon", + "xloc": [ + "default.handlebars->29->42" + ] + }, { "cs": "Apple macOS", "de": "Apple macOS", @@ -37619,7 +37625,6 @@ "default.handlebars->29->2036", "default.handlebars->29->2051", "default.handlebars->29->2052", - "default.handlebars->29->42", "default.handlebars->29->435", "default.handlebars->29->989", "default.handlebars->29->996" @@ -41998,10 +42003,7 @@ "ru": "macOS 32bit", "tr": "macOS 32bit", "zh-chs": "macOS 32位", - "zh-cht": "macOS 32位", - "xloc": [ - "default.handlebars->29->24" - ] + "zh-cht": "macOS 32位" }, { "cs": "macOS 64bit", @@ -42018,10 +42020,7 @@ "ru": "macOS 64bit", "tr": "macOS 64bit", "zh-chs": "macOS 64位", - "zh-cht": "macOS 64位", - "xloc": [ - "default.handlebars->29->29" - ] + "zh-cht": "macOS 64位" }, { "en": "macOS ARM (64bit)", @@ -42035,6 +42034,18 @@ "default.handlebars->29->814" ] }, + { + "en": "macOS x86-32bit", + "xloc": [ + "default.handlebars->29->24" + ] + }, + { + "en": "macOS x86-64bit", + "xloc": [ + "default.handlebars->29->29" + ] + }, { "cs": "MeshAgenta", "de": "Mesh-Agent", diff --git a/views/default.handlebars b/views/default.handlebars index 497bcdfe..35f1870e 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1262,7 +1262,7 @@ var autoReconnect = true; var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"]; var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"]; - var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android ARM", "Linux ARM", "macOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "macOS 64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "MIPS24KC (OpenWRT)", "Unknown", "FreeBSD x86-64"]; + var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android ARM", "Linux ARM", "macOS x86-32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "macOS x86-64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "MIPS24KC (OpenWRT)", "Apple Silicon", "FreeBSD x86-64"]; var sort = 0; var searchFocus = 0; var mapSearchFocus = 0;