Fixed bug with PTHI and AMTUUID

This commit is contained in:
Bryan Roe 2021-11-02 10:34:32 -07:00
parent 97ae2312ac
commit 5e8c69f89a
2 changed files with 23 additions and 4 deletions

View File

@ -668,7 +668,8 @@ function run(argv) {
performAmtAgentPresence();
} else if (settings.action == 'amtuuid') {
// Start running
if (settings.hostname != null) {
if (settings.hostname != null)
{
if ((settings.password == null) || (typeof settings.password != 'string') || (settings.password == '')) { console.log('No or invalid \"password\" specified, use --password [password].'); exit(1); return; }
if ((settings.username == null) || (typeof settings.username != 'string') || (settings.username == '')) { settings.username = 'admin'; }
}
@ -1398,7 +1399,17 @@ function getTrustedHashes(amtMei, func, tag) {
// Called to get the UUID of Intel AMT, start by setting up MicroLMS if we are doing the operation on the local computer
function getAmtUuid()
{
if ((settings.hostname == null) || (settings.hostname == '127.0.0.1') || (settings.hostname.toLowerCase() == 'localhost')) { settings.noconsole = true; startLms(getAmtUuidEx); return; } else { getAmtUuidEx(); }
if ((settings.hostname == null) || (settings.hostname == '127.0.0.1') || (settings.hostname.toLowerCase() == 'localhost'))
{
settings.hostname = '127.0.0.1';
settings.noconsole = true;
startLms(getAmtUuidEx);
return;
}
else
{
getAmtUuidEx();
}
}
// Fetch the computer's UUID by fetching the CIM_ComputerSystemPackage WSMAN object.
@ -1667,6 +1678,11 @@ function setupMeiOsAdmin(func, state, tag) {
var transport = require('amt-wsman-duk');
var wsman = require('amt-wsman');
var amt = require('amt');
settings.username = x.user;
settings.password = x.pass;
settings.tls = false;
oswsstack = new wsman(transport, '127.0.0.1', 16992, x.user, x.pass, false);
osamtstack = new amt(oswsstack);
if (func) { func(state, tag); }

View File

@ -66,7 +66,8 @@ function CreateWsmanComm(/*host, port, user, pass, tls, extra*/) {
}
// Private method
obj.PerformAjaxEx = function (postdata, callback, tag, url, action) {
obj.PerformAjaxEx = function (postdata, callback, tag, url, action)
{
if (obj.FailAllError != 0) { if (obj.FailAllError != 999) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag]); } return; }
if (!postdata) postdata = "";
if (globalDebugFlags & 1) { console.log("SEND: " + postdata + "\r\n\r\n"); } // DEBUG
@ -80,9 +81,11 @@ function CreateWsmanComm(/*host, port, user, pass, tls, extra*/) {
}
obj.digest.http = require('http');
}
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));*/ } };
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));*/ } };
var req = obj.digest.request(request);
//console.log('Request ' + (obj.RequestCount++));
if (globalDebugFlags & 1) { console.log('Request ' + (obj.RequestCount++)); } // DEBUG
req.on('error', function (e) { obj.gotNextMessagesError({ status: 600 }, 'error', null, [postdata, callback, tag]); });
req.on('response', function (response) {
//console.log(JSON.stringify(response, null, 2));