From 2d2c5b5ec0535a3a903a5af63de9d3e25585db51 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 20 Apr 2020 03:22:33 -0700 Subject: [PATCH] Fixed Intel AMT network scanning to use DNS name. --- amtscanner.js | 6 +++--- views/default.handlebars | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/amtscanner.js b/amtscanner.js index 0da5f5f7..1f414280 100644 --- a/amtscanner.js +++ b/amtscanner.js @@ -296,9 +296,9 @@ module.exports.CreateAmtScanner = function (parent) { //var provisioningStates = { 0: 'Pre', 1: 'in', 2: 'Post' }; //var provisioningStateStr = provisioningStates[provisioningState]; //console.log(rinfo.address + ': Intel AMT ' + majorVersion + '.' + minorVersion + ', ' + provisioningStateStr + '-Provisioning, Open Ports: [' + openPorts.join(', ') + ']'); - obj.dns.reverse(rinfo.address, function (err, hostname) { - if ((err != undefined) && (hostname != undefined)) { - user.results[rinfo.address] = { ver: majorVersion + '.' + minorVersion, tls: (((openPort == 16993) || (dualPorts == true)) ? 1 : 0), state: provisioningState, hostname: hostname[0] }; + obj.dns.reverse(rinfo.address, function (err, hostnames) { + if ((err == null) && (hostnames != null) && (hostnames.length > 0)) { + user.results[rinfo.address] = { ver: majorVersion + '.' + minorVersion, tls: (((openPort == 16993) || (dualPorts == true)) ? 1 : 0), state: provisioningState, hostname: hostnames[0] }; } else { user.results[rinfo.address] = { ver: majorVersion + '.' + minorVersion, tls: (((openPort == 16993) || (dualPorts == true)) ? 1 : 0), state: provisioningState, hostname: rinfo.address }; } diff --git a/views/default.handlebars b/views/default.handlebars index 0b0cb46f..6536ad1b 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -3535,7 +3535,7 @@ if (elements[i].checked) { var ipaddr = elements[i].getAttribute('tag'); var amtinfo = amtScanResults[ipaddr]; - meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: ipaddr, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls }); + meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: amtinfo.hostname, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls }); } } }