Updated mesh agent

This commit is contained in:
Ylian Saint-Hilaire 2018-04-20 16:05:06 -07:00
parent e8294491cb
commit 61e383795c
22 changed files with 24 additions and 13 deletions

View File

@ -30,7 +30,11 @@
<Compile Include="agents\modules_meshcmd\amt-wsman.js" />
<Compile Include="agents\modules_meshcmd\amt-xml.js" />
<Compile Include="agents\modules_meshcmd\amt.js" />
<Compile Include="agents\modules_meshcmd\process-manager.js" />
<Compile Include="agents\modules_meshcmd\serviceHost.js" />
<Compile Include="agents\modules_meshcmd\serviceManager.js" />
<Compile Include="agents\modules_meshcmd\smbios.js" />
<Compile Include="agents\modules_meshcmd\user-sessions.js" />
<Compile Include="agents\modules_meshcore\amt-lme.js" />
<Compile Include="agents\modules_meshcore\amt-mei.js" />
<Compile Include="agents\modules_meshcore\amt-scanner.js" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -372,7 +372,7 @@ function createMeshCore(agent) {
break;
}
case 'pskill': {
sendConsoleText(JSON.stringify(data));
//sendConsoleText(JSON.stringify(data));
try { process.kill(data.value); } catch (e) { sendConsoleText(JSON.stringify(e)); }
break;
}
@ -856,8 +856,14 @@ function createMeshCore(agent) {
break;
}
case 'toast': {
require('toaster').Toast('MeshCentral', args['_'][0]);
response = 'ok';
if (process.platform == 'win32') {
if (args['_'].length < 1) { response = 'Proper usage: toast "message"'; } else {
require('toaster').Toast('MeshCentral', args['_'][0]);
response = 'ok';
}
} else {
response = 'Only supported on Windows.';
}
break;
}
case 'setdebug': {

View File

@ -266,7 +266,7 @@ function lme_heci(options) {
this.sockets[rChannelId].bufferedStream.emit('readable');
}
} else {
console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_WINDOW_ADJUST');
//console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_WINDOW_ADJUST');
}
break;
case APF_CHANNEL_DATA:

View File

@ -38,13 +38,13 @@ function processManager() {
default:
throw ('Enumerating processes on ' + process.platform + ' not supported');
case 'win32':
var retVal = [];
var retVal = {};
var h = this._kernel32.CreateToolhelp32Snapshot(2, 0);
var info = GM.CreateVariable(304);
info.toBuffer().writeUInt32LE(304, 0);
var nextProcess = this._kernel32.Process32First(h, info);
while (nextProcess.Val) {
retVal.push({ pid: info.Deref(8, 4).toBuffer().readUInt32LE(0), cmd: info.Deref(GM.PointerSize == 4 ? 36 : 44, 260).String });
retVal[info.Deref(8, 4).toBuffer().readUInt32LE(0)] = { cmd: info.Deref(GM.PointerSize == 4 ? 36 : 44, 260).String };
nextProcess = this._kernel32.Process32Next(h, info);
}
if (callback) { callback.apply(this, [retVal]); }
@ -60,7 +60,7 @@ function processManager() {
for (var i = 1; i < arguments.length; ++i) { p.args.push(arguments[i]); }
p.on('exit', function onGetProcesses() {
delete this.Parent._psp[this.pid];
var retVal = [], lines = this.ps.split('\x0D\x0A'), key = {}, keyi = 0;
var retVal = {}, lines = this.ps.split('\x0D\x0A'), key = {}, keyi = 0;
for (var i in lines) {
var tokens = lines[i].split(' ');
var tokenList = [];
@ -69,7 +69,7 @@ function processManager() {
if (i > 0 && tokens[x]) { tokenList.push(tokens[x]); }
}
if ((i > 0) && (tokenList[key.PID])) {
retVal.push({ pid: tokenList[key.PID], user: tokenList[key.USER], cmd: tokenList[key.COMMAND] });
retVal[tokenList[key.PID]] = { user: tokenList[key.USER], cmd: tokenList[key.COMMAND] };
}
}
if (this.callback) {

View File

@ -38,13 +38,13 @@ function processManager() {
default:
throw ('Enumerating processes on ' + process.platform + ' not supported');
case 'win32':
var retVal = [];
var retVal = {};
var h = this._kernel32.CreateToolhelp32Snapshot(2, 0);
var info = GM.CreateVariable(304);
info.toBuffer().writeUInt32LE(304, 0);
var nextProcess = this._kernel32.Process32First(h, info);
while (nextProcess.Val) {
retVal.push({ pid: info.Deref(8, 4).toBuffer().readUInt32LE(0), cmd: info.Deref(GM.PointerSize == 4 ? 36 : 44, 260).String });
retVal[info.Deref(8, 4).toBuffer().readUInt32LE(0)] = { cmd: info.Deref(GM.PointerSize == 4 ? 36 : 44, 260).String };
nextProcess = this._kernel32.Process32Next(h, info);
}
if (callback) { callback.apply(this, [retVal]); }
@ -60,7 +60,7 @@ function processManager() {
for (var i = 1; i < arguments.length; ++i) { p.args.push(arguments[i]); }
p.on('exit', function onGetProcesses() {
delete this.Parent._psp[this.pid];
var retVal = [], lines = this.ps.split('\x0D\x0A'), key = {}, keyi = 0;
var retVal = {}, lines = this.ps.split('\x0D\x0A'), key = {}, keyi = 0;
for (var i in lines) {
var tokens = lines[i].split(' ');
var tokenList = [];
@ -69,7 +69,7 @@ function processManager() {
if (i > 0 && tokens[x]) { tokenList.push(tokens[x]); }
}
if ((i > 0) && (tokenList[key.PID])) {
retVal.push({ pid: tokenList[key.PID], user: tokenList[key.USER], cmd: tokenList[key.COMMAND] });
retVal[tokenList[key.PID]] = { user: tokenList[key.USER], cmd: tokenList[key.COMMAND] };
}
}
if (this.callback) {

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.1.6-v",
"version": "0.1.6-w",
"keywords": [
"Remote Management",
"Intel AMT",

View File

@ -3524,6 +3524,7 @@
if (Q('DeskTools').nodeid != message.nodeid) return;
var p = [], processes = null;
try { processes = JSON.parse(message.value); } catch (e) { }
console.log(processes);
if (processes != null) {
for (var pid in processes) { p.push( { p:parseInt(pid), c:processes[pid].cmd, d:processes[pid].cmd.toLowerCase(), u: processes[pid].user } ); }
if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); }