added 'eval' and 'setdebug' console commands to recovery core
Bryan Roe committed
Jan 17, 2021 at 18:43 UTC
74ffd77eda793847d2141d42e87aca0bb2f118f5
1 file changed
+18
-1
agents/recoverycore.js
+18
-1
@@ -896,7 +896,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
896
var response = null;
897
switch (cmd) {
898
case 'help':
899
- response = "Available commands are: agentupdate, dbkeys, dbget, dbset, dbcompact, netinfo, osinfo, versions.";
899
+ response = "Available commands are: agentupdate, dbkeys, dbget, dbset, dbcompact, eval, netinfo, osinfo, setdebug, versions.";
900
break;
901
case 'versions':
902
response = JSON.stringify(process.versions, null, ' ');
@@ -909,6 +909,23 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
909
// Perform an direct agent update without requesting any information from the server, this should not typically be used.
910
agentUpdate_Start(null, { sessionid: sessionid });
911
break;
912
+ case 'eval':
913
+ { // Eval JavaScript
914
+ if (args['_'].length < 1)
915
+ {
916
+ response = 'Proper usage: eval "JavaScript code"'; // Display correct command usage
917
+ } else
918
+ {
919
+ response = JSON.stringify(mesh.eval(args['_'][0])); // This can only be run by trusted administrator.
920
+ }
921
+ break;
922
+ }
923
+ case 'setdebug':
924
+ {
925
+ if (args['_'].length < 1) { response = 'Proper usage: setdebug (target), 0 = Disabled, 1 = StdOut, 2 = This Console, * = All Consoles, 4 = WebLog, 8 = Logfile'; } // Display usage
926
+ else { if (args['_'][0] == '*') { console.setDestination(2); } else { console.setDestination(parseInt(args['_'][0]), sessionid); } }
927
+ break;
928
+ }
929
case 'osinfo': { // Return the operating system information
930
var i = 1;
931
if (args['_'].length > 0) { i = parseInt(args['_'][0]); if (i > 8) { i = 8; } response = 'Calling ' + i + ' times.'; }