mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-26 06:03:15 -05:00
Added --filterid to listdevice in meshctrl.js
This commit is contained in:
parent
bfffdfd8f4
commit
3b2ef66dcd
@ -1716,13 +1716,13 @@ module.exports.CreateAmtManager = function (parent) {
|
|||||||
// We are not activated now, go to ACM directly.
|
// We are not activated now, go to ACM directly.
|
||||||
// If this is Intel AMT 14 or better, we are going to attempt a host-based end-to-end TLS activation.
|
// If this is Intel AMT 14 or better, we are going to attempt a host-based end-to-end TLS activation.
|
||||||
if (typeof dev.intelamt.ver == 'string') { var verSplit = dev.intelamt.ver.split('.'); if (verSplit.length >= 3) { dev.aquired.majorver = parseInt(verSplit[0]); dev.aquired.minorver = parseInt(verSplit[1]); } }
|
if (typeof dev.intelamt.ver == 'string') { var verSplit = dev.intelamt.ver.split('.'); if (verSplit.length >= 3) { dev.aquired.majorver = parseInt(verSplit[0]); dev.aquired.minorver = parseInt(verSplit[1]); } }
|
||||||
//if (dev.aquired.majorver >= 14) {
|
if (dev.aquired.majorver >= 14) {
|
||||||
// Perform host-based TLS ACM activation
|
// Perform host-based TLS ACM activation
|
||||||
//activateIntelAmtTlsAcm(dev, mesh.amt.password, acminfo);
|
activateIntelAmtTlsAcm(dev, mesh.amt.password, acminfo);
|
||||||
//} else {
|
} else {
|
||||||
// Perform host-based ACM activation
|
// Perform host-based ACM activation
|
||||||
activateIntelAmtAcm(dev, mesh.amt.password, acminfo);
|
activateIntelAmtAcm(dev, mesh.amt.password, acminfo);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
meshctrl.js
23
meshctrl.js
@ -368,6 +368,7 @@ if (args['_'].length == 0) {
|
|||||||
console.log(" --count - Only return the device count.");
|
console.log(" --count - Only return the device count.");
|
||||||
console.log(" --json - Show result as JSON.");
|
console.log(" --json - Show result as JSON.");
|
||||||
console.log(" --csv - Show result as comma seperated values.");
|
console.log(" --csv - Show result as comma seperated values.");
|
||||||
|
console.log(" --filterid [id,id...] - Show only results for devices with included id.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'listusersofdevicegroup': {
|
case 'listusersofdevicegroup': {
|
||||||
@ -1795,6 +1796,28 @@ function serverConnect() {
|
|||||||
if ((data.result != null) && (data.result != 'ok')) {
|
if ((data.result != null) && (data.result != 'ok')) {
|
||||||
console.log(data.result);
|
console.log(data.result);
|
||||||
} else {
|
} else {
|
||||||
|
// Filder devices based on device id.
|
||||||
|
if (args.filterid) {
|
||||||
|
var filteridSplit = args.filterid.split(','), filters = [];
|
||||||
|
for (var i in filteridSplit) {
|
||||||
|
var f = filteridSplit[i].trim();
|
||||||
|
var g = f.split('/'); // If there is any / in the id, just grab the last part.
|
||||||
|
if (g.length > 0) { f = g[g.length - 1]; }
|
||||||
|
if (f != '') { filters.push(f); }
|
||||||
|
}
|
||||||
|
if (filters.length > 0) {
|
||||||
|
for (var mid in data.nodes) {
|
||||||
|
var filteredNodes = [];
|
||||||
|
for (var nid in data.nodes[mid]) {
|
||||||
|
var n = data.nodes[mid][nid], match = false;
|
||||||
|
for (var f in filters) { if (n._id.indexOf(filters[f]) >= 0) { match = true; } }
|
||||||
|
if (match) { filteredNodes.push(n); }
|
||||||
|
}
|
||||||
|
data.nodes[mid] = filteredNodes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args.csv) {
|
if (args.csv) {
|
||||||
// Return a flat list
|
// Return a flat list
|
||||||
var nodecount = 0;
|
var nodecount = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user