Fixed MeshCMD

This commit is contained in:
Ylian Saint-Hilaire 2019-03-28 15:56:48 -07:00
parent c6e435f8ca
commit 1185adbffb
15 changed files with 69 additions and 65 deletions

View File

@ -32,7 +32,6 @@
<Compile Include="agents\modules_meshcmd\amt-wsman.js" /> <Compile Include="agents\modules_meshcmd\amt-wsman.js" />
<Compile Include="agents\modules_meshcmd\amt-xml.js" /> <Compile Include="agents\modules_meshcmd\amt-xml.js" />
<Compile Include="agents\modules_meshcmd\amt.js" /> <Compile Include="agents\modules_meshcmd\amt.js" />
<Compile Include="agents\modules_meshcmd\process-manager.js" />
<Compile Include="agents\modules_meshcmd\service-host.js" /> <Compile Include="agents\modules_meshcmd\service-host.js" />
<Compile Include="agents\modules_meshcmd\service-manager.js" /> <Compile Include="agents\modules_meshcmd\service-manager.js" />
<Compile Include="agents\modules_meshcmd\smbios.js" /> <Compile Include="agents\modules_meshcmd\smbios.js" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -121,65 +121,68 @@ function _getChildElementsByTagName(name) { var ret = []; if (this.childNodes !=
function _getChildElementsByTagNameNS(ns, name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name && (ns == '*' || this.childNodes[node].namespace == ns)) { ret.push(this.childNodes[node]); } } } return (ret); } function _getChildElementsByTagNameNS(ns, name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name && (ns == '*' || this.childNodes[node].namespace == ns)) { ret.push(this.childNodes[node]); } } } return (ret); }
function _xmlTraverseAllRec(nodes, func) { for (var i in nodes) { func(nodes[i]); if (nodes[i].childNodes) { _xmlTraverseAllRec(nodes[i].childNodes, func); } } } function _xmlTraverseAllRec(nodes, func) { for (var i in nodes) { func(nodes[i]); if (nodes[i].childNodes) { _xmlTraverseAllRec(nodes[i].childNodes, func); } } }
function _turnToXmlRec(text) { function _turnToXmlRec(text) {
var elementStack = new _treeBuilder(), lastElement = null, x1 = text.split('<'), ret = [], element = null, currentElementName = null; try {
for (var i in x1) { if (text == null) return null;
var x2 = x1[i].split('>'), x3 = x2[0].split(' '), elementName = x3[0]; var elementStack = new _treeBuilder(), lastElement = null, x1 = text.split('<'), ret = [], element = null, currentElementName = null;
if ((elementName.length > 0) && (elementName[0] != '?')) { for (var i in x1) {
if (elementName[0] != '/') { var x2 = x1[i].split('>'), x3 = x2[0].split(' '), elementName = x3[0];
var attributes = [], localName, localname2 = elementName.split(' ')[0].split(':'), localName = (localname2.length > 1) ? localname2[1] : localname2[0]; if ((elementName.length > 0) && (elementName[0] != '?')) {
Object.defineProperty(attributes, "get", if (elementName[0] != '/') {
{ var attributes = [], localName, localname2 = elementName.split(' ')[0].split(':'), localName = (localname2.length > 1) ? localname2[1] : localname2[0];
value: function () { Object.defineProperty(attributes, "get",
if (arguments.length == 1) { {
for (var a in this) { if (this[a].name == arguments[0]) { return (this[a]); } } value: function () {
} if (arguments.length == 1) {
else if (arguments.length == 2) { for (var a in this) { if (this[a].name == arguments[0]) { return (this[a]); } }
for (var a in this) { if (this[a].name == arguments[1] && (arguments[0] == '*' || this[a].namespace == arguments[0])) { return (this[a]); } } }
} else if (arguments.length == 2) {
else { for (var a in this) { if (this[a].name == arguments[1] && (arguments[0] == '*' || this[a].namespace == arguments[0])) { return (this[a]); } }
throw ('attributes.get(): Invalid number of parameters'); }
} else {
} throw ('attributes.get(): Invalid number of parameters');
}); }
elementStack.push({ name: elementName, localName: localName, getChildElementsByTagName: _getChildElementsByTagName, getElementsByTagNameNS: _getElementsByTagNameNS, getChildElementsByTagNameNS: _getChildElementsByTagNameNS, attributes: attributes, childNodes: [], nsTable: {} }); }
// Parse Attributes });
if (x3.length > 0) { elementStack.push({ name: elementName, localName: localName, getChildElementsByTagName: _getChildElementsByTagName, getElementsByTagNameNS: _getElementsByTagNameNS, getChildElementsByTagNameNS: _getChildElementsByTagNameNS, attributes: attributes, childNodes: [], nsTable: {} });
var skip = false; // Parse Attributes
for (var j in x3) { if (x3.length > 0) {
if (x3[j] == '/') { var skip = false;
// This is an empty Element for (var j in x3) {
elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':'))); if (x3[j] == '/') {
elementStack.peek().textContent = ''; // This is an empty Element
lastElement = elementStack.pop(); elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':')));
skip = true; elementStack.peek().textContent = '';
break; lastElement = elementStack.pop();
} skip = true;
var k = x3[j].indexOf('='); break;
if (k > 0) { }
var attrName = x3[j].substring(0, k); var k = x3[j].indexOf('=');
var attrValue = x3[j].substring(k + 2, x3[j].length - 1); if (k > 0) {
var attrNS = elementStack.getNamespace('*'); var attrName = x3[j].substring(0, k);
var attrValue = x3[j].substring(k + 2, x3[j].length - 1);
if (attrName == 'xmlns') { var attrNS = elementStack.getNamespace('*');
elementStack.addNamespace('*', attrValue);
attrNS = attrValue; if (attrName == 'xmlns') {
} else if (attrName.startsWith('xmlns:')) { elementStack.addNamespace('*', attrValue);
elementStack.addNamespace(attrName.substring(6), attrValue); attrNS = attrValue;
} else { } else if (attrName.startsWith('xmlns:')) {
var ax = attrName.split(':'); elementStack.addNamespace(attrName.substring(6), attrValue);
if (ax.length == 2) { attrName = ax[1]; attrNS = elementStack.getNamespace(ax[0]); } } else {
var ax = attrName.split(':');
if (ax.length == 2) { attrName = ax[1]; attrNS = elementStack.getNamespace(ax[0]); }
}
var x = { name: attrName, value: attrValue }
if (attrNS != null) x.namespace = attrNS;
elementStack.peek().attributes.push(x);
} }
var x = { name: attrName, value: attrValue }
if (attrNS != null) x.namespace = attrNS;
elementStack.peek().attributes.push(x);
} }
if (skip) { continue; }
} }
if (skip) { continue; } elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':')));
} if (x2[1]) { elementStack.peek().textContent = x2[1]; }
elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':'))); } else { lastElement = elementStack.pop(); }
if (x2[1]) { elementStack.peek().textContent = x2[1]; } }
} else { lastElement = elementStack.pop(); }
} }
} } catch (ex) { return null; }
return lastElement; return lastElement;
} }

