Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylianst committed Oct 20, 2022
2 parents 63cca7b + 3c5bc7e commit a40e407
Show file tree
Hide file tree
Showing 23 changed files with 613 additions and 133 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Expand Up @@ -5,6 +5,7 @@
"accountcreate",
"accountid",
"accountremove",
"acebase",
"acmd",
"acmepath",
"actiontype",
Expand Down Expand Up @@ -599,6 +600,7 @@
"postflight",
"poweraction",
"powerevents",
"Preconfigured",
"Proto",
"publicid",
"pushlogin",
Expand Down Expand Up @@ -662,6 +664,7 @@
"rport",
"rtpass",
"rtuser",
"runas",
"runasuser",
"runasuseronly",
"runcommand",
Expand Down Expand Up @@ -822,6 +825,7 @@
"usercount",
"userex",
"userfiles",
"userfirst",
"usergroupchange",
"usergroups",
"userid",
Expand Down
26 changes: 26 additions & 0 deletions agents/meshcore.js
Expand Up @@ -47,6 +47,32 @@ var MESHRIGHT_NODESKTOP = 65536;

var pendingSetClip = false; // This is a temporary hack to prevent multiple setclips at the same time to stop the agent from crashing.

//
// This is a helper function used by the 32 bit Windows Agent, when running on 64 bit windows. It will check if the agent is already patched for this
// and will use this helper if it is not. This helper will inject 'sysnative' into the results when calling readdirSync() on %windir%.
//
function __readdirSync_fix(path)
{
var sysnative = false;
pathstr = require('fs')._fixwinpath(path);
if (pathstr.split('\\*').join('').toLowerCase() == process.env['windir'].toLowerCase()) { sysnative = true; }
var ret = __readdirSync_old(path);
if (sysnative) { ret.push('sysnative'); }
return (ret);
}

if (process.platform == 'win32' && require('_GenericMarshal').PointerSize == 4 && require('os').arch() == 'x64')
{
if (require('fs').readdirSync.version == null)
{
//
// 32 Bit Windows Agent on 64 bit Windows has not been patched for sysnative issue, so lets use our own solution
//
require('fs').__readdirSync_old = require('fs').readdirSync;
require('fs').readdirSync = __readdirSync_fix;
}
}

function bcdOK() {
if (process.platform != 'win32') { return (false); }
if (require('os').arch() == 'x64') {
Expand Down
15 changes: 7 additions & 8 deletions agents/meshinstall-linux.js
Expand Up @@ -103,14 +103,13 @@ if (msh.agentName) { connectArgs.push('--agentName="' + msh.agentName + '"'); }

function _install(parms)
{
var i;
var mstr = require('fs').createWriteStream(process.execPath + '.msh', { flags: 'wb' });
mstr.write('MeshName=' + msh.MeshName + '\n');
mstr.write('MeshType=' + msh.MeshType + '\n');
mstr.write('MeshID=' + msh.MeshID + '\n');
mstr.write('ServerID=' + msh.ServerID + '\n');
mstr.write('MeshServer=' + msh.MeshServer + '\n');
if (msh.agentName) { mstr.write('agentName=' + msh.agentName + '\n'); }
if (msh.meshServiceName) { mstr.write('meshServiceName=' + msh.meshServiceName + '\n'); }

for (i in msh)
{
mstr.write(i + '=' + msh[i] + '\n');
}
mstr.end();

if (parms == null) { parms = []; }
Expand Down Expand Up @@ -156,7 +155,7 @@ if (process.argv.includes('-translations'))
console.log(JSON.stringify(translation));
process.exit();
}
if (process.argv.includes('-help') || (process.platform == 'linux' && process.env['XAUTHORITY']==null && process.env['DISPLAY'] == null))
if (process.argv.includes('-help') || (process.platform == 'linux' && process.env['XAUTHORITY'] == null && process.env['DISPLAY'] == null && process.argv.length == 1))
{
console.log("\n" + translation[lang].commands + ": ");
if ((msh.InstallFlags & 1) == 1)
Expand Down
17 changes: 14 additions & 3 deletions agents/modules_meshcmd/smbios.js
Expand Up @@ -269,15 +269,18 @@ function SMBiosTables()
this.amtInfo = function amtInfo(data) {
if (!data) { throw ('no data'); }
var retVal = { AMT: false };
if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT') {
if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT')
{
var amt = data[130].peek();
retVal.AMT = amt[4] ? true : false;
if (retVal.AMT) {
if (retVal.AMT)
{
retVal.enabled = amt[5] ? true : false;
retVal.storageRedirection = amt[6] ? true : false;
retVal.serialOverLan = amt[7] ? true : false;
retVal.kvm = amt[14] ? true : false;
if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') {
if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro')
{
var settings = data[131].peek();
if (settings[0] & 0x04) { retVal.TXT = (settings[0] & 0x08) ? true : false; }
if (settings[0] & 0x10) { retVal.VMX = (settings[0] & 0x20) ? true : false; }
Expand All @@ -295,6 +298,14 @@ function SMBiosTables()
}
}
}
if (!retVal.AMT)
{
if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro')
{
var settings = data[131].peek();
if ((settings[20] & 0x08) == 0x08) { retVal.AMT = true; }
}
}
return (retVal);
};
this.smTableTypes = {
Expand Down
17 changes: 14 additions & 3 deletions agents/modules_meshcore/smbios.js
Expand Up @@ -269,15 +269,18 @@ function SMBiosTables()
this.amtInfo = function amtInfo(data) {
if (!data) { throw ('no data'); }
var retVal = { AMT: false };
if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT') {
if (data[130] && data[130].peek().slice(0, 4).toString() == '$AMT')
{
var amt = data[130].peek();
retVal.AMT = amt[4] ? true : false;
if (retVal.AMT) {
if (retVal.AMT)
{
retVal.enabled = amt[5] ? true : false;
retVal.storageRedirection = amt[6] ? true : false;
retVal.serialOverLan = amt[7] ? true : false;
retVal.kvm = amt[14] ? true : false;
if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro') {
if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro')
{
var settings = data[131].peek();
if (settings[0] & 0x04) { retVal.TXT = (settings[0] & 0x08) ? true : false; }
if (settings[0] & 0x10) { retVal.VMX = (settings[0] & 0x20) ? true : false; }
Expand All @@ -295,6 +298,14 @@ function SMBiosTables()
}
}
}
if (!retVal.AMT)
{
if (data[131].peek() && data[131].peek().slice(52, 56).toString() == 'vPro')
{
var settings = data[131].peek();
if ((settings[20] & 0x08) == 0x08) { retVal.AMT = true; }
}
}
return (retVal);
};
this.smTableTypes = {
Expand Down

0 comments on commit a40e407

Please sign in to comment.