diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 474b06c6..5ce6fc57 100644 Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index 64a65689..bd6cbbc1 100644 Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ diff --git a/agents/MeshService-signed.exe b/agents/MeshService-signed.exe index 90ccdfa1..8a4919d4 100644 Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ diff --git a/agents/MeshService.exe b/agents/MeshService.exe index bd34cd78..4a2d671a 100644 Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ diff --git a/agents/MeshService64-signed.exe b/agents/MeshService64-signed.exe index 916997e5..77e190cc 100644 Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ diff --git a/agents/MeshService64.exe b/agents/MeshService64.exe index b76dcb7a..6c00e6a6 100644 Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ diff --git a/agents/meshcmd.js b/agents/meshcmd.js index 748d0093..60b870cf 100644 --- a/agents/meshcmd.js +++ b/agents/meshcmd.js @@ -330,6 +330,8 @@ function run(argv) { amtMei.getEHBCState(function (result) { mestate.ehbc = result; }); amtMei.getControlMode(function (result) { mestate.controlmode = result; }); amtMei.getMACAddresses(function (result) { mestate.mac = result; }); + amtMei.getLanInterfaceSettings(0, function (result) { mestate.net0 = result; }); + amtMei.getLanInterfaceSettings(1, function (result) { mestate.net1 = result; }); amtMei.getDnsSuffix(function (result) { mestate.dns = result; var str = 'Intel AMT v' + mestate.ver; @@ -337,6 +339,9 @@ function run(argv) { else if (mestate.ProvisioningState.stateStr == 'IN') { str += ', in-provisioning state'; } else if (mestate.ProvisioningState.stateStr == 'POST') { if (mestate.ProvisioningMode.modeStr == 'ENTERPRISE') { str += ', activated in ' + ["none", "client control mode", "admin control mode", "remote assistance mode"][mestate.controlmode.controlMode]; } else { str += ', activated in ' + mestate.ProvisioningMode.modeStr; } } if (mestate.ehbc.EHBC == true) { str += ', EHBC enabled'; } + str += '.'; + if (mestate.net0 != null) { str += '\r\nWired ' + ((mestate.net0.enabled == 1) ? 'Enabled' : 'Disabled') + ((mestate.net0.dhcpEnabled == 1) ? ', DHCP' : ', Static') + ', ' + mestate.net0.mac + (mestate.net0.address == '0.0.0.0'?'':(', ' + mestate.net0.address)); } + if (mestate.net1 != null) { str += '\r\nWireless ' + ((mestate.net0.enabled == 1) ? 'Enabled' : 'Disabled') + ((mestate.net0.dhcpEnabled == 1) ? ', DHCP' : ', Static') + ', ' + mestate.net0.mac + (mestate.net0.address == '0.0.0.0' ? '' : (', ' + mestate.net0.address)); } console.log(str + '.'); exit(1); }); @@ -461,7 +466,7 @@ function startMeshCommander() { var ws = socket.upgradeWebSocket(); socket.ws = ws; ws.wsIndex = ++webServer.wsListIndex; - webServer.wsList[ws.wsIndex] = ws; + webServer.wsList[ws.wsIndex] = ws; // Keep a reference so the websocket and forwarder don't get disposed. ws.pause(); // We got a new web socket connection, initiate a TCP connection to the target Intel AMT host/port. @@ -475,16 +480,20 @@ function startMeshCommander() { // If this is TCP (without TLS) set a normal TCP socket var net = require('net'); ws.forwardclient = net.connect({ host: webargs.host, port: webargs.port }) - ws.forwardclient.on('connect', function () { this.pipe(this.ws); this.ws.pipe(this); }); + ws.forwardclient.on('connect', function () { this.pipe(this.ws, { end: false }); this.ws.pipe(this, { end: false }); }); ws.forwardclient.ws = ws; } else { // If TLS is going to be used, setup a TLS socket var tls = require('tls'); var tlsoptions = { host: webargs.host, port: webargs.port, secureProtocol: ((webargs.tls1only == 1) ? 'TLSv1_method' : 'SSLv23_method'), rejectUnauthorized: false }; - ws.forwardclient = tls.connect(tlsoptions, function () { this.pipe(this.ws); this.ws.pipe(this); }); + ws.forwardclient = tls.connect(tlsoptions, function () { this.pipe(this.ws, { end: false }); this.ws.pipe(this, { end: false }); }); ws.forwardclient.ws = ws; } + // Handle pipe closure + ws.on('end', function () { try { this.forwardclient.end(); } catch (e) { } delete webServer.wsList[this.wsIndex]; }); + ws.forwardclient.on('end', function () { try { this.ws.end(); } catch (e) { } }); + break; default: socket.end(); diff --git a/agents/modules_meshcmd/amt-mei.js b/agents/modules_meshcmd/amt-mei.js index d1c50808..16de7862 100644 --- a/agents/modules_meshcmd/amt-mei.js +++ b/agents/modules_meshcmd/amt-mei.js @@ -254,6 +254,46 @@ function amt_heci() { fn.apply(this, opt); }, callback, optional); } + this.getLanInterfaceSettings = function getLanInterfaceSettings(index, callback) + { + var optional = []; + for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } + var ifx = Buffer.alloc(4); + ifx.writeUInt32LE(index); + this.sendCommand(0x48, ifx, function onGetLanInterfaceSettings(header, fn, opt) + { + if(header.Status == 0) + { + var info = {}; + info.enabled = header.Data.readUInt32LE(0); + info.dhcpEnabled = header.Data.readUInt32LE(8); + switch(header.Data[12]) + { + case 1: + info.dhcpMode = 'ACTIVE' + break; + case 2: + info.dhcpMode = 'PASSIVE' + break; + default: + info.dhcpMode = 'UNKNOWN'; + break; + } + info.mac = header.Data.slice(14).toString('hex:'); + + var addr = header.Data.readUInt32LE(4); + info.address = ((addr >> 24) & 255) + '.' + ((addr >> 16) & 255) + '.' + ((addr >> 8) & 255) + '.' + (addr & 255); + opt.unshift(info); + fn.apply(this, opt); + } + else + { + opt.unshift(null); + fn.apply(this, opt); + } + }, callback, optional); + + }; this.unprovision = function unprovision(mode, callback) { var optional = []; for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } diff --git a/package.json b/package.json index 35434dcb..af199d70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.1.5-d", + "version": "0.1.5-e", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default.handlebars b/views/default.handlebars index 4388178b..d750cda0 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -3067,14 +3067,14 @@ } function applyDesktopSettings() { - var r = '', ops = (features & 512)?[100,80,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1]; + var r = '', ops = (features & 512)?[90,70,50,40,30,20,10,5,1]:[50,40,30,20,10,5,1]; for (var i in ops) { r += ''; } QH('d7bitmapquality', r); d7desktopmode.value = desktopsettings.encoding; d7showfocus.checked = desktopsettings.showfocus; d7showcursor.checked = desktopsettings.showmouse; d7bitmapquality.value = 40; // Default value - d7bitmapquality.value = desktopsettings.quality; + if (ops.indexOf(desktopsettings.quality) >= 0) { d7bitmapquality.value = desktopsettings.quality; } d7bitmapscaling.value = desktopsettings.scaling; QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus)); }