mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-29 00:44:35 +03:00
Merge branch 'master' of https://github.com/Ylianst/MeshCentral
This commit is contained in:
commit
8cd7139c3e
@ -435,9 +435,34 @@ function createMeshCore(agent) {
|
|||||||
if (mesh.isControlChannelConnected) { mesh.SendCommand({ action: 'smbios', value: SMBiosTablesRaw }); }
|
if (mesh.isControlChannelConnected) { mesh.SendCommand({ action: 'smbios', value: SMBiosTablesRaw }); }
|
||||||
|
|
||||||
// If SMBios tables say that Intel AMT is present, try to connect MEI
|
// If SMBios tables say that Intel AMT is present, try to connect MEI
|
||||||
if (SMBiosTables.amtInfo && (SMBiosTables.amtInfo.AMT == true)) {
|
if (SMBiosTables.amtInfo && (SMBiosTables.amtInfo.AMT == true))
|
||||||
|
{
|
||||||
var amtmodule = require('amt-manage');
|
var amtmodule = require('amt-manage');
|
||||||
amt = new amtmodule(mesh, db, false);
|
amt = new amtmodule(mesh, db, false);
|
||||||
|
amt.on('portBinding_LMS', function (map)
|
||||||
|
{
|
||||||
|
var j = { action: 'lmsinfo', value: { ports: map.keys() } };
|
||||||
|
mesh.SendCommand(j);
|
||||||
|
});
|
||||||
|
amt.on('stateChange_LMS', function (v)
|
||||||
|
{
|
||||||
|
if (!meshCoreObj.intelamt) { meshCoreObj.intelamt = {}; }
|
||||||
|
switch(v)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
meshCoreObj.intelamt.microlms = 'DISABLED';
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
meshCoreObj.intelamt.microlms = 'CONNECTING';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
meshCoreObj.intelamt.microlms = 'CONNECTED';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mesh.SendCommand(meshCoreObj);
|
||||||
|
});
|
||||||
amt.onStateChange = function (state) { if (state == 2) { sendPeriodicServerUpdate(1); } }
|
amt.onStateChange = function (state) { if (state == 2) { sendPeriodicServerUpdate(1); } }
|
||||||
if (amtPolicy != null) { amt.setPolicy(amtPolicy); }
|
if (amtPolicy != null) { amt.setPolicy(amtPolicy); }
|
||||||
amt.start();
|
amt.start();
|
||||||
@ -3492,7 +3517,26 @@ function createMeshCore(agent) {
|
|||||||
amt.getAmtInfo(function (meinfo) {
|
amt.getAmtInfo(function (meinfo) {
|
||||||
try {
|
try {
|
||||||
if (meinfo == null) return;
|
if (meinfo == null) return;
|
||||||
var intelamt = {}, p = false;
|
var intelamt = {};
|
||||||
|
if (amt != null)
|
||||||
|
{
|
||||||
|
switch(amt.lmsstate)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
intelamt.microlms = 'DISABLED'
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
intelamt.microlms = 'CONNECTING'
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
intelamt.microlms = 'CONNECTED'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
intelamt.microlms = 'unknown'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var p = false;
|
||||||
if ((meinfo.Versions != null) && (meinfo.Versions.AMT != null)) { intelamt.ver = meinfo.Versions.AMT; p = true; if (meinfo.Versions.Sku != null) { intelamt.sku = parseInt(meinfo.Versions.Sku); } }
|
if ((meinfo.Versions != null) && (meinfo.Versions.AMT != null)) { intelamt.ver = meinfo.Versions.AMT; p = true; if (meinfo.Versions.Sku != null) { intelamt.sku = parseInt(meinfo.Versions.Sku); } }
|
||||||
if (meinfo.ProvisioningState != null) { intelamt.state = meinfo.ProvisioningState; p = true; }
|
if (meinfo.ProvisioningState != null) { intelamt.state = meinfo.ProvisioningState; p = true; }
|
||||||
if (meinfo.Flags != null) { intelamt.flags = meinfo.Flags; p = true; }
|
if (meinfo.Flags != null) { intelamt.flags = meinfo.Flags; p = true; }
|
||||||
|
@ -36,8 +36,38 @@ function AmtManager(agent, db, isdebug) {
|
|||||||
var obj = this;
|
var obj = this;
|
||||||
var mestate;
|
var mestate;
|
||||||
var trustedHashes = null;;
|
var trustedHashes = null;;
|
||||||
|
|
||||||
|
require('events').EventEmitter.call(obj, true)
|
||||||
|
.createEvent('stateChange_LMS')
|
||||||
|
.createEvent('portBinding_LMS');
|
||||||
|
obj._lmsstate = 0;
|
||||||
|
obj._mapping = [];
|
||||||
|
|
||||||
|
obj.on('newListener', function (name, callback)
|
||||||
|
{
|
||||||
|
if(name == 'portBinding_LMS')
|
||||||
|
{
|
||||||
|
callback.call(this, this._mapping);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.defineProperty(obj, 'lmsstate',
|
||||||
|
{
|
||||||
|
get: function ()
|
||||||
|
{
|
||||||
|
return (this._lmsstate);
|
||||||
|
},
|
||||||
|
set: function (value)
|
||||||
|
{
|
||||||
|
if (this._lmsstate != value)
|
||||||
|
{
|
||||||
|
this._lmsstate = value;
|
||||||
|
this.emit('stateChange_LMS', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
obj.state = 0;
|
obj.state = 0;
|
||||||
obj.lmsstate = 0;
|
|
||||||
obj.onStateChange = null;
|
obj.onStateChange = null;
|
||||||
obj.setDebug = function (x) { isdebug = x; }
|
obj.setDebug = function (x) { isdebug = x; }
|
||||||
|
|
||||||
@ -124,7 +154,11 @@ function AmtManager(agent, db, isdebug) {
|
|||||||
amtLms = new lme_heci();
|
amtLms = new lme_heci();
|
||||||
amtLms.on('error', function (e) { amtLmsState = 0; obj.lmsstate = 0; amtLms = null; debug("LMS error: " + e); setupMeiOsAdmin(1); });
|
amtLms.on('error', function (e) { amtLmsState = 0; obj.lmsstate = 0; amtLms = null; debug("LMS error: " + e); setupMeiOsAdmin(1); });
|
||||||
amtLms.on('connect', function () { amtLmsState = 2; obj.lmsstate = 2; debug("LMS connected"); setupMeiOsAdmin(2); });
|
amtLms.on('connect', function () { amtLmsState = 2; obj.lmsstate = 2; debug("LMS connected"); setupMeiOsAdmin(2); });
|
||||||
//amtLms.on('bind', function (map) { });
|
amtLms.on('bind', function (map)
|
||||||
|
{
|
||||||
|
obj._mapping = map;
|
||||||
|
obj.emit('portBinding_LMS', map);
|
||||||
|
});
|
||||||
amtLms.on('notify', function (data, options, str, code) {
|
amtLms.on('notify', function (data, options, str, code) {
|
||||||
//debug('LMS notify');
|
//debug('LMS notify');
|
||||||
if (code == 'iAMT0052-3') {
|
if (code == 'iAMT0052-3') {
|
||||||
|
Loading…
Reference in New Issue
Block a user