mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-14 16:24:59 -05:00
Updated MeshCentral Router
This commit is contained in:
parent
f3227b7e4e
commit
11bccf0af1
Binary file not shown.
@ -966,6 +966,14 @@ function createMeshCore(agent) {
|
|||||||
process.coreDumpLocation = null;
|
process.coreDumpLocation = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'getcoredump':
|
||||||
|
var r = { action: 'getcoredump', value: (process.coreDumpLocation != null) };
|
||||||
|
if (process.platform == 'win32') {
|
||||||
|
r.exists = r.value ? fs.existsSync(process.coreDumpLocation) : false;
|
||||||
|
} else {
|
||||||
|
r.exists = (r.value && (process.cwd() != '//')) ? fs.existsSync(process.cwd() + 'core') : false;
|
||||||
|
}
|
||||||
|
mesh.SendCommand(JSON.stringify(r));
|
||||||
default:
|
default:
|
||||||
// Unknown action, ignore it.
|
// Unknown action, ignore it.
|
||||||
break;
|
break;
|
||||||
@ -2284,6 +2292,13 @@ function createMeshCore(agent) {
|
|||||||
break;
|
break;
|
||||||
case 'status':
|
case 'status':
|
||||||
response = 'coredump is: ' + ((process.coreDumpLocation == null) ? 'off' : 'on');
|
response = 'coredump is: ' + ((process.coreDumpLocation == null) ? 'off' : 'on');
|
||||||
|
if (process.coreDumpLocation != null) {
|
||||||
|
if (process.platform == 'win32') {
|
||||||
|
if (fs.existsSync(process.coreDumpLocation)) { response += '\r\n CoreDump present at: ' + process.coreDumpLocation; }
|
||||||
|
} else {
|
||||||
|
if ((process.cwd() != '//') && fs.existsSync(process.cwd() + 'core')) { response += '\r\n CoreDump present at: ' + process.cwd() + 'core'; }
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
response = "Proper usage: coredump on|off|status"; // Display usage
|
response = "Proper usage: coredump on|off|status"; // Display usage
|
||||||
|
10
meshagent.js
10
meshagent.js
@ -978,6 +978,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
// Set agent core dump
|
// Set agent core dump
|
||||||
if ((parent.parent.config.settings != null) && ((parent.parent.config.settings.agentcoredump === true) || (parent.parent.config.settings.agentcoredump === false))) {
|
if ((parent.parent.config.settings != null) && ((parent.parent.config.settings.agentcoredump === true) || (parent.parent.config.settings.agentcoredump === false))) {
|
||||||
obj.send(JSON.stringify({ action: 'coredump', value: parent.parent.config.settings.agentcoredump }));
|
obj.send(JSON.stringify({ action: 'coredump', value: parent.parent.config.settings.agentcoredump }));
|
||||||
|
if (parent.parent.config.settings.agentcoredump === true) { obj.send(JSON.stringify({ action: 'getcoredump' })); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do this if IP location is enabled on this domain TODO: Set IP location per device group?
|
// Do this if IP location is enabled on this domain TODO: Set IP location per device group?
|
||||||
@ -1368,6 +1369,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
obj.updateSessions();
|
obj.updateSessions();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'getcoredump': {
|
||||||
|
// Indicates if the agent has a coredump available
|
||||||
|
if (command.exists === true) {
|
||||||
|
//console.log('CoreDump for agent ' + obj.remoteaddrport);
|
||||||
|
obj.coreDumpPresent = true;
|
||||||
|
// TODO: We need to look at getting the dump uploaded to the server.
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'plugin': {
|
case 'plugin': {
|
||||||
if ((parent.parent.pluginHandler == null) || (typeof command.plugin != 'string')) break;
|
if ((parent.parent.pluginHandler == null) || (typeof command.plugin != 'string')) break;
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user