diff --git a/agents/meshcore.js b/agents/meshcore.js index c6f00853..d8e62c6c 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1262,6 +1262,9 @@ function handleServerCommand(data) { // Requestion details information about a process if (data.pid) { var info = {}; // TODO: Replace with real data. Feel free not to give all values if not available. + try { + info = processManager.getProcessInfo(data.pid); + }catch(e){ } /* info.processUser = "User"; // String info.processDomain = "Domain"; // String diff --git a/public/scripts/common-0.0.1.js b/public/scripts/common-0.0.1.js index f25c3bb5..8adba78c 100644 --- a/public/scripts/common-0.0.1.js +++ b/public/scripts/common-0.0.1.js @@ -150,4 +150,30 @@ function check_webp_feature(feature, callback) { callback(feature, false); }; img.src = 'data:image/webp;base64,' + kTestImages[feature]; -} \ No newline at end of file +} + +// camelCase converter for JSON +function jsonToCamel(o) { + var newO, origKey, newKey, value + if (o instanceof Array) { + return o.map(function(value) { + if (typeof value === "object") { + value = jsonToCamel(value) + } + return value + }) + } else { + newO = {} + for (origKey in o) { + if (o.hasOwnProperty(origKey)) { + newKey = (origKey.charAt(0).toLowerCase() + origKey.slice(1) || origKey).toString() + value = o[origKey] + if (value instanceof Array || (value !== null && value.constructor === Object)) { + value = jsonToCamel(value) + } + newO[newKey] = value + } + } + } + return newO + } \ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 04386b8b..dc5edaf3 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2627,6 +2627,11 @@ var x = '
'; //x += addHtmlValue4("Process ID", message.pid); if ((typeof message.value == 'object') && (Object.keys(message.value).length > 0)) { + // lets fix agent psinfo not being camelcase + message.value = jsonToCamel(message.value); + if(!message.value.cmd && message.value.path){ message.value.cmd = message.value.path } + if(!message.value.processUser && message.value.userName){ message.value.processUser = message.value.userName.split("\\")[1]; } + if(!message.value.processDomain && message.value.userName){ message.value.processDomain = message.value.userName.split("\\")[0]; } if (message.value.processName) { x += '
' + "Process Name" + '
' + message.value.processName + '
'; } if (message.value.machineName) { x += addHtmlValue5("Machine Name", message.value.machineName); } if (message.value.cmd) { x += '
' + "Command Line" + '
' + message.value.cmd + '
'; }