File diff suppressed because one or more lines are too long

View File

@ -121,6 +121,7 @@ function _getChildElementsByTagName(name) { var ret = []; if (this.childNodes !=
function _getChildElementsByTagNameNS(ns, name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name && (ns == '*' || this.childNodes[node].namespace == ns)) { ret.push(this.childNodes[node]); } } } return (ret); } function _getChildElementsByTagNameNS(ns, name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name && (ns == '*' || this.childNodes[node].namespace == ns)) { ret.push(this.childNodes[node]); } } } return (ret); }
function _xmlTraverseAllRec(nodes, func) { for (var i in nodes) { func(nodes[i]); if (nodes[i].childNodes) { _xmlTraverseAllRec(nodes[i].childNodes, func); } } } function _xmlTraverseAllRec(nodes, func) { for (var i in nodes) { func(nodes[i]); if (nodes[i].childNodes) { _xmlTraverseAllRec(nodes[i].childNodes, func); } } }
function _turnToXmlRec(text) { function _turnToXmlRec(text) {
if (text == null) return null;
var elementStack = new _treeBuilder(), lastElement = null, x1 = text.split('<'), ret = [], element = null, currentElementName = null; var elementStack = new _treeBuilder(), lastElement = null, x1 = text.split('<'), ret = [], element = null, currentElementName = null;
for (var i in x1) { for (var i in x1) {
var x2 = x1[i].split('>'), x3 = x2[0].split(' '), elementName = x3[0]; var x2 = x1[i].split('>'), x3 = x2[0].split(' '), elementName = x3[0];

File diff suppressed because one or more lines are too long

View File

@ -1649,8 +1649,7 @@ function InstallModule(modulename, func, tag1, tag2) {
InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 10000 }, function (error, stdout, stderr) { InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 10000 }, function (error, stdout, stderr) {
InstallModuleChildProcess = null; InstallModuleChildProcess = null;
if (error != null) { if (error != null) {
console.log('ERROR: Unable to install missing package \'' + modulename + '\', make sure npm is installed: ' + error); console.log('ERROR: Unable to install required module "' + modulename + '". MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
console.log(stdout);
process.exit(); process.exit();
return; return;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.3.1-p", "version": "0.3.1-q",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

View File

@ -1549,8 +1549,10 @@
meshserver.send({ action: 'otp-hkey-setup-response', response: registrationResponse, name: Q('dp1keyname').value }); meshserver.send({ action: 'otp-hkey-setup-response', response: registrationResponse, name: Q('dp1keyname').value });
setDialogMode(2, "Add Security Key", 0, null, '<br />Checking...<br /><br /><br />', 'otpauth-hardware-manage'); setDialogMode(2, "Add Security Key", 0, null, '<br />Checking...<br /><br /><br />', 'otpauth-hardware-manage');
} else { } else {
var errorCodes = ['', 'Unknown error', 'Bad request', 'Unsupported configuration', 'This key was already registered', 'Timeout']; if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) {
setDialogMode(2, "Add Security Key", 1, null, '<br />' + errorCodes[registrationResponse.errorCode] + '.<br /><br />'); var errorCodes = ['', 'Unknown error', 'Bad request', 'Unsupported configuration', 'This key was already registered', 'Timeout'];
setDialogMode(2, "Add Security Key", 1, null, '<br />' + errorCodes[registrationResponse.errorCode] + '.<br /><br />');
}
} }
}, message.request.timeoutSeconds); }, message.request.timeoutSeconds);
break; break;