mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Updated Windows/OSX agent.
This commit is contained in:
parent
f97bf52f9c
commit
5dc73795e5
14 changed files with 2237 additions and 50 deletions
|
@ -172,11 +172,14 @@ function lme_heci(options) {
|
|||
{ // Bind a new server socket if not already present
|
||||
this[name][port] = require('net').createServer();
|
||||
this[name][port].HECI = this;
|
||||
if (lme_port_offset == 0) {
|
||||
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
|
||||
} else {
|
||||
this[name][port].listen({ port: (port + lme_port_offset) }); // Debug mode
|
||||
}
|
||||
|
||||
try {
|
||||
if (lme_port_offset == 0) {
|
||||
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
|
||||
} else {
|
||||
this[name][port].listen({ port: (port + lme_port_offset) }); // Debug mode
|
||||
}
|
||||
} catch (ex) { console.log('Binding error, LMS port ' + (port + lme_port_offset) + ': ' + ex) } // TODO: We can't bind
|
||||
this[name][port].on('connection', function (socket) {
|
||||
//console.log('New [' + socket.remoteFamily + '] TCP Connection on: ' + socket.remoteAddress + ' :' + socket.localPort);
|
||||
this.HECI.LMS.bindDuplexStream(socket, socket.remoteFamily, socket.localPort - lme_port_offset);
|
||||
|
|
2163
agents/modules_meshcore/duktape-debugger.jsx
Normal file
2163
agents/modules_meshcore/duktape-debugger.jsx
Normal file
File diff suppressed because one or more lines are too long
|
@ -55,56 +55,74 @@ function monitorinfo()
|
|||
else if(process.platform == 'linux')
|
||||
{
|
||||
// First thing we need to do, is determine where the X11 libraries are
|
||||
var fs = require('fs');
|
||||
var files = fs.readdirSync('/usr/lib');
|
||||
var files2;
|
||||
|
||||
/*
|
||||
for (j in files)
|
||||
var askOS = false;
|
||||
try
|
||||
{
|
||||
if (files[j].split('libX11.so.').length > 1 && files[j].split('.').length == 3)
|
||||
if (require('user-sessions').isRoot()) { askOS = true; }
|
||||
}
|
||||
catch (e)
|
||||
{ }
|
||||
|
||||
if (askOS)
|
||||
{
|
||||
// Sufficient access rights to use ldconfig
|
||||
var p = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
p.stdout._lines = '';
|
||||
p.stdout.on('data', function (chunk) { this._lines += chunk.toString(); });
|
||||
p.stdin.write('ldconfig -v\nexit\n');
|
||||
p.waitExit();
|
||||
|
||||
var paths = p.stdout._lines.split('\n');
|
||||
var searchPath = '';
|
||||
for (var i in paths)
|
||||
{
|
||||
Object.defineProperty(this, 'Location_X11LIB', { value: '/usr/lib/' + files[j] });
|
||||
}
|
||||
if (files[j].split('libXtst.so.').length > 1 && files[j].split('.').length == 3)
|
||||
{
|
||||
Object.defineProperty(this, 'Location_X11TST', { value: '/usr/lib/' + files[j] });
|
||||
}
|
||||
if (files[j].split('libXext.so.').length > 1 && files[j].split('.').length == 3)
|
||||
{
|
||||
Object.defineProperty(this, 'Location_X11EXT', { value: '/usr/lib/' + files[j] });
|
||||
if (paths[i].endsWith(':'))
|
||||
{
|
||||
searchPath = paths[i].substring(0, paths[i].length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (paths[i].split('libX11.').length > 1) { Object.defineProperty(this, 'Location_X11LIB', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); }
|
||||
if (paths[i].split('libXtst.').length > 1) { Object.defineProperty(this, 'Location_X11TST', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); }
|
||||
if (paths[i].split('libXext.').length > 1) { Object.defineProperty(this, 'Location_X11EXT', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); }
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (var i in files)
|
||||
else
|
||||
{
|
||||
try {
|
||||
if (files[i].split('libX11.so.').length > 1 && files[i].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11LIB', { value: '/usr/lib/' + files[i] });
|
||||
}
|
||||
if (files[i].split('libXtst.so.').length > 1 && files[i].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11TST', { value: '/usr/lib/' + files[i] });
|
||||
}
|
||||
if (files[i].split('libXext.so.').length > 1 && files[i].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11EXT', { value: '/usr/lib/' + files[i] });
|
||||
}
|
||||
// Not enough access rights to use ldconfig, so manually search
|
||||
var fs = require('fs');
|
||||
var files = fs.readdirSync('/usr/lib');
|
||||
var files2;
|
||||
|
||||
if (files[i].split('-linux-').length > 1) {
|
||||
files2 = fs.readdirSync('/usr/lib/' + files[i]);
|
||||
for (j in files2) {
|
||||
if (files2[j].split('libX11.so.').length > 1 && files2[j].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11LIB', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
|
||||
}
|
||||
if (files2[j].split('libXtst.so.').length > 1 && files2[j].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11TST', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
|
||||
}
|
||||
if (files2[j].split('libXext.so.').length > 1 && files2[j].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11EXT', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
|
||||
for (var i in files) {
|
||||
try {
|
||||
if (files[i].split('libX11.so.').length > 1 && files[i].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11LIB', { value: '/usr/lib/' + files[i] });
|
||||
}
|
||||
if (files[i].split('libXtst.so.').length > 1 && files[i].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11TST', { value: '/usr/lib/' + files[i] });
|
||||
}
|
||||
if (files[i].split('libXext.so.').length > 1 && files[i].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11EXT', { value: '/usr/lib/' + files[i] });
|
||||
}
|
||||
|
||||
if (files[i].split('-linux-').length > 1) {
|
||||
files2 = fs.readdirSync('/usr/lib/' + files[i]);
|
||||
for (j in files2) {
|
||||
if (files2[j].split('libX11.so.').length > 1 && files2[j].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11LIB', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
|
||||
}
|
||||
if (files2[j].split('libXtst.so.').length > 1 && files2[j].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11TST', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
|
||||
}
|
||||
if (files2[j].split('libXext.so.').length > 1 && files2[j].split('.').length == 3) {
|
||||
Object.defineProperty(this, 'Location_X11EXT', { value: '/usr/lib/' + files[i] + '/' + files2[j] });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ex) { }
|
||||
} catch (ex) { }
|
||||
}
|
||||
}
|
||||
Object.defineProperty(this, 'kvm_x11_support', { value: (this.Location_X11LIB && this.Location_X11TST && this.Location_X11EXT)?true:false });
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ function UserSessions()
|
|||
self.parent._user32.ACDC_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_ACDC_POWER_SOURCE, 0);
|
||||
self.parent._user32.BATT_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_BATTERY_PERCENTAGE_REMAINING, 0);
|
||||
self.parent._user32.DISP_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_CONSOLE_DISPLAY_STATE, 0);
|
||||
console.log(self.parent._user32.ACDC_H.Val, self.parent._user32.BATT_H.Val, self.parent._user32.DISP_H.Val);
|
||||
//console.log(self.parent._user32.ACDC_H.Val, self.parent._user32.BATT_H.Val, self.parent._user32.DISP_H.Val);
|
||||
}, this);
|
||||
});
|
||||
this._messagepump.on('message', function (msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue