Added Intel AMT information export for selected device group action.
Ylian Saint-Hilaire committed
Jul 9, 2021 at 09:55 UTC
5bfc26c05f383f9c1a674345356a42612095d0f7
1 file changed
+21
-3
views/default.handlebars
+21
-3
@@ -2529,7 +2529,6 @@
2529
if (message.localport) { url += '&localport=' + message.localport; }
2530
if (message.ip != null) { url += ('&remoteip=' + message.ip); }
2531
url += ('&appid=' + message.protocol + '&autoexit=1'); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP, 6 = MCRDesktop, 7 = MCRFiles
2532
- console.log(url);
2532
downloadFile(url, '');
2533
} else if (message.tag == 'novnc') {
2534
var vncurl = window.location.origin + domainUrl + 'novnc/vnc.html?ws=wss%3A%2F%2F' + window.location.host + encodeURIComponentEx(domainUrl) + (message.localRelay?'local':'mesh') + 'relay.ashx%3Fauth%3D' + message.cookie + '&show_dot=1' + (urlargs.key?('&key=' + urlargs.key):'') + '&l={{{lang}}}';
@@ -5165,9 +5164,12 @@
5164
5165
function p2downloadDeviceInfo() {
5166
if (xxdialogMode) return;
5167
+ var chkNodeIds = getCheckedDevices(), intelamtpresent = false;
5168
+ for (var i in chkNodeIds) { if (getNodeFromId(chkNodeIds[i]).intelamt != null) { intelamtpresent = true; } }
5169
var x = "Download the list of devices with one of the file formats below." + '<br /><br />';
5170
x += addHtmlValue("CSV Format", '<a href=# style=cursor:pointer onclick=\'return p2downloadDeviceInfoCSV()\'>' + "devicelist.csv" + '</a>');
5171
x += addHtmlValue("JSON Format", '<a href=# style=cursor:pointer onclick=\'return p2downloadDeviceInfoJSON()\'>' + "devicelist.json" + '</a>');
5172
+ if (intelamtpresent) { x += addHtmlValue("Intel® AMT JSON", '<a href=# style=cursor:pointer onclick=\'return p2downloadAmtInfoJSON()\'>' + "computerlist.json" + '</a>'); }
5173
x += '<div style=margin-top:8px><label><input type=checkbox id=d2DevInfoDetailsCheck />' + "Include device details" + '</label></div>';
5174
setDialogMode(2, "Device Information Export", 1, null, x);
5175
}
@@ -5202,6 +5204,22 @@
5204
return false;
5205
}
5206
5207
+ // Download information about selected Intel AMT devices.
5208
+ function p2downloadAmtInfoJSON() {
5209
+ var chkNodeIds = getCheckedDevices();
5210
+ var r = { webappversion: '0.9.0', computers: [ ] };
5211
+ for (var i in chkNodeIds) {
5212
+ var node = getNodeFromId(chkNodeIds[i]);
5213
+ if (node.intelamt == null) continue;
5214
+ var c = { name: node.name, host: node.host, user: node.intelamt.user, pass: '', tls: (node.intelamt.tls == 1)?1:0, ver: node.intelamt.ver, pstate: node.intelamt.state }
5215
+ if (node.intelamt.state == 2) { c.pmode = 1; } // TODO
5216
+ if (node.intelamt.realm) { c.digestrealm = node.intelamt.realm; }
5217
+ if (node.intelamt.hash) { c.tlscerthash = node.intelamt.hash; }
5218
+ r.computers.push(c);
5219
+ }
5220
+ saveAs(new Blob([JSON.stringify(r, null, 2)], { type: 'application/octet-stream' }), "computerlist.json");
5221
+ }
5222
+
5223
function p2downloadDeviceInfoJSON() {
5224
var chkNodeIds = getCheckedDevices();
5225
if (Q('d2DevInfoDetailsCheck').checked) {
@@ -11162,7 +11180,7 @@
11180
// Save the list of devices in a device group in the MeshCommander format
11181
function meshDownloadDeviceList() {
11182
if (xxdialogMode) return;
11165
- var r = { webappversion: "0.9.0", computers: [ ] };
11183
+ var r = { webappversion: '0.9.0', computers: [ ] };
11184
for (var i in nodes) {
11185
var node = nodes[i];
11186
if ((currentMesh._id != node.meshid) || (node.intelamt == null)) continue;
@@ -11172,7 +11190,7 @@
11190
if (node.intelamt.hash) { c.tlscerthash = node.intelamt.hash; }
11191
r.computers.push(c);
11192
}
11175
- saveAs(stringToUtf8BlobNoHeader(JSON.stringify(r, null, 2)), currentMesh.name + ".json");
11193
+ saveAs(stringToUtf8BlobNoHeader(JSON.stringify(r, null, 2)), currentMesh.name + '.json');
11194
}
11195
11196
// Import a list of devices into the Intel AMT only device group