mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	add agent psinfo (#5476)
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
		
							parent
							
								
									2173921f07
								
							
						
					
					
						commit
						e0d73b2fcd
					
				
					 3 changed files with 35 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -151,3 +151,29 @@ function check_webp_feature(feature, callback) {
 | 
			
		|||
    };
 | 
			
		||||
    img.src = 'data:image/webp;base64,' + kTestImages[feature];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -2627,6 +2627,11 @@
 | 
			
		|||
                                    var x = '<div style=max-height:200px;overflow-y:auto>';
 | 
			
		||||
                                    //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 += '<div style=padding:4px><div style=padding-bottom:4px>' + "Process Name" + '</div><div style=word-wrap:break-word;padding-left:6px><b>' + message.value.processName + '</b></div></div>'; }
 | 
			
		||||
                                        if (message.value.machineName) { x += addHtmlValue5("Machine Name", message.value.machineName); }
 | 
			
		||||
                                        if (message.value.cmd) { x += '<div style=padding:4px><div style=padding-bottom:4px>' + "Command Line" + '</div><div style=word-wrap:break-word;padding-left:6px><b>' + message.value.cmd + '</b></div></div>'; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue