Updated MeshCMD with MEI hang workaround.
Ylian Saint-Hilaire committed
Jul 1, 2021 at 13:21 UTC
81d903672aa78eaabdb405730a5a4abe921131f0
3 files changed
+143
-130
agents/MeshCmd-signed.exe
Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ
agents/MeshCmd64-signed.exe
Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ
agents/meshcmd.js
+143
-130
@@ -99,7 +99,7 @@ function objToString(x, p, ret) {
99
return r + addPad(p, ret) + '}';
100
}
101
102
-// Return p number of spaces
102
+// Return p number of spaces
103
function addPad(p, ret) { var r = ''; for (var i = 0; i < p; i++) { r += ' '; } return r; }
104
105
// Parse the incoming arguments
@@ -514,67 +514,70 @@ function run(argv) {
514
if (result.Versions[version].Description == 'AMT') { mestate.ver = result.Versions[version].Version; }
515
if (result.Versions[version].Description == 'Sku') { mestate.sku = parseInt(result.Versions[version].Version); }
516
}
517
- }
518
- });
519
- amtMei.getProvisioningState(function (result) { if (result) { mestate.ProvisioningState = result; } });
520
- amtMei.getProvisioningMode(function (result) { if (result) { mestate.ProvisioningMode = result; } });
521
- amtMei.getEHBCState(function (result) { if (result) { mestate.ehbc = result; } });
522
- amtMei.getControlMode(function (result) { if (result) { mestate.controlmode = result; } });
523
- amtMei.getMACAddresses(function (result) { if (result) { mestate.mac = result; } });
524
- amtMei.getLanInterfaceSettings(0, function (result) { if (result) { mestate.net0 = result; } });
525
- amtMei.getLanInterfaceSettings(1, function (result) { if (result) { mestate.net1 = result; } });
526
- amtMei.getUuid(function (result) { if ((result != null) && (result.uuid != null)) { mestate.uuid = result.uuid; } });
527
- amtMei.getRemoteAccessConnectionStatus(function (result) { if ((result != null) && (result.status == 0)) { mestate.networkStatus = result.networkStatus; mestate.remoteAccessStatus = result.remoteAccessStatus; mestate.remoteAccessTrigger = result.remoteAccessTrigger; mestate.mpsHostname = result.mpsHostname; } });
528
- amtMei.getDnsSuffix(function (result) {
529
- if (result) { mestate.dns = result; }
530
- if (mestate.ver && mestate.ProvisioningState && mestate.ProvisioningMode) {
531
- var str = 'Intel ME v' + mestate.ver;
532
- if (mestate.sku & 8) { str = 'Intel AMT v' + mestate.ver }
533
- else if (mestate.sku & 16) { str = 'Intel SM v' + mestate.ver }
534
- if (mestate.ProvisioningState.stateStr == 'PRE') { str += ', pre-provisioning state'; }
535
- else if (mestate.ProvisioningState.stateStr == 'IN') { str += ', in-provisioning state'; }
536
- else if (mestate.ProvisioningState.stateStr == 'POST') {
537
- if (mestate.ProvisioningMode) {
538
- if (mestate.controlmode) {
539
- if (mestate.ProvisioningMode.modeStr == 'ENTERPRISE') { str += ', activated in ' + ["none", "Client Control Mode (CCM)", "Admin Control Mode (ACM)", "remote assistance mode"][mestate.controlmode.controlMode]; } else { str += ', activated in ' + mestate.ProvisioningMode.modeStr; }
540
- } else {
541
- str += ', activated in ' + mestate.ProvisioningMode.modeStr;
517
+ amtMei.getProvisioningState(function (result) { if (result) { mestate.ProvisioningState = result; } });
518
+ amtMei.getProvisioningMode(function (result) { if (result) { mestate.ProvisioningMode = result; } });
519
+ amtMei.getEHBCState(function (result) { if (result) { mestate.ehbc = result; } });
520
+ amtMei.getControlMode(function (result) { if (result) { mestate.controlmode = result; } });
521
+ amtMei.getMACAddresses(function (result) { if (result) { mestate.mac = result; } });
522
+ amtMei.getLanInterfaceSettings(0, function (result) { if (result) { mestate.net0 = result; } });
523
+ amtMei.getLanInterfaceSettings(1, function (result) { if (result) { mestate.net1 = result; } });
524
+ amtMei.getUuid(function (result) { if ((result != null) && (result.uuid != null)) { mestate.uuid = result.uuid; } });
525
+ amtMei.getRemoteAccessConnectionStatus(function (result) { if ((result != null) && (result.status == 0)) { mestate.networkStatus = result.networkStatus; mestate.remoteAccessStatus = result.remoteAccessStatus; mestate.remoteAccessTrigger = result.remoteAccessTrigger; mestate.mpsHostname = result.mpsHostname; } });
526
+ amtMei.getDnsSuffix(function (result) {
527
+ if (result) { mestate.dns = result; }
528
+ if (mestate.ver && mestate.ProvisioningState && mestate.ProvisioningMode) {
529
+ var str = 'Intel ME v' + mestate.ver;
530
+ if (mestate.sku & 8) { str = 'Intel AMT v' + mestate.ver }
531
+ else if (mestate.sku & 16) { str = 'Intel SM v' + mestate.ver }
532
+ if (mestate.ProvisioningState.stateStr == 'PRE') { str += ', pre-provisioning state'; }
533
+ else if (mestate.ProvisioningState.stateStr == 'IN') { str += ', in-provisioning state'; }
534
+ else if (mestate.ProvisioningState.stateStr == 'POST') {
535
+ if (mestate.ProvisioningMode) {
536
+ if (mestate.controlmode) {
537
+ if (mestate.ProvisioningMode.modeStr == 'ENTERPRISE') { str += ', activated in ' + ["none", "Client Control Mode (CCM)", "Admin Control Mode (ACM)", "remote assistance mode"][mestate.controlmode.controlMode]; } else { str += ', activated in ' + mestate.ProvisioningMode.modeStr; }
538
+ } else {
539
+ str += ', activated in ' + mestate.ProvisioningMode.modeStr;
540
+ }
541
+ }
542
}
543
- }
544
- }
545
- if ((mestate.ehbc) && (mestate.ehbc.EHBC == true)) { str += ', EHBC enabled'; }
546
- str += '.';
547
- if (mestate.net0 != null) { str += '\r\nWired ' + ((mestate.net0.enabled == 1) ? 'Enabled' : 'Disabled') + ((mestate.net0.dhcpEnabled == 1) ? ', DHCP' : ', Static') + ', ' + mestate.net0.mac + (mestate.net0.address == '0.0.0.0' ? '' : (', ' + mestate.net0.address)); }
548
- if (mestate.net1 != null) { str += '\r\nWireless ' + ((mestate.net1.enabled == 1) ? 'Enabled' : 'Disabled') + ((mestate.net1.dhcpEnabled == 1) ? ', DHCP' : ', Static') + ', ' + mestate.net1.mac + (mestate.net1.address == '0.0.0.0' ? '' : (', ' + mestate.net1.address)); }
549
- if ((mestate.net0 != null) && (mestate.net0.enabled == 1)) {
550
- if (mestate.dns != null) {
551
- // Intel AMT has a trusted DNS suffix set, use that one.
552
- str += '\r\nTrusted DNS suffix: ' + mestate.dns;
553
- } else {
554
- // Look for the DNS suffix for the Intel AMT Ethernet interface
555
- var fqdn = null, interfaces = require('os').networkInterfaces();
556
- for (var i in interfaces) {
557
- for (var j in interfaces[i]) {
558
- if ((interfaces[i][j].mac == mestate.net0.mac) && (interfaces[i][j].fqdn != null) && (interfaces[i][j].fqdn != '')) { fqdn = interfaces[i][j].fqdn; }
543
+ if ((mestate.ehbc) && (mestate.ehbc.EHBC == true)) { str += ', EHBC enabled'; }
544
+ str += '.';
545
+ if (mestate.net0 != null) { str += '\r\nWired ' + ((mestate.net0.enabled == 1) ? 'Enabled' : 'Disabled') + ((mestate.net0.dhcpEnabled == 1) ? ', DHCP' : ', Static') + ', ' + mestate.net0.mac + (mestate.net0.address == '0.0.0.0' ? '' : (', ' + mestate.net0.address)); }
546
+ if (mestate.net1 != null) { str += '\r\nWireless ' + ((mestate.net1.enabled == 1) ? 'Enabled' : 'Disabled') + ((mestate.net1.dhcpEnabled == 1) ? ', DHCP' : ', Static') + ', ' + mestate.net1.mac + (mestate.net1.address == '0.0.0.0' ? '' : (', ' + mestate.net1.address)); }
547
+ if ((mestate.net0 != null) && (mestate.net0.enabled == 1)) {
548
+ if (mestate.dns != null) {
549
+ // Intel AMT has a trusted DNS suffix set, use that one.
550
+ str += '\r\nTrusted DNS suffix: ' + mestate.dns;
551
+ } else {
552
+ // Look for the DNS suffix for the Intel AMT Ethernet interface
553
+ var fqdn = null, interfaces = require('os').networkInterfaces();
554
+ for (var i in interfaces) {
555
+ for (var j in interfaces[i]) {
556
+ if ((interfaces[i][j].mac == mestate.net0.mac) && (interfaces[i][j].fqdn != null) && (interfaces[i][j].fqdn != '')) { fqdn = interfaces[i][j].fqdn; }
557
+ }
558
+ }
559
+ if (fqdn != null) { str += '\r\nDNS suffix: ' + fqdn; }
560
}
561
}
561
- if (fqdn != null) { str += '\r\nDNS suffix: ' + fqdn; }
562
- }
563
- }
564
- if (typeof mestate.networkStatus == 'number') {
565
- str += '\r\nConnection Status: ' + ['Direct', 'VPN', 'Outside'][mestate.networkStatus];
566
- str += ', CIRA: ' + ['Disconnected', 'Connecting', 'Connected'][mestate.remoteAccessStatus];
567
- if ((mestate.remoteAccessStatus > 0) && (mestate.mpsHostname != null) && (mestate.mpsHostname.length > 0)) {
568
- str += ' to ' + mestate.mpsHostname + ', ' + ['User initiated', 'Alert', 'Periodic', 'Provisioning'][mestate.remoteAccessTrigger];
562
+ if (typeof mestate.networkStatus == 'number') {
563
+ str += '\r\nConnection Status: ' + ['Direct', 'VPN', 'Outside', 'Unknown'][mestate.networkStatus];
564
+ str += ', CIRA: ' + ['Disconnected', 'Connecting', 'Connected'][mestate.remoteAccessStatus];
565
+ if ((mestate.remoteAccessStatus > 0) && (mestate.mpsHostname != null) && (mestate.mpsHostname.length > 0)) {
566
+ str += ' to ' + mestate.mpsHostname + ', ' + ['User initiated', 'Alert', 'Periodic', 'Provisioning'][mestate.remoteAccessTrigger];
567
+ }
568
+ }
569
+ console.log(str + '.');
570
+ } else {
571
+ console.log('Intel(R) AMT not supported.');
572
}
570
- }
571
- console.log(str + '.');
573
+ exit(1);
574
+ });
575
} else {
573
- console.log('Intel(R) AMT not supported.');
576
+ console.log("Unable to perform MEI operations, try running as " + ((process.platform == 'win32')?"administrator.":"root."));
577
+ exit(1); return;
578
}
575
- exit(1);
579
});
577
- } catch (ex) { console.log("Unable to perform MEI operations, try running as administrator."); exit(1); return; }
580
+ } catch (ex) { console.log("Unable to perform MEI operations, try running as " + ((process.platform == 'win32')?"administrator.":"root.")); exit(1); return; }
581
} else if (settings.action == 'amtinfodebug') {
582
// Display Intel AMT version and activation state
583
getMeiState(15, function (state) { console.log(JSON.stringify(state, null, 2)); exit(1); }); // Flags: 1 = Versions, 2 = OsAdmin, 4 = Hashes, 8 = Network
@@ -590,10 +593,14 @@ function run(argv) {
593
saveEntireAmtState();
594
} else if ((settings.action == 'microlms') || (settings.action == 'amtlms') || (settings.action == 'lms')) {
595
// Start Intel AMT MicroLMS
593
- startLms(function (state) {
594
- console.log(['MicroLMS did not start. Must run as administrator or LMS already active.', 'MicroLMS started.', 'MicroLMS started, MeshCommander on HTTP/16994.', 'MEI error'][state]);
595
- if (((state == 0) || (state == 3)) && (settings.noconsole === true)) { exit(0); } else { console.log('Press ctrl-c to exit.'); }
596
- }, settings.noconsole !== true);
596
+ // Because of a bug in MEI on Linux, LMS will jam if not root. To work around this, start by checking AMT state first.
597
+ getMeiState(0, function (xstate) { // Flags: 1 = Versions, 2 = OsAdmin, 4 = Hashes, 8 = Network
598
+ if (xstate == null) { console.log("Unable to get Intel AMT state, try running as " + ((process.platform == 'win32')?"administrator.":"root.")); exit(1); return; }
599
+ startLms(function (state) {
600
+ console.log(['MicroLMS did not start. Must run as administrator or LMS already active.', 'MicroLMS started.', 'MicroLMS started, MeshCommander on HTTP/16994.', 'MEI error'][state]);
601
+ if (((state == 0) || (state == 3)) && (settings.noconsole === true)) { exit(0); } else { console.log('Press ctrl-c to exit.'); }
602
+ }, false, xstate);
603
+ });
604
} else if (settings.action == 'amtpresence') {
605
// Heartbeat a Intel AMT watchdog
606
if ((settings.password == null) || (typeof settings.password != 'string') || (settings.password == '')) { console.log('No or invalid \"password\" specified, use --password [password].'); exit(1); return; }
@@ -1110,56 +1117,57 @@ function startMeshCommander() {
1117
1118
function configureAmt() {
1119
settings.noconsole = true;
1113
- startLms(configureAmt2, amtMei);
1114
-}
1115
-
1116
-function configureAmt2() {
1120
+ // Due to a bug in MEI handling, we have to pull MEI state first before starting LMS.
1121
getMeiState(15, function (state) { // Flags: 1 = Versions, 2 = OsAdmin, 4 = Hashes, 8 = Network
1118
- if (state == null) { console.log('Unable to get Intel AMT state, try running as administrator.'); exit(1); return; }
1122
+ if (state == null) { console.log("Unable to get Intel AMT state, try running as " + ((process.platform == 'win32')?"administrator.":"root.")); exit(1); return; }
1123
if (state.ProvisioningState == null) { console.log('Intel AMT not ready for configuration.'); exit(1); return; }
1120
- console.log('Starting Intel AMT configuration...');
1124
+ startLms(configureAmt2, false, state);
1125
+ });
1126
+}
1127
1122
- // Add indication if the device is battery powered, this is used to show a mobile icon when adding the device
1123
- state.isBatteryPowered = (require('identifiers').isBatteryPowered && require('identifiers').isBatteryPowered());
1128
+function configureAmt2(err, state) {
1129
+ console.log('Starting Intel AMT configuration...');
1130
1125
- // Add Intel AMT credentials if provided
1126
- if ((typeof settings.password == 'string') && (settings.password != '')) {
1127
- state.amtpass = settings.password;
1128
- state.amtuser = 'admin';
1129
- if ((typeof settings.username == 'string') && (settings.username != '')) { state.amtuser = settings.username; }
1130
- }
1131
+ // Add indication if the device is battery powered, this is used to show a mobile icon when adding the device
1132
+ state.isBatteryPowered = (require('identifiers').isBatteryPowered && require('identifiers').isBatteryPowered());
1133
+
1134
+ // Add Intel AMT credentials if provided
1135
+ if ((typeof settings.password == 'string') && (settings.password != '')) {
1136
+ state.amtpass = settings.password;
1137
+ state.amtuser = 'admin';
1138
+ if ((typeof settings.username == 'string') && (settings.username != '')) { state.amtuser = settings.username; }
1139
+ }
1140
1132
- // If a description is provided, send it to the server
1133
- if ((typeof settings.desc == 'string') && (settings.desc != '')) { state.desc = settings.desc; }
1134
-
1135
- // Connect to MPS and start APF relay
1136
- var apfarg = {
1137
- mpsurl: settings.url,
1138
- mpsuser: settings.id.substring(0, 16),
1139
- mpspass: settings.id.substring(0, 16),
1140
- mpskeepalive: 60000,
1141
- clientname: state.OsHostname,
1142
- clientaddress: '127.0.0.1',
1143
- clientuuid: state.UUID,
1144
- conntype: 2, // 0 = CIRA, 1 = Relay, 2 = LMS. The correct value is 2 since we are performing an LMS relay.
1145
- meiState: state
1146
- };
1147
- if ((apfarg.clientuuid == null) || (apfarg.clientuuid.length != 36)) {
1148
- console.log("Unable to get Intel AMT UUID: " + apfarg.clientuuid);
1141
+ // If a description is provided, send it to the server
1142
+ if ((typeof settings.desc == 'string') && (settings.desc != '')) { state.desc = settings.desc; }
1143
+
1144
+ // Connect to MPS and start APF relay
1145
+ var apfarg = {
1146
+ mpsurl: settings.url,
1147
+ mpsuser: settings.id.substring(0, 16),
1148
+ mpspass: settings.id.substring(0, 16),
1149
+ mpskeepalive: 60000,
1150
+ clientname: state.OsHostname,
1151
+ clientaddress: '127.0.0.1',
1152
+ clientuuid: state.UUID,
1153
+ conntype: 2, // 0 = CIRA, 1 = Relay, 2 = LMS. The correct value is 2 since we are performing an LMS relay.
1154
+ meiState: state
1155
+ };
1156
+ if ((apfarg.clientuuid == null) || (apfarg.clientuuid.length != 36)) {
1157
+ console.log("Unable to get Intel AMT UUID: " + apfarg.clientuuid);
1158
+ exit(1); return;
1159
+ } else {
1160
+ settings.apftunnel = require('amt-apfclient')({ debug: (settings.debuglevel > 0) }, apfarg);
1161
+ settings.apftunnel.onJsonControl = configureJsonControl;
1162
+ settings.apftunnel.onChannelClosed = function () { exit(0); }
1163
+ try {
1164
+ settings.apftunnel.connect();
1165
+ console.log("Started APF tunnel...");
1166
+ } catch (e) {
1167
+ console.log(JSON.stringify(e));
1168
exit(1); return;
1150
- } else {
1151
- settings.apftunnel = require('amt-apfclient')({ debug: (settings.debuglevel > 0) }, apfarg);
1152
- settings.apftunnel.onJsonControl = configureJsonControl;
1153
- settings.apftunnel.onChannelClosed = function () { exit(0); }
1154
- try {
1155
- settings.apftunnel.connect();
1156
- console.log("Started APF tunnel...");
1157
- } catch (e) {
1158
- console.log(JSON.stringify(e));
1159
- exit(1); return;
1160
- }
1169
}
1162
- });
1170
+ }
1171
}
1172
1173
function configureJsonControl(data) {
@@ -1476,7 +1484,7 @@ function startLms(func, lmscommander, tag) {
1484
try { amtLms = new lme_heci({ debug: settings.lmsdebug }); } catch (ex) { if (func != null) { func(0, tag); } return; }
1485
amtLms.promise = ret;
1486
amtLms.on('error', function (e) {
1479
- //console.log('LME connection failed', e);
1487
+ console.log('LME connection failed', e);
1488
if (lmscommander === true) { //settings.noconsole !== true) {
1489
startMeshCommanderLms();
1490
//console.log("LMS started, MeshCommander on HTTP/16994.");
@@ -2745,33 +2753,38 @@ function getMeiState(flags, func) {
2753
amtMei.on('error', function (e) { func(null); return; });
2754
try {
2755
var amtMeiTmpState = { 'core-ver': 1, OsHostname: require('os').hostname(), Flags: 0 }; // Flags: 1=EHBC, 2=CCM, 4=ACM
2748
- amtMei.getProtocolVersion(function (result) { if (result != null) { amtMeiTmpState.MeiVersion = result; } });
2749
- if ((flags & 1) != 0) { amtMei.getVersion(function (result) { if (result) { amtMeiTmpState.Versions = {}; for (var version in result.Versions) { amtMeiTmpState.Versions[result.Versions[version].Description] = result.Versions[version].Version; } } }); }
2750
- amtMei.getProvisioningMode(function (result) { if (result) { amtMeiTmpState.ProvisioningMode = result.mode; } });
2751
- amtMei.getProvisioningState(function (result) { if (result) { amtMeiTmpState.ProvisioningState = result.state; } }); // 0: "Not Activated (Pre)", 1: "Not Activated (In)", 2: "Activated"
2752
- amtMei.getEHBCState(function (result) { if ((result != null) && (result.EHBC == true)) { amtMeiTmpState.Flags += 1; } });
2753
- amtMei.getControlMode(function (result) { if (result != null) { if (result.controlMode == 1) { amtMeiTmpState.Flags += 2; } if (result.controlMode == 2) { amtMeiTmpState.Flags += 4; } } }); // Flag 2 = CCM, 4 = ACM
2754
- //amtMei.getMACAddresses(function (result) { if (result) { amtMeiTmpState.mac = result; } });
2755
- if ((flags & 8) != 0) {
2756
- amtMei.getLanInterfaceSettings(0, function (result) {
2757
- if (result) {
2758
- amtMeiTmpState.net0 = result;
2759
- var fqdn = null, interfaces = require('os').networkInterfaces(); // Look for the DNS suffix for the Intel AMT Ethernet interface
2760
- for (var i in interfaces) { for (var j in interfaces[i]) { if ((interfaces[i][j].mac == amtMeiTmpState.net0.mac) && (interfaces[i][j].fqdn != null) && (interfaces[i][j].fqdn != '')) { amtMeiTmpState.OsDnsSuffix = interfaces[i][j].fqdn; } } }
2761
- }
2762
- });
2763
- amtMei.getLanInterfaceSettings(1, function (result) { if (result) { amtMeiTmpState.net1 = result; } });
2764
- }
2765
- amtMei.getUuid(function (result) { if ((result != null) && (result.uuid != null)) { amtMeiTmpState.UUID = result.uuid; } });
2766
- if ((flags & 2) != 0) { amtMei.getLocalSystemAccount(function (x) { if ((x != null) && x.user && x.pass) { amtMeiTmpState.OsAdmin = { user: x.user, pass: x.pass }; } }); }
2767
- amtMei.getDnsSuffix(function (result) { if (result != null) { amtMeiTmpState.DnsSuffix = result; } if ((flags & 4) == 0) { if (func != null) { func(amtMeiTmpState); } } });
2768
- if ((flags & 4) != 0) {
2769
- amtMei.getHashHandles(function (handles) {
2770
- if ((handles != null) && (handles.length > 0)) { amtMeiTmpState.Hashes = []; } else { func(amtMeiTmpState); }
2771
- var exitOnCount = handles.length;
2772
- for (var i = 0; i < handles.length; ++i) { this.getCertHashEntry(handles[i], function (hashresult) { amtMeiTmpState.Hashes.push(hashresult); if (--exitOnCount == 0) { if (func != null) { func(amtMeiTmpState); } } }); }
2773
- });
2774
- }
2756
+ amtMei.getVersion(function (result) {
2757
+ if (result == null) { func(null); return; }
2758
+ amtMeiTmpState.Versions = {}; for (var version in result.Versions) { amtMeiTmpState.Versions[result.Versions[version].Description] = result.Versions[version].Version; }
2759
+
2760
+ amtMei.getProtocolVersion(function (result) { if (result != null) { amtMeiTmpState.MeiVersion = result; } });
2761
+ //if ((flags & 1) != 0) { amtMei.getVersion(function (result) { if (result) { } }); }
2762
+ amtMei.getProvisioningMode(function (result) { if (result) { amtMeiTmpState.ProvisioningMode = result.mode; } });
2763
+ amtMei.getProvisioningState(function (result) { if (result) { amtMeiTmpState.ProvisioningState = result.state; } }); // 0: "Not Activated (Pre)", 1: "Not Activated (In)", 2: "Activated"
2764
+ amtMei.getEHBCState(function (result) { if ((result != null) && (result.EHBC == true)) { amtMeiTmpState.Flags += 1; } });
2765
+ amtMei.getControlMode(function (result) { if (result != null) { if (result.controlMode == 1) { amtMeiTmpState.Flags += 2; } if (result.controlMode == 2) { amtMeiTmpState.Flags += 4; } } }); // Flag 2 = CCM, 4 = ACM
2766
+ //amtMei.getMACAddresses(function (result) { if (result) { amtMeiTmpState.mac = result; } });
2767
+ if ((flags & 8) != 0) {
2768
+ amtMei.getLanInterfaceSettings(0, function (result) {
2769
+ if (result) {
2770
+ amtMeiTmpState.net0 = result;
2771
+ var fqdn = null, interfaces = require('os').networkInterfaces(); // Look for the DNS suffix for the Intel AMT Ethernet interface
2772
+ for (var i in interfaces) { for (var j in interfaces[i]) { if ((interfaces[i][j].mac == amtMeiTmpState.net0.mac) && (interfaces[i][j].fqdn != null) && (interfaces[i][j].fqdn != '')) { amtMeiTmpState.OsDnsSuffix = interfaces[i][j].fqdn; } } }
2773
+ }
2774
+ });
2775
+ amtMei.getLanInterfaceSettings(1, function (result) { if (result) { amtMeiTmpState.net1 = result; } });
2776
+ }
2777
+ amtMei.getUuid(function (result) { if ((result != null) && (result.uuid != null)) { amtMeiTmpState.UUID = result.uuid; } });
2778
+ if ((flags & 2) != 0) { amtMei.getLocalSystemAccount(function (x) { if ((x != null) && x.user && x.pass) { amtMeiTmpState.OsAdmin = { user: x.user, pass: x.pass }; } }); }
2779
+ amtMei.getDnsSuffix(function (result) { if (result != null) { amtMeiTmpState.DnsSuffix = result; } if ((flags & 4) == 0) { if (func != null) { func(amtMeiTmpState); } } });
2780
+ if ((flags & 4) != 0) {
2781
+ amtMei.getHashHandles(function (handles) {
2782
+ if ((handles != null) && (handles.length > 0)) { amtMeiTmpState.Hashes = []; } else { func(amtMeiTmpState); }
2783
+ var exitOnCount = handles.length;
2784
+ for (var i = 0; i < handles.length; ++i) { this.getCertHashEntry(handles[i], function (hashresult) { amtMeiTmpState.Hashes.push(hashresult); if (--exitOnCount == 0) { if (func != null) { func(amtMeiTmpState); } } }); }
2785
+ });
2786
+ }
2787
+ });
2788
} catch (e) { if (func != null) { func(null); } return; }
2789
}
2790