mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added Intel Standard Manageability (ISM) support, improved MeshCMD activation.
This commit is contained in:
parent
b19cf48adc
commit
414494421b
13 changed files with 136 additions and 55 deletions
Binary file not shown.
Binary file not shown.
|
@ -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();
|
||||
}
|
||||
|
|
30
agents/meshcmd.min.js
vendored
30
agents/meshcmd.min.js
vendored
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
11
agents/meshcore.min.js
vendored
11
agents/meshcore.min.js
vendored
|
@ -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; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue