mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-17 08:43:21 +00:00
Added coreinfo and fixed smbios
This commit is contained in:
@@ -49,8 +49,6 @@ function start()
|
|||||||
coreInfo()
|
coreInfo()
|
||||||
.then(function () { return (testConsoleHelp()); })
|
.then(function () { return (testConsoleHelp()); })
|
||||||
.then(function () { return (testCPUInfo()); })
|
.then(function () { return (testCPUInfo()); })
|
||||||
.then(function () { return (testSMBIOS()); })
|
|
||||||
.then(function () { return (testAMT()); })
|
|
||||||
.then(function () { return (testTunnel()); })
|
.then(function () { return (testTunnel()); })
|
||||||
.then(function () { return (testTerminal()); })
|
.then(function () { return (testTerminal()); })
|
||||||
.then(function () { return (testKVM()); })
|
.then(function () { return (testKVM()); })
|
||||||
@@ -67,10 +65,11 @@ function coreInfo()
|
|||||||
ret.tester = this;
|
ret.tester = this;
|
||||||
ret.handler = function handler(J)
|
ret.handler = function handler(J)
|
||||||
{
|
{
|
||||||
if(J.action == 'coreinfo')
|
switch(J.action)
|
||||||
{
|
{
|
||||||
this.removeListener('command', handler);
|
case 'coreinfo':
|
||||||
console.log(' -> Agent Info received..............[OK]');
|
handler.coreinfo = true;
|
||||||
|
console.log(' -> Core Info received..............[OK]');
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log(' ' + J.osdesc);
|
console.log(' ' + J.osdesc);
|
||||||
console.log(' ' + J.value);
|
console.log(' ' + J.value);
|
||||||
@@ -80,10 +79,39 @@ function coreInfo()
|
|||||||
console.log('\n' + JSON.stringify(J) + '\n');
|
console.log('\n' + JSON.stringify(J) + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'smbios':
|
||||||
|
handler.rcount++;
|
||||||
|
console.log(' -> SMBIOS Info received.............[OK]');
|
||||||
|
var tables = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tables = require('smbios').parse(J.value);
|
||||||
|
console.log(' -> AMT Support...................[' + ((tables.amtInfo && tables.amtInfo.AMT == true) ? 'YES' : 'NO') + ']');
|
||||||
|
}
|
||||||
|
catch(e)
|
||||||
|
{
|
||||||
|
console.log(' -> (Parse Error).................[FAILED]');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.argv.includes('--smbios="1"'))
|
||||||
|
{
|
||||||
|
console.log(JSON.stringify(tables));
|
||||||
|
//console.log('\n' + JSON.stringify(J) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(handler.rcount>0 && handler.coreinfo)
|
||||||
|
{
|
||||||
|
this.removeListener('command', handler);
|
||||||
handler.promise._res();
|
handler.promise._res();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ret.handler.promise = ret;
|
ret.handler.promise = ret;
|
||||||
|
ret.handler.coreinfo = false;
|
||||||
|
ret.handler.rcount = 0;
|
||||||
ret.tester.on('command', ret.handler);
|
ret.tester.on('command', ret.handler);
|
||||||
require('MeshAgent').emit('Connected', 3);
|
require('MeshAgent').emit('Connected', 3);
|
||||||
|
|
||||||
@@ -212,30 +240,6 @@ function testFileDownload()
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSMBIOS()
|
|
||||||
{
|
|
||||||
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
|
|
||||||
ret.consoleTest = this.consoleCommand('smbios');
|
|
||||||
ret.consoleTest.parent = ret;
|
|
||||||
ret.consoleTest.then(function (J)
|
|
||||||
{
|
|
||||||
if (J.length < 30)
|
|
||||||
{
|
|
||||||
this.parent._rej(' => Testing SMBIOS......................[EMPTY]');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
console.log(' => Testing SMBIOS......................[OK]');
|
|
||||||
}
|
|
||||||
this.parent._res();
|
|
||||||
}).catch(function (e)
|
|
||||||
{
|
|
||||||
this.parent._rej(' => Testing SMBIOS......................[FAILED]');
|
|
||||||
});
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testCPUInfo()
|
function testCPUInfo()
|
||||||
{
|
{
|
||||||
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
|
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
|
||||||
@@ -261,39 +265,6 @@ function testCPUInfo()
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAMT()
|
|
||||||
{
|
|
||||||
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
|
|
||||||
ret.consoleTest = this.consoleCommand('amt');
|
|
||||||
ret.consoleTest.parent = ret;
|
|
||||||
ret.consoleTest.then(function (J)
|
|
||||||
{
|
|
||||||
if (J.toString().includes('not detected'))
|
|
||||||
{
|
|
||||||
console.log(' => Testing AMT.........................[NOT DETECTED]');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var str = '(function foo(){var x=' + J.toString().split('\n').join('').split('\r').join('') + '; return(x);})();';
|
|
||||||
eval(str);
|
|
||||||
console.log(' => Testing AMT Detection...............[OK]');
|
|
||||||
}
|
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
this.parent._rej(' => Testing AMT Detection...............[ERROR]');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.parent._res();
|
|
||||||
}).catch(function (e)
|
|
||||||
{
|
|
||||||
this.parent._rej(' => Testing AMT.........................[FAILED]');
|
|
||||||
});
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testKVM()
|
function testKVM()
|
||||||
{
|
{
|
||||||
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
|
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
|
||||||
|
|||||||
Reference in New Issue
Block a user