mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-26 16:06:33 +03:00
Added Intel AMT device import to AMT-only device group.
This commit is contained in:
parent
b949fb6346
commit
148fe804bb
@ -3737,6 +3737,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
// Create the new node
|
// Create the new node
|
||||||
nodeid = 'node/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$');
|
nodeid = 'node/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$');
|
||||||
var device = { type: 'node', _id: nodeid, meshid: command.meshid, mtype: 1, icon: 1, name: command.devicename, host: command.hostname, domain: domain.id, intelamt: { user: command.amtusername, pass: command.amtpassword, tls: command.amttls } };
|
var device = { type: 'node', _id: nodeid, meshid: command.meshid, mtype: 1, icon: 1, name: command.devicename, host: command.hostname, domain: domain.id, intelamt: { user: command.amtusername, pass: command.amtpassword, tls: command.amttls } };
|
||||||
|
|
||||||
|
// Add optional feilds
|
||||||
|
if (common.validateInt(command.state, 0, 3)) { device.intelamt.state = command.state; }
|
||||||
|
if (common.validateString(command.ver, 1, 16)) { device.intelamt.ver = command.ver; }
|
||||||
|
if (common.validateString(command.hash, 1, 256)) { device.intelamt.hash = command.hash; }
|
||||||
|
if (common.validateString(command.realm, 1, 256)) { device.intelamt.realm = command.realm; }
|
||||||
|
|
||||||
|
// Save the device to the database
|
||||||
db.Set(device);
|
db.Set(device);
|
||||||
|
|
||||||
// Event the new node
|
// Event the new node
|
||||||
|
18
package.json
18
package.json
@ -36,8 +36,6 @@
|
|||||||
"sample-config-advanced.json"
|
"sample-config-advanced.json"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"archiver": "^4.0.2",
|
|
||||||
"archiver-zip-encrypted": "^1.0.10",
|
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"cbor": "~5.2.0",
|
"cbor": "~5.2.0",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
@ -45,25 +43,17 @@
|
|||||||
"express": "^4.17.0",
|
"express": "^4.17.0",
|
||||||
"express-handlebars": "^3.1.0",
|
"express-handlebars": "^3.1.0",
|
||||||
"express-ws": "^4.0.0",
|
"express-ws": "^4.0.0",
|
||||||
"image-size": "^1.0.0",
|
"html-minifier": "^4.0.0",
|
||||||
"ipcheck": "^0.1.0",
|
"ipcheck": "^0.1.0",
|
||||||
"loadavg-windows": "^1.1.1",
|
"jsdom": "^16.6.0",
|
||||||
|
"minify-js": "0.0.4",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"mongodb": "^3.6.9",
|
|
||||||
"multiparty": "^4.2.1",
|
"multiparty": "^4.2.1",
|
||||||
"nedb": "^1.8.0",
|
"nedb": "^1.8.0",
|
||||||
"node-forge": "^0.10.0",
|
"node-forge": "^0.10.0",
|
||||||
"node-rdpjs-2": "^0.3.5",
|
|
||||||
"node-windows": "^1.0.0-beta.5",
|
|
||||||
"nodemailer": "^6.6.2",
|
|
||||||
"otplib": "^10.2.3",
|
|
||||||
"saslprep": "^1.0.3",
|
|
||||||
"ssh2": "^1.1.0",
|
|
||||||
"web-push": "^3.4.5",
|
|
||||||
"ws": "^5.2.0",
|
"ws": "^5.2.0",
|
||||||
"xmldom": "^0.5.0",
|
"xmldom": "^0.5.0",
|
||||||
"yauzl": "^2.10.0",
|
"yauzl": "^2.10.0"
|
||||||
"yubikeyotp": "^0.2.0"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11121,7 +11121,7 @@
|
|||||||
// Display list of devices in this device group
|
// Display list of devices in this device group
|
||||||
count = 0;
|
count = 0;
|
||||||
nodes.sort(deviceSort);
|
nodes.sort(deviceSort);
|
||||||
var dllist = (currentMesh.mtype == 1)?'<a onclick=meshDownloadDeviceList()><img title="' + "Download device list" + '" src="images/link4.png" /></a>':'';
|
var dllist = (currentMesh.mtype == 1)?'<a onclick=meshDownloadDeviceList()><img title="' + "Download device list" + '" src="images/link4.png" /></a> <a onclick=meshImportDeviceList()><img title="' + "Import device list" + '" src="images/link6.png" /></a>':'';
|
||||||
var y = '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>' + "Devices" + '</th><th scope=col style=text-align:right>' + dllist + '</th></tr>';
|
var y = '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>' + "Devices" + '</th><th scope=col style=text-align:right>' + dllist + '</th></tr>';
|
||||||
for (var i in nodes) {
|
for (var i in nodes) {
|
||||||
var node = nodes[i], gray = ((node.conn > 0)?'':' gray');
|
var node = nodes[i], gray = ((node.conn > 0)?'':' gray');
|
||||||
@ -11129,8 +11129,8 @@
|
|||||||
y += '<tr style=' + (((count % 2) == 0) ? ';background-color:#DDD' : '') + '><td style=width:30%><div onclick=\'gotoDevice("' + node._id + '",10);haltEvent(event);\' style=float:left class="j' + node.icon + gray + '"></div> <a onclick=\'gotoDevice("' + node._id + '",10);haltEvent(event);\'>' + EscapeHtml(node.name) + '</a></div></div></td><td style=width:70%><div style=float:right>' + PowerStateStr(node.pwr) + ' </div><div>' + (node.osdesc ? EscapeHtml(node.osdesc) : '') + '</div></td></tr>';
|
y += '<tr style=' + (((count % 2) == 0) ? ';background-color:#DDD' : '') + '><td style=width:30%><div onclick=\'gotoDevice("' + node._id + '",10);haltEvent(event);\' style=float:left class="j' + node.icon + gray + '"></div> <a onclick=\'gotoDevice("' + node._id + '",10);haltEvent(event);\'>' + EscapeHtml(node.name) + '</a></div></div></td><td style=width:70%><div style=float:right>' + PowerStateStr(node.pwr) + ' </div><div>' + (node.osdesc ? EscapeHtml(node.osdesc) : '') + '</div></td></tr>';
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
if (count == 0) { y += '<tr><td><i>' + "None " + '</i></td></tr>'; }
|
||||||
y += '</tbody></table>';
|
y += '</tbody></table>';
|
||||||
if (count == 0) { y = ''; }
|
|
||||||
|
|
||||||
// If we are full administrator on this mesh, allow deletion of the mesh
|
// If we are full administrator on this mesh, allow deletion of the mesh
|
||||||
if (meshrights == 0xFFFFFFFF) {
|
if (meshrights == 0xFFFFFFFF) {
|
||||||
@ -11169,6 +11169,43 @@
|
|||||||
saveAs(stringToUtf8BlobNoHeader(JSON.stringify(r, null, 2)), currentMesh.name + ".json");
|
saveAs(stringToUtf8BlobNoHeader(JSON.stringify(r, null, 2)), currentMesh.name + ".json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Import a list of devices into the Intel AMT only device group
|
||||||
|
function meshImportDeviceList() {
|
||||||
|
if (xxdialogMode) return;
|
||||||
|
var x = "Import a list of local Intel® AMT devices in MeshCommander JSON format." + '<br /><br /><input style=width:370px type=file id=d4importFile accept=".json" onchange=meshImportDeviceListValidate() />';
|
||||||
|
setDialogMode(2, "Import Intel® AMT Devices", 3, meshImportDeviceListEx, x);
|
||||||
|
QE('idx_dlgOkButton', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function meshImportDeviceListValidate() {
|
||||||
|
QE('idx_dlgOkButton', Q('d4importFile').value != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function meshImportDeviceListEx() {
|
||||||
|
var fr = new FileReader();
|
||||||
|
fr.onload = function (r) {
|
||||||
|
var j = null;
|
||||||
|
try { j = JSON.parse(r.target.result); } catch (ex) { setDialogMode(2, "Import Intel® AMT Devices", 1, null, format("Invalid JSON file: {0}.", ex)); return; }
|
||||||
|
if ((typeof j == 'object') && (typeof j.webappversion == 'string') && (typeof j.computers == 'object') && (Array.isArray(j.computers))) {
|
||||||
|
var ok = 0;
|
||||||
|
for (var k in j.computers) {
|
||||||
|
var computer = j.computers[k];
|
||||||
|
if ((typeof computer.name == 'string') && (typeof computer.host == 'string') && (typeof computer.user == 'string') && (typeof computer.pass == 'string')) {
|
||||||
|
var cmd = { action: 'addamtdevice', meshid: currentMesh._id, devicename: computer.name, hostname: computer.host, amtusername: computer.user, amtpassword: computer.pass, amttls: (computer.tls == 1)?1:0 };
|
||||||
|
if (typeof computer.ver == 'string') { cmd.ver = computer.ver; }
|
||||||
|
if (typeof computer.pstate == 'number') { cmd.state = computer.pstate; }
|
||||||
|
if (typeof computer.digestrealm == 'string') { cmd.realm = computer.digestrealm; }
|
||||||
|
if (typeof computer.tlscerthash == 'string') { cmd.hash = computer.tlscerthash; }
|
||||||
|
meshserver.send(cmd);
|
||||||
|
ok++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok == 0) { setDialogMode(2, "User Account Import", 1, null, "Unable to import any device."); }
|
||||||
|
} else { setDialogMode(2, "Import Intel® AMT Devices", 1, null, "Invalid JSON file format."); }
|
||||||
|
};
|
||||||
|
fr.readAsText(Q('d4importFile').files[0]);
|
||||||
|
}
|
||||||
|
|
||||||
function p20editMeshAmt() {
|
function p20editMeshAmt() {
|
||||||
if (xxdialogMode) return;
|
if (xxdialogMode) return;
|
||||||
var x = '', acmoption = '';
|
var x = '', acmoption = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user