1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

ignore if client sent new identifiers (#5403)

This commit is contained in:
Simon Smith 2023-10-08 14:27:39 +01:00 committed by GitHub
parent 553bcc9b8d
commit ae55285493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1825,10 +1825,13 @@ function getSystemInformation(func) {
if (results.hardware.windows.osinfo) { delete results.hardware.windows.osinfo.Node; }
if (results.hardware.windows.partitions) { for (var i in results.hardware.windows.partitions) { delete results.hardware.windows.partitions[i].Node; } }
} catch (ex) { }
if (!results.hardware.identifiers['bios_serial']) {
try {
var values = require('win-wmi').query('ROOT\\CIMV2', "SELECT * FROM Win32_Bios", ['SerialNumber']);
results.hardware.identifiers['bios_serial'] = values[0]['SerialNumber'];
} catch (ex) { }
}
if (!results.hardware.identifiers['bios_mode']) {
try {
results.hardware.identifiers['bios_mode'] = 'Legacy';
for (var i in results.hardware.windows.partitions) {
@ -1838,14 +1841,19 @@ function getSystemInformation(func) {
}
} catch (ex) { results.hardware.identifiers['bios_mode'] = 'Legacy'; }
}
}
if(results.hardware && results.hardware.linux) {
if (!results.hardware.identifiers['bios_serial']) {
if (require('fs').statSync('/sys/class/dmi/id/product_serial').isFile()){
results.hardware.identifiers['bios_serial'] = require('fs').readFileSync('/sys/class/dmi/id/product_serial').toString().trim();
}
}
if (!results.hardware.identifiers['bios_mode']) {
try {
results.hardware.identifiers['bios_mode'] = (require('fs').statSync('/sys/firmware/efi').isDirectory() ? 'UEFI': 'Legacy');
} catch (ex) { results.hardware.identifiers['bios_mode'] = 'Legacy'; }
}
}
results.hardware.agentvers = process.versions;
replaceSpacesWithUnderscoresRec(results);
var hasher = require('SHA384Stream').create();