diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 8b7d296d..d9271f25 100644 Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index 22d6a6dc..c0c56744 100644 Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ diff --git a/agents/meshcmd.js b/agents/meshcmd.js index 518ecdb0..daae5007 100644 --- a/agents/meshcmd.js +++ b/agents/meshcmd.js @@ -438,13 +438,21 @@ function run(argv) { nextStepStorageUpload(); } } else if ((settings.action == 'amtversion') || (settings.action == 'amtversions') || (settings.action == 'amtver')) { - // Display Intel AMT versions + // Display Intel ME versions var amtMeiModule, amtMei; try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { console.log(ex); exit(1); return; } amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; }); amtMei.getVersion(function (val) { - console.log("MEI Version = " + val.BiosVersion.toString()); - for (var version in val.Versions) { console.log(val.Versions[version].Description + " = " + val.Versions[version].Version); } + console.log("BIOS Version = " + val.BiosVersion.toString()); + for (var version in val.Versions) { + var extras = '', skuBits = ['', 'iQST', 'ASF', 'AMT', 'ISM', 'TPM', '', '', 'HomeIT', '', 'WOX', '', '', 'AT-p', 'Corporate', 'L3 Mgt Upgrade']; + if (val.Versions[version].Description == 'Sku') { + var n = parseInt(val.Versions[version].Version), x = [], xx = 1; + for (var i = 0; i < skuBits.length; i++) { if ((n & xx) != 0) { x.push(skuBits[i]); } xx = xx << 1; } + if (x.length > 0) { extras = ' (' + x.join(', ') + ')' } + } + console.log(val.Versions[version].Description + " = " + val.Versions[version].Version + extras); + } exit(1); return; }); } else if (settings.action == 'amthashes') { @@ -472,7 +480,14 @@ function run(argv) { var amtMeiModule, amtMei; try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { console.log(ex); exit(1); return; } amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; }); - amtMei.getVersion(function (result) { if (result) { for (var version in result.Versions) { if (result.Versions[version].Description == 'AMT') { mestate.ver = result.Versions[version].Version; } } } }); + amtMei.getVersion(function (result) { + if (result) { + for (var version in result.Versions) { + if (result.Versions[version].Description == 'AMT') { mestate.ver = result.Versions[version].Version; } + if (result.Versions[version].Description == 'Sku') { mestate.sku = parseInt(result.Versions[version].Version); } + } + } + }); amtMei.getProvisioningState(function (result) { if (result) { mestate.ProvisioningState = result; } }); amtMei.getProvisioningMode(function (result) { if (result) { mestate.ProvisioningMode = result; } }); amtMei.getEHBCState(function (result) { if (result) { mestate.ehbc = result; } }); @@ -484,7 +499,9 @@ function run(argv) { amtMei.getDnsSuffix(function (result) { if (result) { mestate.dns = result; } if (mestate.ver && mestate.ProvisioningState && mestate.ProvisioningMode) { - var str = 'Intel AMT v' + mestate.ver; + var str = 'Intel ME v' + mestate.ver; + if (mestate.sku & 8) { str = 'Intel AMT v' + mestate.ver } + else if (mestate.sku & 16) { str = 'Intel SM v' + mestate.ver } if (mestate.ProvisioningState.stateStr == 'PRE') { str += ', pre-provisioning state'; } else if (mestate.ProvisioningState.stateStr == 'IN') { str += ', in-provisioning state'; } else if (mestate.ProvisioningState.stateStr == 'POST') { @@ -1138,6 +1155,7 @@ function activeToACMEx(fwNonce, dnsSuffix, digestRealm, uuid, allowedModes) { try { cmd = JSON.parse(data); } catch (ex) { console.log('Unable to parse server response: ' + data); exit(100); return; } if (typeof cmd != 'object') { console.log('Invalid server response: ' + cmd); exit(100); return; } if (typeof cmd.errorText == 'string') { console.log('Server error: ' + cmd.errorText); exit(100); return; } + if (typeof cmd.messageText == 'string') { console.log('Server: ' + cmd.messageText); return; } switch (cmd.action) { case 'acmactivate': { // Server responded with ACM activation response @@ -1204,7 +1222,7 @@ function activeToACMEx(fwNonce, dnsSuffix, digestRealm, uuid, allowedModes) { var action = 'acmactivate'; if (settings.action == 'amtccm') { action = 'ccmactivate'; } if (settings.action == 'amtdiscover') { action = 'amtdiscover'; } - socket.write({ client: 'meshcmd', version: 1, action: action, fqdn: dnsSuffix, realm: digestRealm, nonce: fwNonce, uuid: uuid, profile: settings.profile, hashes: trustedHashes, tag: settings.tag, name: settings.name, ver: mestate.vers['AMT'], build: mestate.vers['Build Number'], modes: allowedModes, currentMode: mestate.controlMode }); + socket.write({ client: 'meshcmd', version: 1, action: action, fqdn: dnsSuffix, realm: digestRealm, nonce: fwNonce, uuid: uuid, profile: settings.profile, hashes: trustedHashes, tag: settings.tag, name: settings.name, ver: mestate.vers['AMT'], build: mestate.vers['Build Number'], sku: parseInt(mestate.vers['Sku']), modes: allowedModes, currentMode: mestate.controlMode, hostname: require('os').hostname() }); }); connection.end(); } diff --git a/agents/meshcmd.min.js b/agents/meshcmd.min.js index 518ecdb0..daae5007 100644 --- a/agents/meshcmd.min.js +++ b/agents/meshcmd.min.js @@ -438,13 +438,21 @@ function run(argv) { nextStepStorageUpload(); } } else if ((settings.action == 'amtversion') || (settings.action == 'amtversions') || (settings.action == 'amtver')) { - // Display Intel AMT versions + // Display Intel ME versions var amtMeiModule, amtMei; try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { console.log(ex); exit(1); return; } amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; }); amtMei.getVersion(function (val) { - console.log("MEI Version = " + val.BiosVersion.toString()); - for (var version in val.Versions) { console.log(val.Versions[version].Description + " = " + val.Versions[version].Version); } + console.log("BIOS Version = " + val.BiosVersion.toString()); + for (var version in val.Versions) { + var extras = '', skuBits = ['', 'iQST', 'ASF', 'AMT', 'ISM', 'TPM', '', '', 'HomeIT', '', 'WOX', '', '', 'AT-p', 'Corporate', 'L3 Mgt Upgrade']; + if (val.Versions[version].Description == 'Sku') { + var n = parseInt(val.Versions[version].Version), x = [], xx = 1; + for (var i = 0; i < skuBits.length; i++) { if ((n & xx) != 0) { x.push(skuBits[i]); } xx = xx << 1; } + if (x.length > 0) { extras = ' (' + x.join(', ') + ')' } + } + console.log(val.Versions[version].Description + " = " + val.Versions[version].Version + extras); + } exit(1); return; }); } else if (settings.action == 'amthashes') { @@ -472,7 +480,14 @@ function run(argv) { var amtMeiModule, amtMei; try { amtMeiModule = require('amt-mei'); amtMei = new amtMeiModule(); } catch (ex) { console.log(ex); exit(1); return; } amtMei.on('error', function (e) { console.log('ERROR: ' + e); exit(1); return; }); - amtMei.getVersion(function (result) { if (result) { for (var version in result.Versions) { if (result.Versions[version].Description == 'AMT') { mestate.ver = result.Versions[version].Version; } } } }); + amtMei.getVersion(function (result) { + if (result) { + for (var version in result.Versions) { + if (result.Versions[version].Description == 'AMT') { mestate.ver = result.Versions[version].Version; } + if (result.Versions[version].Description == 'Sku') { mestate.sku = parseInt(result.Versions[version].Version); } + } + } + }); amtMei.getProvisioningState(function (result) { if (result) { mestate.ProvisioningState = result; } }); amtMei.getProvisioningMode(function (result) { if (result) { mestate.ProvisioningMode = result; } }); amtMei.getEHBCState(function (result) { if (result) { mestate.ehbc = result; } }); @@ -484,7 +499,9 @@ function run(argv) { amtMei.getDnsSuffix(function (result) { if (result) { mestate.dns = result; } if (mestate.ver && mestate.ProvisioningState && mestate.ProvisioningMode) { - var str = 'Intel AMT v' + mestate.ver; + var str = 'Intel ME v' + mestate.ver; + if (mestate.sku & 8) { str = 'Intel AMT v' + mestate.ver } + else if (mestate.sku & 16) { str = 'Intel SM v' + mestate.ver } if (mestate.ProvisioningState.stateStr == 'PRE') { str += ', pre-provisioning state'; } else if (mestate.ProvisioningState.stateStr == 'IN') { str += ', in-provisioning state'; } else if (mestate.ProvisioningState.stateStr == 'POST') { @@ -1138,6 +1155,7 @@ function activeToACMEx(fwNonce, dnsSuffix, digestRealm, uuid, allowedModes) { try { cmd = JSON.parse(data); } catch (ex) { console.log('Unable to parse server response: ' + data); exit(100); return; } if (typeof cmd != 'object') { console.log('Invalid server response: ' + cmd); exit(100); return; } if (typeof cmd.errorText == 'string') { console.log('Server error: ' + cmd.errorText); exit(100); return; } + if (typeof cmd.messageText == 'string') { console.log('Server: ' + cmd.messageText); return; } switch (cmd.action) { case 'acmactivate': { // Server responded with ACM activation response @@ -1204,7 +1222,7 @@ function activeToACMEx(fwNonce, dnsSuffix, digestRealm, uuid, allowedModes) { var action = 'acmactivate'; if (settings.action == 'amtccm') { action = 'ccmactivate'; } if (settings.action == 'amtdiscover') { action = 'amtdiscover'; } - socket.write({ client: 'meshcmd', version: 1, action: action, fqdn: dnsSuffix, realm: digestRealm, nonce: fwNonce, uuid: uuid, profile: settings.profile, hashes: trustedHashes, tag: settings.tag, name: settings.name, ver: mestate.vers['AMT'], build: mestate.vers['Build Number'], modes: allowedModes, currentMode: mestate.controlMode }); + socket.write({ client: 'meshcmd', version: 1, action: action, fqdn: dnsSuffix, realm: digestRealm, nonce: fwNonce, uuid: uuid, profile: settings.profile, hashes: trustedHashes, tag: settings.tag, name: settings.name, ver: mestate.vers['AMT'], build: mestate.vers['Build Number'], sku: parseInt(mestate.vers['Sku']), modes: allowedModes, currentMode: mestate.controlMode, hostname: require('os').hostname() }); }); connection.end(); } diff --git a/agents/meshcore.js b/agents/meshcore.js index 79196cf7..d6c15a1a 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1683,19 +1683,10 @@ function createMeshCore(agent) var response = null; switch (cmd) { case 'help': { // Displays available commands - var fin = ''; - var f = ''; - var availcommands = 'help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget, nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi, scanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm, amtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo, apf'; - availcommands = availcommands.split(','); - for (f in availcommands) { availcommands[f] = availcommands[f].trim(); } - availcommands = availcommands.sort(); f = ''; - while (availcommands.length > 0) - { - if (f.length > 100) - { - fin += (f + ',\r\n'); - f = ''; - } + var fin = '', f = '', availcommands = 'help,info,osinfo,args,print,type,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt'; + availcommands = availcommands.split(',').sort(); + while (availcommands.length > 0) { + if (f.length > 100) { fin += (f + ',\r\n'); f = ''; } f += (((f != '') ? ', ' : ' ') + availcommands.shift()); } if (f != '') { fin += f; } @@ -2417,7 +2408,7 @@ function createMeshCore(agent) try { if (meinfo == null) return; var intelamt = {}, p = false; - if ((meinfo.Versions != null) && (meinfo.Versions.AMT != null)) { intelamt.ver = meinfo.Versions.AMT; p = true; } + if ((meinfo.Versions != null) && (meinfo.Versions.AMT != null)) { intelamt.ver = meinfo.Versions.AMT; p = true; if (meinfo.Versions.Sku != null) { intelamt.sku = parseInt(meinfo.Versions.Sku); } } if (meinfo.ProvisioningState != null) { intelamt.state = meinfo.ProvisioningState; p = true; } if (meinfo.Flags != null) { intelamt.flags = meinfo.Flags; p = true; } if (meinfo.OsHostname != null) { intelamt.host = meinfo.OsHostname; p = true; } diff --git a/agents/meshcore.min.js b/agents/meshcore.min.js index 8d3382c5..d6c15a1a 100644 --- a/agents/meshcore.min.js +++ b/agents/meshcore.min.js @@ -1683,7 +1683,14 @@ function createMeshCore(agent) var response = null; switch (cmd) { case 'help': { // Displays available commands - response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo, apf.'; + var fin = '', f = '', availcommands = 'help,info,osinfo,args,print,type,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt'; + availcommands = availcommands.split(',').sort(); + while (availcommands.length > 0) { + if (f.length > 100) { fin += (f + ',\r\n'); f = ''; } + f += (((f != '') ? ', ' : ' ') + availcommands.shift()); + } + if (f != '') { fin += f; } + response = 'Available commands: \r\n' + fin + '.'; break; } /* @@ -2401,7 +2408,7 @@ function createMeshCore(agent) try { if (meinfo == null) return; var intelamt = {}, p = false; - if ((meinfo.Versions != null) && (meinfo.Versions.AMT != null)) { intelamt.ver = meinfo.Versions.AMT; p = true; } + if ((meinfo.Versions != null) && (meinfo.Versions.AMT != null)) { intelamt.ver = meinfo.Versions.AMT; p = true; if (meinfo.Versions.Sku != null) { intelamt.sku = parseInt(meinfo.Versions.Sku); } } if (meinfo.ProvisioningState != null) { intelamt.state = meinfo.ProvisioningState; p = true; } if (meinfo.Flags != null) { intelamt.flags = meinfo.Flags; p = true; } if (meinfo.OsHostname != null) { intelamt.host = meinfo.OsHostname; p = true; } diff --git a/meshagent.js b/meshagent.js index 74009a0c..6949ff05 100644 --- a/meshagent.js +++ b/meshagent.js @@ -1355,24 +1355,25 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { //if (command.users) { console.log(command.users); } // Check if anything changes - if (command.name && (command.name != device.name)) { change = 1; log = 1; device.name = command.name; changes.push('name'); } + if (command.name && (typeof command.name == 'string') && (command.name != device.name)) { change = 1; log = 1; device.name = command.name; changes.push('name'); } if ((command.caps != null) && (device.agent.core != command.value)) { if ((command.value == null) && (device.agent.core != null)) { delete device.agent.core; } else { device.agent.core = command.value; } change = 1; } // Don't save this as an event to the db. if ((command.caps != null) && ((device.agent.caps & 0xFFFFFFE7) != (command.caps & 0xFFFFFFE7))) { device.agent.caps = ((device.agent.caps & 24) + (command.caps & 0xFFFFFFE7)); change = 1; } // Allow Javascript on the agent to change all capabilities except console and javascript support, Don't save this as an event to the db. - if ((command.osdesc != null) && (device.osdesc != command.osdesc)) { device.osdesc = command.osdesc; change = 1; changes.push('os desc'); } // Don't save this as an event to the db. + if ((command.osdesc != null) && (typeof command.osdesc == 'string') && (device.osdesc != command.osdesc)) { device.osdesc = command.osdesc; change = 1; changes.push('os desc'); } // Don't save this as an event to the db. if (device.ip != obj.remoteaddr) { device.ip = obj.remoteaddr; change = 1; } if (command.intelamt) { if (!device.intelamt) { device.intelamt = {}; } - if ((command.intelamt.ver != null) && (device.intelamt.ver != command.intelamt.ver)) { changes.push('AMT version'); device.intelamt.ver = command.intelamt.ver; change = 1; log = 1; } - if ((command.intelamt.state != null) && (device.intelamt.state != command.intelamt.state)) { changes.push('AMT state'); device.intelamt.state = command.intelamt.state; change = 1; log = 1; } - if ((command.intelamt.flags != null) && (device.intelamt.flags != command.intelamt.flags)) { + if ((command.intelamt.ver != null) && (typeof command.intelamt.ver == 'string') && (command.intelamt.ver.length < 12) && (device.intelamt.ver != command.intelamt.ver)) { changes.push('AMT version'); device.intelamt.ver = command.intelamt.ver; change = 1; log = 1; } + if ((command.intelamt.sku != null) && (typeof command.intelamt.sku == 'number') && (device.intelamt.sku !== command.intelamt.sku)) { changes.push('AMT SKU'); device.intelamt.sku = command.intelamt.sku; change = 1; log = 1; } + if ((command.intelamt.state != null) && (typeof command.intelamt.state == 'number') && (device.intelamt.state != command.intelamt.state)) { changes.push('AMT state'); device.intelamt.state = command.intelamt.state; change = 1; log = 1; } + if ((command.intelamt.flags != null) && (typeof command.intelamt.flags == 'number') && (device.intelamt.flags != command.intelamt.flags)) { if (device.intelamt.flags) { changes.push('AMT flags (' + device.intelamt.flags + ' --> ' + command.intelamt.flags + ')'); } else { changes.push('AMT flags (' + command.intelamt.flags + ')'); } device.intelamt.flags = command.intelamt.flags; change = 1; log = 1; } - if ((command.intelamt.realm != null) && (device.intelamt.realm != command.intelamt.realm)) { changes.push('AMT realm'); device.intelamt.realm = command.intelamt.realm; change = 1; log = 1; } - if ((command.intelamt.host != null) && (device.intelamt.host != command.intelamt.host)) { changes.push('AMT host'); device.intelamt.host = command.intelamt.host; change = 1; log = 1; } - if ((command.intelamt.uuid != null) && (device.intelamt.uuid != command.intelamt.uuid)) { changes.push('AMT uuid'); device.intelamt.uuid = command.intelamt.uuid; change = 1; log = 1; } - if ((command.intelamt.user != null) && (device.intelamt.user != command.intelamt.user)) { changes.push('AMT user'); device.intelamt.user = command.intelamt.user; change = 1; log = 1; } - if ((command.intelamt.pass != null) && (device.intelamt.pass != command.intelamt.pass)) { changes.push('AMT pass'); device.intelamt.pass = command.intelamt.pass; change = 1; log = 1; } + if ((command.intelamt.realm != null) && (typeof command.intelamt.realm == 'string') && (device.intelamt.realm != command.intelamt.realm)) { changes.push('AMT realm'); device.intelamt.realm = command.intelamt.realm; change = 1; log = 1; } + if ((command.intelamt.host != null) && (typeof command.intelamt.host == 'string') && (device.intelamt.host != command.intelamt.host)) { changes.push('AMT host'); device.intelamt.host = command.intelamt.host; change = 1; log = 1; } + if ((command.intelamt.uuid != null) && (typeof command.intelamt.uuid == 'string') && (device.intelamt.uuid != command.intelamt.uuid)) { changes.push('AMT uuid'); device.intelamt.uuid = command.intelamt.uuid; change = 1; log = 1; } + if ((command.intelamt.user != null) && (typeof command.intelamt.user == 'string') && (device.intelamt.user != command.intelamt.user)) { changes.push('AMT user'); device.intelamt.user = command.intelamt.user; change = 1; log = 1; } + if ((command.intelamt.pass != null) && (typeof command.intelamt.pass == 'string') && (device.intelamt.pass != command.intelamt.pass)) { changes.push('AMT pass'); device.intelamt.pass = command.intelamt.pass; change = 1; log = 1; } } if (command.av) { if (!device.av) { device.av = []; } diff --git a/package.json b/package.json index aaaca8a4..b59a4c2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.1-n", + "version": "0.4.1-o", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index a2c26801..dbb65a9b 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ -
{{{logoutControl}}}
My Devices | My Account | My Events | My Files | My Users | My Server |
{{{logoutControl}}}
My Devices | My Account | My Events | My Files | My Users | My Server |