Fixed bug with PTHI and AMTUUID
Bryan Roe committed
Nov 2, 2021 at 10:34 UTC
5e8c69f89afc59c8ff2dc12e7bd6d136e977d7dd
2 files changed
+23
-4
agents/meshcmd.js
+18
-2
@@ -668,7 +668,8 @@ function run(argv) {
668
performAmtAgentPresence();
669
} else if (settings.action == 'amtuuid') {
670
// Start running
671
- if (settings.hostname != null) {
671
+ if (settings.hostname != null)
672
+ {
673
if ((settings.password == null) || (typeof settings.password != 'string') || (settings.password == '')) { console.log('No or invalid \"password\" specified, use --password [password].'); exit(1); return; }
674
if ((settings.username == null) || (typeof settings.username != 'string') || (settings.username == '')) { settings.username = 'admin'; }
675
}
@@ -1398,7 +1399,17 @@ function getTrustedHashes(amtMei, func, tag) {
1399
// Called to get the UUID of Intel AMT, start by setting up MicroLMS if we are doing the operation on the local computer
1400
function getAmtUuid()
1401
{
1401
- if ((settings.hostname == null) || (settings.hostname == '127.0.0.1') || (settings.hostname.toLowerCase() == 'localhost')) { settings.noconsole = true; startLms(getAmtUuidEx); return; } else { getAmtUuidEx(); }
1402
+ if ((settings.hostname == null) || (settings.hostname == '127.0.0.1') || (settings.hostname.toLowerCase() == 'localhost'))
1403
+ {
1404
+ settings.hostname = '127.0.0.1';
1405
+ settings.noconsole = true;
1406
+ startLms(getAmtUuidEx);
1407
+ return;
1408
+ }
1409
+ else
1410
+ {
1411
+ getAmtUuidEx();
1412
+ }
1413
}
1414
1415
// Fetch the computer's UUID by fetching the CIM_ComputerSystemPackage WSMAN object.
@@ -1667,6 +1678,11 @@ function setupMeiOsAdmin(func, state, tag) {
1678
var transport = require('amt-wsman-duk');
1679
var wsman = require('amt-wsman');
1680
var amt = require('amt');
1681
+
1682
+ settings.username = x.user;
1683
+ settings.password = x.pass;
1684
+ settings.tls = false;
1685
+
1686
oswsstack = new wsman(transport, '127.0.0.1', 16992, x.user, x.pass, false);
1687
osamtstack = new amt(oswsstack);
1688
if (func) { func(state, tag); }
agents/modules_meshcmd/amt-wsman-duk.js
+5
-2
@@ -66,7 +66,8 @@ function CreateWsmanComm(/*host, port, user, pass, tls, extra*/) {
66
}
67
68
// Private method
69
- obj.PerformAjaxEx = function (postdata, callback, tag, url, action) {
69
+ obj.PerformAjaxEx = function (postdata, callback, tag, url, action)
70
+ {
71
if (obj.FailAllError != 0) { if (obj.FailAllError != 999) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag]); } return; }
72
if (!postdata) postdata = "";
73
if (globalDebugFlags & 1) { console.log("SEND: " + postdata + "\r\n\r\n"); } // DEBUG
@@ -80,9 +81,11 @@ function CreateWsmanComm(/*host, port, user, pass, tls, extra*/) {
81
}
82
obj.digest.http = require('http');
83
}
83
- var request = { protocol: (obj.tls == 1 ? 'https:' : 'http:'), method: 'POST', host: obj.host, path: '/wsman', port: obj.port, rejectUnauthorized: false, checkServerIdentity: function (cert) { /*console.log('checkServerIdentity', JSON.stringify(cert));*/ } };
84
+ var request = { delayWrite: true, protocol: (obj.tls == 1 ? 'https:' : 'http:'), method: 'POST', host: obj.host, path: '/wsman', port: obj.port, rejectUnauthorized: false, checkServerIdentity: function (cert) { /*console.log('checkServerIdentity', JSON.stringify(cert));*/ } };
85
var req = obj.digest.request(request);
86
//console.log('Request ' + (obj.RequestCount++));
87
+ if (globalDebugFlags & 1) { console.log('Request ' + (obj.RequestCount++)); } // DEBUG
88
+
89
req.on('error', function (e) { obj.gotNextMessagesError({ status: 600 }, 'error', null, [postdata, callback, tag]); });
90
req.on('response', function (response) {
91
//console.log(JSON.stringify(response, null, 2));