Added server setting for agent core dump.

This commit is contained in:
Ylian Saint-Hilaire 2020-07-06 16:01:44 -07:00
parent 984ce8b201
commit 35e2e0cd20
5 changed files with 3506 additions and 47 deletions

View File

@ -958,6 +958,14 @@ function createMeshCore(agent) {
try { require(data.plugin).consoleaction(data, data.rights, data.sessionid, this); } catch (e) { throw e; }
break;
}
case 'coredump':
if (data.value === true) {
// TODO: This replace() below is not ideal, would be better to remove the .exe at the end instead of replace.
process.coreDumpLocation = (process.platform == 'win32') ? (process.execPath.replace('.exe', '.dmp')) : (process.execPath + '.dmp');
} else if (data.value === false) {
process.coreDumpLocation = null;
}
break;
default:
// Unknown action, ignore it.
break;
@ -2261,16 +2269,13 @@ function createMeshCore(agent) {
break;
}
case 'coredump':
if (args['_'].length != 1)
{
if (args['_'].length != 1) {
response = "Proper usage: coredump on|off|status"; // Display usage
}
else
{
} else {
switch (args['_'][0].toLowerCase())
{
case 'on':
process.coreDumpLocation = process.platform == 'win32' ? (process.execPath.replace('.exe', '.dmp')) : (process.execPath + '.dmp');
process.coreDumpLocation = (process.platform == 'win32') ? (process.execPath.replace('.exe', '.dmp')) : (process.execPath + '.dmp');
response = 'coredump is now on';
break;
case 'off':
@ -2278,7 +2283,7 @@ function createMeshCore(agent) {
response = 'coredump is now off';
break;
case 'status':
response = 'coredump is: ' + (process.coreDumpLocation == null ? 'off' : 'on');
response = 'coredump is: ' + ((process.coreDumpLocation == null) ? 'off' : 'on');
break;
default:
response = "Proper usage: coredump on|off|status"; // Display usage
@ -2789,34 +2794,6 @@ function createMeshCore(agent) {
}
break;
}
case 'dump':
if (args['_'].length < 1) {
response = 'Proper usage: dump [on/off/status]'; // Display correct command usage
}
else {
switch (args['_'][0].toLowerCase()) {
case 'on':
process.coreDumpLocation = process.platform == 'win32' ? process.execPath.replace('.exe', '.dmp') : (process.execPath + '.dmp');
response = 'enabled';
break;
case 'off':
process.coreDumpLocation = null;
response = 'disabled';
break;
case 'status':
if (process.coreDumpLocation) {
response = 'Core Dump: [ENABLED' + (require('fs').existsSync(process.coreDumpLocation) ? (', (DMP file exists)]') : (']'));
}
else {
response = 'Core Dump: [DISABLED]';
}
break;
default:
response = 'Proper usage: dump [on/off/status]'; // Display correct command usage
break;
}
}
break;
case 'eval': { // Eval JavaScript
if (args['_'].length < 1) {
response = 'Proper usage: eval "JavaScript code"'; // Display correct command usage

3474
agents/meshcore.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -975,6 +975,11 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
if ((results != null) && (results.length == 1)) { obj.send(JSON.stringify({ action: 'sysinfo', hash: results[0].hash })); } else { obj.send(JSON.stringify({ action: 'sysinfo' })); }
});
// Set agent core dump
if ((parent.parent.config.settings.agentcoredump === true) || (parent.parent.config.settings.agentcoredump === false)) {
obj.send(JSON.stringify({ action: 'coredump', value: parent.parent.config.settings.agentcoredump }));
}
// Do this if IP location is enabled on this domain TODO: Set IP location per device group?
if (domain.iplocation == true) {
// Check if we already have IP location information for this node
@ -1270,7 +1275,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.dbMeshKey, [obj.dbNodeKey]), obj, event);
// Update the device Intel AMT information
ChangeAgentCoreInfo({ "intelamt": { user: 'admin', pass: amtpassword, uuid: command.uuid, realm: command.realm } });
ChangeAgentCoreInfo({ 'intelamt': { user: 'admin', pass: amtpassword, uuid: command.uuid, realm: command.realm } });
// Send the activation response
obj.send(JSON.stringify(signResponse));

View File

@ -12480,11 +12480,7 @@
"nl": "even wachten, reset e-mail verzonden.",
"pt": "Aguarde, redefina o email enviado.",
"ru": "Подождите, письмо для сброса отправлено.",
"zh-chs": "稍等,重置已發送的郵件。",
"xloc": [
"login-mobile.handlebars->5->1",
"login.handlebars->5->1"
]
"zh-chs": "稍等,重置已發送的郵件。"
},
{
"cs": "Drží se jeden záznam pro kopii",
@ -12871,6 +12867,13 @@
"default.handlebars->27->883"
]
},
{
"en": "If valid, reset mail sent.",
"xloc": [
"login-mobile.handlebars->5->1",
"login.handlebars->5->1"
]
},
{
"cs": "Pokud jste tento požadavek nezačali, ignorujte tento e-mail.",
"de": "Wenn Sie diese Anfrage nicht initiiert haben, ignorieren Sie diese Mail bitte.",

View File

@ -6959,7 +6959,7 @@
for (var i in p) {
if (p[i].p != 0) {
var c = p[i].c;
if (c.length > 30) { c = '<span title="' + EscapeHtml(c) + '">' + EscapeHTML(c.substring(0,30)) + '...</span>' } else { c = EscapeHtml(c); }
if (c.length > 30) { c = '<span title="' + EscapeHtml(c) + '">' + EscapeHtml(c.substring(0,30)) + '...</span>' } else { c = EscapeHtml(c); }
x += '<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>' + EscapeHtml(p[i].p) + '</div><a href=# style=float:right;padding-right:5px;cursor:pointer title="' + "Stop process" + '" onclick=\'return stopProcess(' + EscapeHtml(p[i].p) + ',"' + EscapeHtml(p[i].c) + '")\'><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>' + (p[i].u ? EscapeHtml(p[i].u) : '') + '</div><div>' + c + '</div></div>';
}
}
@ -7555,7 +7555,7 @@
} else {
var link = shortname;
if (f.s > 0) { link = '<a href=# style=cursor:pointer onclick="return p13downloadfile(\'' + encodeURIComponentEx(newlinkpath + '/' + name) + '\',\'' + encodeURIComponentEx(name) + '\',' + f.s + ')">' + shortname + '</a>'; }
h = '<div id=fileEntry cmenu=filesContextMenu fileIndex=' + i + ' class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value=\'' + f.nx + '\'>&nbsp;<span class=fsize>' + fdatestr + '</span><span style=float:right>' + EscapeHTML(fsize) + '</span><span><div class=fileIcon' + f.t + '></div>' + link + '</span></div>';
h = '<div id=fileEntry cmenu=filesContextMenu fileIndex=' + i + ' class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value=\'' + f.nx + '\'>&nbsp;<span class=fsize>' + fdatestr + '</span><span style=float:right>' + EscapeHtml(fsize) + '</span><span><div class=fileIcon' + f.t + '></div>' + link + '</span></div>';
}
if (f.t < 3) { html1 += h; } else { html2 += h; }