1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

First working version of Windows agent icon replacement.

This commit is contained in:
Ylian Saint-Hilaire 2022-08-11 13:34:06 -07:00
parent d2abcdc9d5
commit 37bcae368b
3 changed files with 47 additions and 14 deletions

View file

@ -1268,6 +1268,21 @@ function createAuthenticodeHandler(path) {
return hash.digest();
}
// Hash the file using the selected hashing system skipping resource section
// This hash skips the executables CRC, sections table, resource section, code signing data and signing block
obj.getHashOfSection = function (algo, sectionName) {
if (obj.header.sections[sectionName] == null) return null;
// Get the section start and size
const sectionPtr = obj.header.sections[sectionName].rawAddr;
const sectionSize = obj.header.sections[sectionName].rawSize;
// Hash the remaining data
const hash = crypto.createHash(algo);
runHash(hash, sectionPtr, sectionPtr + sectionSize);
return hash.digest();
}
// Hash the file from start to end loading 64k chunks
function runHash(hash, start, end) {
var ptr = start;