system() virtual detection improvement

This commit is contained in:
Sebastian Hildebrandt 2021-05-24 19:52:43 +02:00
parent 06435f4529
commit 6b1ef556b3
4 changed files with 12 additions and 6 deletions

View File

@ -77,6 +77,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.7.2 | 2021-05-24 | `system()` virtual detection improvement |
| 5.7.1 | 2021-05-20 | `graphics()` Check for qwMemorySize on Windows |
| 5.7.0 | 2021-05-20 | `diskLayout()` added smartdata for win (if istalled) |
| 5.6.22 | 2021-05-18 | `diskLayout()` fixed to small buffer smartdata (linux) |

View File

@ -56,6 +56,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.7.2</th>
<td>2021-05-24</td>
<td><span class="code">system()</span> virtual detection improvement</td>
</tr>
<tr>
<th scope="row">5.7.1</th>
<td>2021-05-20</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.7.1</span></div>
<div class="version">New Version: <span id="version">5.7.2</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -159,22 +159,22 @@ function system(callback) {
result.model = 'Docker Container';
}
try {
const stdout = execSync('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen" | grep -vi "Nested Virtualization"');
const stdout = execSync('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen" | grep -viE "Nested Virtualization|/virtual/"');
// detect virtual machines
let lines = stdout.toString().split('\n');
if (lines.length > 0) {
if (result.model === 'Computer') { result.model = 'Virtual machine'; }
result.virtual = true;
if (stdout.toString().toLowerCase().indexOf('vmware') && !result.virtualHost) {
if (stdout.toString().toLowerCase().indexOf('vmware') >= 0 && !result.virtualHost) {
result.virtualHost = 'VMware';
}
if (stdout.toString().toLowerCase().indexOf('qemu') && !result.virtualHost) {
if (stdout.toString().toLowerCase().indexOf('qemu') >= 0 && !result.virtualHost) {
result.virtualHost = 'QEMU';
}
if (stdout.toString().toLowerCase().indexOf('xen') && !result.virtualHost) {
if (stdout.toString().toLowerCase().indexOf('xen') >= 0 && !result.virtualHost) {
result.virtualHost = 'Xen';
}
if (stdout.toString().toLowerCase().indexOf('kvm') && !result.virtualHost) {
if (stdout.toString().toLowerCase().indexOf('kvm') >= 0 && !result.virtualHost) {
result.virtualHost = 'KVM';
}
}