1
0
mirror of https://github.com/Ylianst/MeshCommander synced 2025-12-06 06:03:20 +00:00

Fixed -kvmdatatrace issue.

This commit is contained in:
Ylian Saint-Hilaire
2020-08-10 13:47:28 -07:00
parent ea9fb68287
commit 1507acee4f
116 changed files with 49517 additions and 18 deletions

View File

@@ -4823,14 +4823,27 @@
// ###BEGIN###{Mode-NodeWebkit}
// Perform Intel ME authentication if available.
/*
if (amtversion >= 15) {
var nonce = '12345678901234567890'; // TODO: This is a test nonce, we will need to use a random one.
stack.AMT_GeneralSettings_AMTAuthenticate(btoa(nonce), function (stack, name, response, status) {
console.log('Intel AMT Auth', name, response, status);
if ((amtversion >= 15) && (wsstack.comm.xtlsCertificate != null)) {
stack.amtauthnonce = require('crypto').randomBytes(10).toString('hex');
stack.AMT_GeneralSettings_AMTAuthenticate(stack.amtauthnonce, function (stack, name, response, status) {
if (status == 200) {
stack.amtauth = response.Body;
stack.amtauth.CertificatesDer = [];
var certs = [], certsbin = atob(stack.amtauth.Certificates), cptr = 0;
for (var i = 0; i < stack.amtauth.LengthOfCertificates.length; i++) {
var bin = certsbin.substring(cptr, cptr + stack.amtauth.LengthOfCertificates[i]);
stack.amtauth.CertificatesDer.push(bin);
certs.push(forge.pki.certificateFromAsn1(forge.asn1.fromDer(bin))); // Node-forge does not support ECC, but we are using a modified Node-forge that can still parse the cert.
cptr += stack.amtauth.LengthOfCertificates[i];
}
stack.amtauth.Certificates = certs;
stack.amtauth.ClientNonce = stack.amtauthnonce;
delete stack.amtauth.LengthOfCertificates;
stack.amtauth.uuidStr = guidToStr(stack.amtauth.UUID).toLowerCase();
}
delete stack.amtauthnonce;
});
}
*/
// ###END###{Mode-NodeWebkit}
// ###BEGIN###{ComputerSelector}
@@ -5250,7 +5263,11 @@
if (y != null && y.length > 0) host += '.' + y;
if (host.length == 0) { host = ('<i>' + "None" + '</i>'); } else { host = EscapeHtml(host); }
x += TableEntry("Name & Domain", addLinkConditional(host, 'showEditNameDlg()', xxAccountAdminName));
if (HardwareInventory) x += TableEntry("System ID", guidToStr(HardwareInventory['CIM_ComputerSystemPackage'].response['PlatformGUID'].toLowerCase()));
if (amtstack.amtauth && amtstack.amtauth.uuidStr) {
x += TableEntry("System ID", amtstack.amtauth.uuidStr);
} else if (HardwareInventory) {
x += TableEntry("System ID", guidToStr(HardwareInventory['CIM_ComputerSystemPackage'].response['PlatformGUID'].toLowerCase()));
}
if (amtlogicalelements) {
var mode = '', scs = getItem(amtlogicalelements, 'CreationClassName', 'AMT_SetupAndConfigurationService');
// ###BEGIN###{!Look-Intel-SBT}
@@ -5431,6 +5448,10 @@
buttons += AddButton("Run Script...", 'script_runScriptDlg()') + ' ';
// ###END###{Scripting}
x += TableEnd(buttons);
// Show authentic CSME if present
if (amtstack.amtauth) { x += '<div style=position:absolute;top:10px;right:20px;cursor:pointer onclick=showAuthCsme()><img src=authcsme.png width=100 height=100 /></div>'; }
QH('id_TableSysStatus', x);
// ###BEGIN###{NetworkSettings}
@@ -5638,6 +5659,43 @@
}
}
function showAuthCsme() {
if (xxdialogMode) return;
var x = '<div style=margin-top:8px>' + "Intel&reg; AMT supports authentic CSME feature, however MeshCommander cannot verify the authenticity yet." + '</div><hr style=margin-top:8px;margin-bottom:8px;height:2px;border-width:0;color:gray;background-color:gray />';
x += addHtmlValue("FW Version", amtstack.amtauth.FWVersion);
x += addHtmlValue("FQDN", amtstack.amtauth.FQDN ? amtstack.amtauth.FQDN : ('<i>' + "None" + '</i>'));
x += '<hr style=margin-top:8px;margin-bottom:8px;height:2px;border-width:0;color:gray;background-color:gray /><table>';
for (var i in amtstack.amtauth.Certificates) {
var cert = amtstack.amtauth.Certificates[i];
x += '<tr><td style=width:32px><img src=images-commander/cert1.png height=32 width=32 />';
x += '<td>' + EscapeHtml(cert.subject.getField('CN').value) + '<br />';
// ###BEGIN###{FileSaver}
x += amtstack.amtauth.CertificatesDer[i].length + " bytes, " + '<a style=cursor:pointer;color:blue onclick=downloadAuthCert(' + i + ')>' + "Download" + '</a>';
// ###END###{FileSaver}
// ###BEGIN###{!FileSaver}
x += amtstack.amtauth.CertificatesDer[i].length + " bytes";
// ###END###{!FileSaver}
}
x += '</table>';
setDialogMode(11, "Authentic CSME", 1, null, x);
}
// ###BEGIN###{FileSaver}
function downloadAuthCert(h) {
h = parseInt(h);
// ###BEGIN###{!Mode-NodeWebkit}
saveAs(data2blob(amtstack.amtauth.CertificatesDer[h]), amtstack.amtauth.Certificates[h].subject.getField('CN').value + '.cer');
// ###END###{!Mode-NodeWebkit}
// ###BEGIN###{Mode-NodeWebkit}
var chooser = document.createElement('input');
chooser.setAttribute('type', 'file');
chooser.setAttribute('nwsaveas', amtstack.amtauth.Certificates[h].subject.getField('CN').value + '.cer');
chooser.addEventListener('change', function () { require('fs').writeFile(this.value, amtstack.amtauth.CertificatesDer[h], 'binary', function () { }); }, false);
chooser.click();
// ###END###{Mode-NodeWebkit}
}
// ###END###{FileSaver}
// ###BEGIN###{WsmanBrowser}
// ###BEGIN###{FileSaver}
var IntelAmtEntireState;
@@ -6235,7 +6293,7 @@
if (certificateStore.length > 0) {
x += '<div id=dxcertfileop2><div style=height:26px;margin-top:4px><select id=certhandle style=float:right;width:260px>';
for (var i in certificateStore) {
var certificate = certificateStore[i], name = certificate.cert.subject.getField('CN').value
var certificate = certificateStore[i], name = certificate.cert.subject.getField('CN').value;
x += '<option value=' + certificate['h'] + '>' + name + '</option>';
}
x += '</select><div style=padding-top:4px>' + "Certificate" + '</div></div></div>';