mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-25 01:45:41 +03:00
Added support for changing the Windows agent bitmap logo within the executable. Agent needs to be changed to fully support this.
This commit is contained in:
parent
e306af5fc9
commit
d519546a6c
@ -2482,4 +2482,5 @@ if (require.main === module) { start(); }
|
|||||||
module.exports.createAuthenticodeHandler = createAuthenticodeHandler;
|
module.exports.createAuthenticodeHandler = createAuthenticodeHandler;
|
||||||
module.exports.loadCertificates = loadCertificates;
|
module.exports.loadCertificates = loadCertificates;
|
||||||
module.exports.loadIcon = loadIcon;
|
module.exports.loadIcon = loadIcon;
|
||||||
|
module.exports.loadBitmap = loadBitmap;
|
||||||
module.exports.hashObject = hashObject;
|
module.exports.hashObject = hashObject;
|
@ -1384,6 +1384,22 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
// Invalid icon file path
|
// Invalid icon file path
|
||||||
delete obj.config.domains[i].agentfileinfo.icon;
|
delete obj.config.domains[i].agentfileinfo.icon;
|
||||||
}
|
}
|
||||||
|
if (typeof obj.config.domains[i].agentfileinfo.logo == 'string') {
|
||||||
|
// Load the agent .bmp file
|
||||||
|
var logo = null;
|
||||||
|
try { logo = require('./authenticode.js').loadBitmap(obj.path.join(obj.datapath, obj.config.domains[i].agentfileinfo.logo)); } catch (ex) { }
|
||||||
|
if (logo != null) {
|
||||||
|
// The logo file was correctly loaded
|
||||||
|
obj.config.domains[i].agentfileinfo.logo = logo;
|
||||||
|
} else {
|
||||||
|
// Failed to load the icon file, display a server warning
|
||||||
|
addServerWarning("Unable to load agent logo file: " + obj.config.domains[i].agentfileinfo.logo + ".", 24, [obj.config.domains[i].agentfileinfo.logo]);
|
||||||
|
delete obj.config.domains[i].agentfileinfo.logo;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Invalid icon file path
|
||||||
|
delete obj.config.domains[i].agentfileinfo.logo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3022,6 +3038,35 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the agent logo
|
||||||
|
if (destinationAgentOk == true) {
|
||||||
|
if ((domain.agentfileinfo != null) && (domain.agentfileinfo.logo != null)) {
|
||||||
|
// Check if the destination agent matches the logo we want
|
||||||
|
const agentBitmaps = destinationAgent.getBitmapInfo();
|
||||||
|
if (agentBitmaps != null) {
|
||||||
|
const agentBitmapNames = Object.keys(agentBitmaps);
|
||||||
|
if (agentBitmapNames.length > 0) {
|
||||||
|
const agentMainBitmap = agentBitmaps[agentBitmapNames[0]];
|
||||||
|
const agentMainBitmapHash = require('./authenticode.js').hashObject(agentMainBitmap);
|
||||||
|
const bitmapHash = require('./authenticode.js').hashObject(domain.agentfileinfo.logo);
|
||||||
|
if (agentMainBitmapHash != bitmapHash) { destinationAgentOk = false; } // If the existing agent logo does not match the desired logo, we need to re-sign the agent.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Check if the destination agent has the default icon
|
||||||
|
const agentBitmaps1 = destinationAgent.getBitmapInfo();
|
||||||
|
const agentBitmaps2 = originalAgent.getBitmapInfo();
|
||||||
|
const agentBitmapNames = Object.keys(agentBitmaps1);
|
||||||
|
if (agentBitmapNames.length == 0) {
|
||||||
|
destinationAgentOk = false;
|
||||||
|
} else {
|
||||||
|
const iconHash1 = require('./authenticode.js').hashObject(agentBitmaps1[agentBitmapNames[0]]);
|
||||||
|
const iconHash2 = require('./authenticode.js').hashObject(agentBitmaps2[agentBitmapNames[0]]);
|
||||||
|
if (iconHash1 != iconHash2) { destinationAgentOk = false; } // If the existing agent icon does not match the desired icon, we need to re-sign the agent.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If everything looks ok, runs a hash of the original and destination agent .text, .data and .rdata sections. If different, sign the agent again.
|
// If everything looks ok, runs a hash of the original and destination agent .text, .data and .rdata sections. If different, sign the agent again.
|
||||||
@ -3084,6 +3129,18 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change the agent logo
|
||||||
|
if (domain.agentfileinfo.logo != null) {
|
||||||
|
const agentBitmaps = originalAgent.getBitmapInfo();
|
||||||
|
if (agentBitmaps != null) {
|
||||||
|
const agentBitmapNames = Object.keys(agentBitmaps);
|
||||||
|
if (agentBitmapNames.length > 0) {
|
||||||
|
agentBitmaps[agentBitmapNames[0]] = domain.agentfileinfo.logo;
|
||||||
|
originalAgent.setBitmapInfo(agentBitmaps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const signingArguments = { out: signeedagentpath, desc: signDesc, url: signUrl, time: timeStampUrl, proxy: timeStampProxy }; // Shallow clone
|
const signingArguments = { out: signeedagentpath, desc: signDesc, url: signUrl, time: timeStampUrl, proxy: timeStampProxy }; // Shallow clone
|
||||||
|
@ -2329,7 +2329,8 @@
|
|||||||
20: "Invalid \"LoginCookieEncryptionKey\" in config.json.",
|
20: "Invalid \"LoginCookieEncryptionKey\" in config.json.",
|
||||||
21: "Backup path can't be set within meshcentral-data folder, backup settings ignored.",
|
21: "Backup path can't be set within meshcentral-data folder, backup settings ignored.",
|
||||||
22: "Failed to sign agent {0}: {1}",
|
22: "Failed to sign agent {0}: {1}",
|
||||||
23: "Unable to load agent icon file: {0}."
|
23: "Unable to load agent icon file: {0}.",
|
||||||
|
24: "Unable to load agent logo file: {0}."
|
||||||
};
|
};
|
||||||
var x = '';
|
var x = '';
|
||||||
for (var i in message.warnings) {
|
for (var i in message.warnings) {
|
||||||
|
Loading…
Reference in New Issue
Block a user