From 6c593da7ffad7f503671db4f5e91d26534620470 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 1 May 2018 13:44:26 -0700 Subject: [PATCH] Fixed Intel AMT activation information and UI --- amtscanner.js | 6 +++--- meshagent.js | 10 +++++----- package.json | 2 +- views/default.handlebars | 41 +++++++++++++++++++++++++++------------- 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/amtscanner.js b/amtscanner.js index 86719119..2eff333e 100644 --- a/amtscanner.js +++ b/amtscanner.js @@ -206,7 +206,7 @@ module.exports.CreateAmtScanner = function (parent) { obj.changeConnectState = function (tag, minorVersion, majorVersion, provisioningState, openPort, dualPorts, rinfo, user) { //var provisioningStates = { 0: 'Pre', 1: 'in', 2: 'Post' }; //var provisioningStateStr = provisioningStates[provisioningState]; - //console.log('Intel AMT ' + majorVersion + '.' + minorVersion + ', ' + provisioningStateStr + '-Provisioning at ' + rinfo.address + ', Open Ports: [' + openPorts.join(', ') + '], tag: ' + tag); + //console.log('Intel AMT ' + majorVersion + '.' + minorVersion + ', ' + provisioningStateStr + '-Provisioning at ' + rinfo.address + ', Open Ports: [' + openPort + '], tag: ' + tag); var scaninfo = obj.scanTableTags[tag]; if (scaninfo != undefined) { scaninfo.lastpong = Date.now(); @@ -255,8 +255,8 @@ module.exports.CreateAmtScanner = function (parent) { var change = false; if (node.intelamt == undefined) { node.intelamt = {}; } if (node.intelamt.tls != tls) { node.intelamt.tls = tls; change = true; changes.push(tls==1?'TLS':'NoTLS'); } - if (obj.compareAmtVersionStr(node.intelamt.ver, version)) { node.intelamt.ver = version; change = true; changes.push('Version ' + version); } - if (node.intelamt.state != provisioningState) { node.intelamt.state = provisioningState; change = true; changes.push('State'); } + if (obj.compareAmtVersionStr(node.intelamt.ver, version)) { node.intelamt.ver = version; change = true; changes.push('AMT Version ' + version); } + if (node.intelamt.state != provisioningState) { node.intelamt.state = provisioningState; change = true; changes.push('AMT State'); } if (change == true) { // Make the change in the database obj.parent.db.Set(node); diff --git a/meshagent.js b/meshagent.js index 6d60182f..841e4565 100644 --- a/meshagent.js +++ b/meshagent.js @@ -574,11 +574,11 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { if ((device.agent.caps & 0xFFFFFFE7) != (command.caps & 0xFFFFFFE7)) { device.agent.caps = ((device.agent.caps & 24) + (command.caps & 0xFFFFFFE7)); change = 1; changes.push('agent capabilities'); } // Allow Javascript on the agent to change all capabilities except console and javascript support if (command.intelamt) { if (!device.intelamt) { device.intelamt = {}; } - if (device.intelamt.ver != command.intelamt.ver) { device.intelamt.ver = command.intelamt.ver; change = 1; changes.push('AMT version'); } - if (device.intelamt.state != command.intelamt.state) { device.intelamt.state = command.intelamt.state; change = 1; changes.push('AMT state'); } - if (device.intelamt.flags != command.intelamt.flags) { device.intelamt.flags = command.intelamt.flags; change = 1; changes.push('AMT flags'); } - if (device.intelamt.host != command.intelamt.host) { device.intelamt.host = command.intelamt.host; change = 1; changes.push('AMT host'); } - if (device.intelamt.uuid != command.intelamt.uuid) { device.intelamt.uuid = command.intelamt.uuid; change = 1; changes.push('AMT uuid'); } + if ((command.intelamt.ver != null) && (device.intelamt.ver != command.intelamt.ver)) { device.intelamt.ver = command.intelamt.ver; change = 1; changes.push('AMT version'); } + if ((command.intelamt.state != null) && (device.intelamt.state != command.intelamt.state)) { device.intelamt.state = command.intelamt.state; change = 1; changes.push('AMT state'); } + if ((command.intelamt.flags != null) && (device.intelamt.flags != command.intelamt.flags)) { device.intelamt.flags = command.intelamt.flags; change = 1; changes.push('AMT flags'); } + if ((command.intelamt.host != null) && (device.intelamt.host != command.intelamt.host)) { device.intelamt.host = command.intelamt.host; change = 1; changes.push('AMT host'); } + if ((command.intelamt.uuid != null) && (device.intelamt.uuid != command.intelamt.uuid)) { device.intelamt.uuid = command.intelamt.uuid; change = 1; changes.push('AMT uuid'); } } if (mesh.mtype == 2) { if (device.host != obj.remoteaddr) { device.host = obj.remoteaddr; change = 1; changes.push('host'); } diff --git a/package.json b/package.json index f5b27324..283bb4d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.1.7-b", + "version": "0.1.7-c", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default.handlebars b/views/default.handlebars index accf94cd..5835921f 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2109,11 +2109,23 @@ function powerSort(a, b) { var ap = a.pwr?a.pwr:0; var bp = b.pwr?b.pwr:0; if (ap == bp) { if (showHostnames == true) { if (a.hostl > b.hostl) return 1; if (a.hostl < b.hostl) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } if (ap > bp) return 1; if (ap < bp) return -1; return 0; } function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } function deviceHostSort(a, b) { if (a.hostl > b.hostl) return 1; if (a.hostl < b.hostl) return -1; return 0; } - function onSearchInputChanged() { var x = Q('SearchInput').value.toLowerCase(); putstore("search", x); if (x == '') { for (var d in nodes) { nodes[d].v = true; } } else { for (var d in nodes) { nodes[d].v = (nodes[d].name.toLowerCase().indexOf(x) >= 0) || (nodes[d].hostl != null && nodes[d].hostl.toLowerCase().indexOf(x) >= 0); } } updateDevices(); } function onSearchFocus(x) { searchFocus = x; } function onMapSearchFocus(x) { mapSearchFocus = x; } function onConsoleFocus(x) { consoleFocus = x; } + function onSearchInputChanged() { + var x = Q('SearchInput').value.toLowerCase(); + putstore("search", x); + if (x == '') { for (var d in nodes) { nodes[d].v = true; } } + else { + for (var d in nodes) { + nodes[d].v = (nodes[d].name.toLowerCase().indexOf(x) >= 0) || (nodes[d].hostl != null && nodes[d].hostl.toLowerCase().indexOf(x) >= 0); + if (nodes[d].tags) { for (var s in nodes[d].tags) { if (nodes[d].tags[s].toLowerCase().indexOf(x) >= 0) { nodes[d].v = true; break; } } } + } + } + updateDevices(); + } + var contextelement = null; function handleContextMenu(event) { hideContextMenu(); @@ -2847,22 +2859,25 @@ if (node.intelamt != null) { var str = ''; var provisioningStates = { 0: 'Not Activated (Pre)', 1: 'Not Activated (In)', 2: 'Activated' }; + if (node.intelamt.ver != null && node.intelamt.state == null) { str += 'Unknown State, v' + node.intelamt.ver; } else if (node.intelamt.ver == null || node.intelamt.state == null) { str += 'Unknown Version & State'; } else { str += provisioningStates[node.intelamt.state]; if (node.intelamt.flags) { if (node.intelamt.flags & 2) { str += ' CCM'; } else if (node.intelamt.flags & 4) { str += ' ACM'; } } str += (', v' + node.intelamt.ver); } if (node.intelamt.tls == 1) { str += ', TLS'; } - if (node.intelamt.user == null || node.intelamt.user == '') { - if ((meshrights & 4) != 0) { - str += ', No Credentials'; - } else { - str += ', No Credentials'; + if (node.intelamt.state == 2) { + if (node.intelamt.user == null || node.intelamt.user == '') { + if ((meshrights & 4) != 0) { + str += ', No Credentials'; + } else { + str += ', No Credentials'; + } + } + str += ' '; + if ((meshrights & 4) != 0) { + str += ''; } - } - str += ' '; - if ((meshrights & 4) != 0) { - str += ''; } x += addDeviceAttribute('Intel® AMT', str); } @@ -2948,7 +2963,7 @@ QV('MainDevDesktop', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0)) && (meshrights & 8)); QV('MainDevTerminal', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 2) != 0)) && (meshrights & 8)); QV('MainDevFiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8)); - QV('MainDevAmt', (node.intelamt != null) && (meshrights & 8)); + QV('MainDevAmt', (node.intelamt != null) && (node.intelamt.state == 2) && (meshrights & 8)); QV('MainDevConsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8)); QV('p15uploadCore', (node.agent != null) && (node.agent.caps != null) && ((node.agent.caps & 16) != 0) && (userinfo.siteadmin == 0xFFFFFFFF)); QH('p15coreName', ((node.agent != null) && (node.agent.core != null))?node.agent.core:''); @@ -3349,7 +3364,7 @@ // Show the right buttons QV('disconnectbutton1span', (deskState != 0)); QV('connectbutton1span', (deskState == 0) && (mesh.mtype == 2)); - QV('connectbutton1hspan', (deskState == 0) && (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1)))); + QV('connectbutton1hspan', (deskState == 0) && ((currentNode.intelamt != null) && (currentNode.intelamt.state == 2) && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1)))); // Show the right settings QV('d7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))) && ((deskState == 0) || (desktop.contype == 2))); @@ -3676,7 +3691,7 @@ // Show the right buttons QV('disconnectbutton2span', (termState == true)); QV('connectbutton2span', (termState == false) && (mesh.mtype == 2)); - QV('connectbutton2hspan', (termState == false) && (terminalNode.intelamt != null && ((terminalNode.intelamt.ver != null) || (mesh.mtype == 1)))); + QV('connectbutton2hspan', (termState == false) && ((terminalNode.intelamt != null) && (terminalNode.intelamt.state == 2) && ((terminalNode.intelamt.ver != null) || (mesh.mtype == 1)))); // Enable buttons var online = ((terminalNode.conn & 1) != 0); // If Agent (1) connected, enable Terminal