mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 12:52:50 +03:00
Improved event logs when running remote commands.
This commit is contained in:
parent
a92b6ed286
commit
ae0be0b8d3
@ -959,7 +959,6 @@ function createMeshCore(agent) {
|
||||
}
|
||||
case 'runcommands': {
|
||||
if (mesh.cmdchild != null) { sendConsoleText("Run commands can't execute, already busy."); break; }
|
||||
MeshServerLogEx(24, null, "Running commands", data);
|
||||
sendConsoleText("Run commands (" + data.runAsUser + "): " + data.cmds);
|
||||
|
||||
// data.runAsUser: 0=Agent,1=UserOrAgent,2=UserOnly
|
||||
|
@ -3642,6 +3642,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
// Send the commands to the agent
|
||||
try { agent.send(JSON.stringify({ action: 'runcommands', type: command.type, cmds: command.cmds, runAsUser: command.runAsUser })); } catch (ex) { }
|
||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } }
|
||||
|
||||
// Send out an event that these commands where run on this device
|
||||
var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]);
|
||||
var msgid = 24; // "Running commands"
|
||||
if (command.type == 1) { msgid = 99; } // "Running commands as user"
|
||||
if (command.type == 2) { msgid = 100; } // "Running commands as user if possible"
|
||||
var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id };
|
||||
parent.parent.DispatchEvent(targets, obj, event);
|
||||
} else {
|
||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid command type' })); } catch (ex) { } }
|
||||
}
|
||||
|
2
public/scripts/amt-wsman-0.2.0-min.js
vendored
2
public/scripts/amt-wsman-0.2.0-min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -10777,7 +10777,9 @@
|
||||
95: "Added security key",
|
||||
96: "Verified phone number of user {0}",
|
||||
97: "Removed phone number of user {0}",
|
||||
98: "Help Requested, user: {0}, details: {1}"
|
||||
98: "Help Requested, user: {0}, details: {1}",
|
||||
99: "Running commands as user",
|
||||
100: "Running commands as user if possible"
|
||||
};
|
||||
|
||||
// Highlights the device being hovered
|
||||
|
Loading…
Reference in New Issue
Block a user