add tpm support (#5421)
* add tpm support Signed-off-by: Simon Smith <simonsmith5521@gmail.com> * fix tpm semicolon mistake Signed-off-by: Simon Smith <simonsmith5521@gmail.com> --------- Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
This commit is contained in:
parent
a8aa294199
commit
7b016eac58
|
@ -1844,6 +1844,22 @@ function getSystemInformation(func) {
|
|||
}
|
||||
} catch (ex) { results.hardware.identifiers['bios_mode'] = 'Legacy'; }
|
||||
}
|
||||
if (!results.hardware.tpm) {
|
||||
IntToStr = function (v) { return String.fromCharCode((v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); };
|
||||
try {
|
||||
var values = require('win-wmi').query('ROOT\\CIMV2\\Security\\MicrosoftTpm', "SELECT * FROM Win32_Tpm", ['IsActivated_InitialValue','IsEnabled_InitialValue','IsOwned_InitialValue','ManufacturerId','ManufacturerVersion','SpecVersion']);
|
||||
if(values[0]) {
|
||||
results.hardware.tpm = {
|
||||
SpecVersion: values[0].SpecVersion.split(",")[0],
|
||||
ManufacturerId: IntToStr(values[0].ManufacturerId).replace(/[^\x00-\x7F]/g, ""),
|
||||
ManufacturerVersion: values[0].ManufacturerVersion,
|
||||
IsActivated: values[0].IsActivated_InitialValue,
|
||||
IsEnabled: values[0].IsEnabled_InitialValue,
|
||||
IsOwned: values[0].IsOwned_InitialValue,
|
||||
}
|
||||
}
|
||||
} catch (ex) { }
|
||||
}
|
||||
}
|
||||
if(results.hardware && results.hardware.linux) {
|
||||
if (!results.hardware.identifiers['bios_serial']) {
|
||||
|
@ -1856,6 +1872,16 @@ function getSystemInformation(func) {
|
|||
results.hardware.identifiers['bios_mode'] = (require('fs').statSync('/sys/firmware/efi').isDirectory() ? 'UEFI': 'Legacy');
|
||||
} catch (ex) { results.hardware.identifiers['bios_mode'] = 'Legacy'; }
|
||||
}
|
||||
if (!results.hardware.tpm) {
|
||||
IntToStr = function (v) { return String.fromCharCode((v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF); };
|
||||
try {
|
||||
if (require('fs').statSync('/sys/class/tpm/tpm0').isDirectory()){
|
||||
results.hardware.tpm = {
|
||||
SpecVersion: require('fs').readFileSync('/sys/class/tpm/tpm0/tpm_version_major').toString().trim()
|
||||
}
|
||||
}
|
||||
} catch (ex) { }
|
||||
}
|
||||
}
|
||||
results.hardware.agentvers = process.versions;
|
||||
replaceSpacesWithUnderscoresRec(results);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -6016,6 +6016,18 @@
|
|||
if (x != '') { sections.push({ name: "Motherboard", html: x, img: 'motherboard' }); }
|
||||
}
|
||||
|
||||
// TPM
|
||||
if (hardware.tpm) {
|
||||
var x = '', tpm = hardware.tpm;
|
||||
if (tpm.SpecVersion) { x += addDetailItem("SpecVersion", parseFloat(EscapeHtml(tpm.SpecVersion)).toFixed(1), s); }
|
||||
if (tpm.ManufacturerId) { x += addDetailItem("ManufacturerId", EscapeHtml(tpm.ManufacturerId), s); }
|
||||
if (tpm.ManufacturerVersion) { x += addDetailItem("ManufacturerVersion", EscapeHtml(tpm.ManufacturerVersion), s); }
|
||||
if (tpm.IsActivated != null) { x += addDetailItem("IsActivated", EscapeHtml(tpm.IsActivated), s); }
|
||||
if (tpm.IsEnabled != null) { x += addDetailItem("IsEnabled", EscapeHtml(tpm.IsEnabled), s); }
|
||||
if (tpm.IsOwned != null) { x += addDetailItem("IsOwned", EscapeHtml(tpm.IsOwned), s); }
|
||||
if (x != '') { sections.push({ name: "TPM", html: x, img: 'tpm'}); }
|
||||
}
|
||||
|
||||
if (hardware.windows) {
|
||||
if (hardware.windows.memory && (hardware.windows.memory.length > 0)) {
|
||||
var x = '';
|
||||
|
|
|
@ -11759,6 +11759,18 @@
|
|||
if (x != '') { sections.push({ name: "Motherboard", html: x, img: 'motherboard64.png'}); }
|
||||
}
|
||||
|
||||
// TPM
|
||||
if (hardware.tpm) {
|
||||
var x = '', tpm = hardware.tpm;
|
||||
if (tpm.SpecVersion) { x += addDetailItem("SpecVersion", parseFloat(EscapeHtml(tpm.SpecVersion)).toFixed(1), s); }
|
||||
if (tpm.ManufacturerId) { x += addDetailItem("ManufacturerId", EscapeHtml(tpm.ManufacturerId), s); }
|
||||
if (tpm.ManufacturerVersion) { x += addDetailItem("ManufacturerVersion", EscapeHtml(tpm.ManufacturerVersion), s); }
|
||||
if (tpm.IsActivated != null) { x += addDetailItem("IsActivated", EscapeHtml(tpm.IsActivated), s); }
|
||||
if (tpm.IsEnabled != null) { x += addDetailItem("IsEnabled", EscapeHtml(tpm.IsEnabled), s); }
|
||||
if (tpm.IsOwned != null) { x += addDetailItem("IsOwned", EscapeHtml(tpm.IsOwned), s); }
|
||||
if (x != '') { sections.push({ name: "TPM", html: x, img: 'tpm64.png'}); }
|
||||
}
|
||||
|
||||
if (hardware.windows) {
|
||||
if (hardware.windows.memory && (hardware.windows.memory.length > 0)) {
|
||||
var x = '';
|
||||
|
|
Loading…
Reference in New Issue