From f14db772069689bb22c1ed51264a2a34b02094ff Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 30 Jan 2023 08:33:23 +0100 Subject: [PATCH] system() improved virtual host detection for Parallels --- CHANGELOG.md | 1 + README.md | 2 +- docs/history.html | 5 ++ docs/index.html | 2 +- docs/trademarks.html | 59 +++++++++++---------- lib/system.js | 122 +++---------------------------------------- 6 files changed, 46 insertions(+), 145 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1bd0f9..4a56426 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.17.8 | 2023-01-30 | `system()` improved virtual host detection for Parallels | | 5.17.7 | 2023-01-29 | `processes()` fixed CPU usage info (windows) | | 5.17.6 | 2023-01-29 | `processes()` fixed Node Version 8 compatibility issue | | 5.17.5 | 2023-01-29 | `processes()` improved parsing of all services (linux) | diff --git a/README.md b/README.md index ab9d081..22a7873 100644 --- a/README.md +++ b/README.md @@ -1023,7 +1023,7 @@ Solaris, OpenSolaris and registered trademarks of Sun Microsystems, VMware is a Virtual Box is a trademark of Oracle Corporation, Xen is a registered trademark of Xen Project, QEMU is a trademark of Fabrice Bellard, bochs is a trademark of The Bochs Project, USB and USB Logo are trademarks of USB Implementation Forum, Bluetooth and Bluetooth Logo are trademarks of Bluetooth SIG, -Android is a trademark of Google LLC. +Android is a trademark of Google LLC, Parallels is a trademarks of Parallels International GmbH. All other trademarks are the property of their respective owners. diff --git a/docs/history.html b/docs/history.html index 71cbb43..0623205 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.17.8 + 2023-01-30 + system() improved virtual host detection for Parallels + 5.17.7 2023-01-29 diff --git a/docs/index.html b/docs/index.html index 7ebe8fb..3bbf6dc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.17.7
+
New Version: 5.17.8
diff --git a/docs/trademarks.html b/docs/trademarks.html index 7d3fc0d..a7a3ebe 100644 --- a/docs/trademarks.html +++ b/docs/trademarks.html @@ -46,36 +46,37 @@

The following trademarks are the properties of their respective owners as listed below. Should any trademark attribution be missing, mistaken or erroneous, please contact us as soon as possible for rectification.

    -
  • Node.js is a trademark of Joyent Inc.
  • -
  • Linux is a registered trademark of Linus Torvalds
  • -
  • Apple, macOS, OS X, CUPS are registered trademarks of Apple Inc.
  • -
  • Windows is a registered trademark of Microsoft Corporation
  • -
  • Intel is a trademark of Intel Corporation
  • -
  • AMD is a trademark of Advanced Micro Devices Inc.
  • -
  • Ryzen is a trademark of Advanced Micro Devices Inc.
  • -
  • Raspberry Pi is a trademark of the Raspberry Pi Foundation
  • -
  • Debian is a trademark owned by Software in the Public Interest, Inc.
  • -
  • FreeBSD is a registered trademark of The FreeBSD Foundation
  • -
  • NetBSD is a registered trademark of The NetBSD Foundation
  • -
  • Docker is a trademark of Docker, Inc.
  • -
  • Ubuntu is a trademark of Canonical Ltd.
  • -
  • CentOS is a trademark of Read Hat Inc.
  • -
  • Sun, Solaris, OpenSolaris are registered trademarks of Sun Microsystems
  • -
  • Virtual Box is a registered trademark of Oracle Corporation
  • -
  • Xen is a registered trademark of Xen Project, The Linux Foundation Projects
  • -
  • VMware is a registered trademark of VMware, Inc.
  • -
  • bochs is a trademark of The Bochs Project
  • -
  • QEMU is a trademark of Fabrice Bellard.
  • -
  • BSD is a registered trademark of UUnet Technologies, Inc.
  • -
  • UNIX is a registered trademark of The Open Group.
  • -
  • NVIDIA is a registered trademark of NVIDIA Corporation.
  • -
  • MSI is a registered trademark Micro-Star International Co.
  • -
  • DELL is a registered trademark of Dell Inc.
  • -
  • ASUS is a registered trademark of ASUSTeK Computer.
  • Alpine is a trademark of Alpine Linux Development Team.
  • -
  • USB and USB Logo are trademarks of USB Implementation Forum.
  • -
  • Bluetooth and Bluetooth Logo are trademarks of Bluetooth SIG..
  • +
  • AMD is a trademark of Advanced Micro Devices Inc.
  • Android is a trademark of Google LLC.
  • +
  • Apple, macOS, OS X, CUPS are registered trademarks of Apple Inc.
  • +
  • ASUS is a registered trademark of ASUSTeK Computer.
  • +
  • Bluetooth and Bluetooth Logo are trademarks of Bluetooth SIG..
  • +
  • bochs is a trademark of The Bochs Project
  • +
  • BSD is a registered trademark of UUnet Technologies, Inc.
  • +
  • CentOS is a trademark of Read Hat Inc.
  • +
  • Debian is a trademark owned by Software in the Public Interest, Inc.
  • +
  • DELL is a registered trademark of Dell Inc.
  • +
  • Docker is a trademark of Docker, Inc.
  • +
  • FreeBSD is a registered trademark of The FreeBSD Foundation
  • +
  • Intel is a trademark of Intel Corporation
  • +
  • Linux is a registered trademark of Linus Torvalds
  • +
  • MSI is a registered trademark Micro-Star International Co.
  • +
  • NetBSD is a registered trademark of The NetBSD Foundation
  • +
  • Node.js is a trademark of Joyent Inc.
  • +
  • NVIDIA is a registered trademark of NVIDIA Corporation.
  • +
  • Parallels is a trademarks of Parallels International GmbH.
  • +
  • QEMU is a trademark of Fabrice Bellard.
  • +
  • Raspberry Pi is a trademark of the Raspberry Pi Foundation
  • +
  • Ryzen is a trademark of Advanced Micro Devices Inc.
  • +
  • Sun, Solaris, OpenSolaris are registered trademarks of Sun Microsystems
  • +
  • Ubuntu is a trademark of Canonical Ltd.
  • +
  • UNIX is a registered trademark of The Open Group.
  • +
  • USB and USB Logo are trademarks of USB Implementation Forum.
  • +
  • Virtual Box is a registered trademark of Oracle Corporation
  • +
  • VMware is a registered trademark of VMware, Inc.
  • +
  • Windows is a registered trademark of Microsoft Corporation
  • +
  • Xen is a registered trademark of Xen Project, The Linux Foundation Projects
  • +innovations is a trademark of plus-innovations application development GmbH

All other trademarks are the property of their respective owners.

@@ -131,4 +132,4 @@ - \ No newline at end of file + diff --git a/lib/system.js b/lib/system.js index d672fe6..b8206f6 100644 --- a/lib/system.js +++ b/lib/system.js @@ -201,115 +201,6 @@ function system(callback) { revision: rPIRevision.revision }; } - - // if (result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2835' || result.model === 'BCM2837') { - - - // // Pi 4 - // if (['d03114'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 4 Model B'; - // result.version = result.version + ' - Rev. 1.4'; - // } - // if (['b03112', 'c03112'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 4 Model B'; - // result.version = result.version + ' - Rev. 1.2'; - // } - // if (['a03111', 'b03111', 'c03111'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 4 Model B'; - // result.version = result.version + ' - Rev. 1.1'; - // } - // // Pi 3 - // if (['a02082', 'a22082', 'a32082', 'a52082'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 3 Model B'; - // result.version = result.version + ' - Rev. 1.2'; - // } - // if (['a22083'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 3 Model B'; - // result.version = result.version + ' - Rev. 1.3'; - // } - // if (['a020d3'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 3 Model B+'; - // result.version = result.version + ' - Rev. 1.3'; - // } - // if (['9020e0'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 3 Model A+'; - // result.version = result.version + ' - Rev. 1.3'; - // } - // // Pi 2 Model B - // if (['a01040'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 2 Model B'; - // result.version = result.version + ' - Rev. 1.0'; - // } - // if (['a01041', 'a21041'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 2 Model B'; - // result.version = result.version + ' - Rev. 1.1'; - // } - // if (['a22042', 'a02042'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi 2 Model B'; - // result.version = result.version + ' - Rev. 1.2'; - // } - - // // Compute Model - // if (['a02100'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi CM3+'; - // result.version = result.version + ' - Rev 1.0'; - // } - // if (['a020a0', 'a220a0'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi CM3'; - // result.version = result.version + ' - Rev 1.0'; - // } - // if (['900061'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi CM'; - // result.version = result.version + ' - Rev 1.1'; - // } - - // // Pi Zero - // if (['900092', '920092'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Zero'; - // result.version = result.version + ' - Rev 1.2'; - // } - // if (['900093', '920093'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Zero'; - // result.version = result.version + ' - Rev 1.3'; - // } - // if (['9000c1'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Zero W'; - // result.version = result.version + ' - Rev 1.1'; - // } - - // // A, B, A+ B+ - // if (['0002', '0003'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Model B'; - // result.version = result.version + ' - Rev 1.0'; - // } - // if (['0004', '0005', '0006', '000d', '000e', '000f'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Model B'; - // result.version = result.version + ' - Rev 2.0'; - // } - // if (['0007', '0008', '0009'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Model A'; - // result.version = result.version + ' - Rev 2.0'; - // } - // if (['0010'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Model B+'; - // result.version = result.version + ' - Rev 1.0'; - // } - // if (['0012'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Model A+'; - // result.version = result.version + ' - Rev 1.0'; - // } - // if (['0013', '900032'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Model B+'; - // result.version = result.version + ' - Rev 1.2'; - // } - // if (['0015', '900021'].indexOf(result.version) >= 0) { - // result.model = result.model + ' - Pi Model A+'; - // result.version = result.version + ' - Rev 1.1'; - // } - // if (result.model.indexOf('Pi') !== -1 && result.version) { // Pi, Pi Zero - // result.manufacturer = 'Raspberry Pi Foundation'; - // } - // } } if (callback) { callback(result); } resolve(result); @@ -343,7 +234,6 @@ function system(callback) { try { util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select Name,Vendor,Version,IdentifyingNumber,UUID | fl').then((stdout, error) => { if (!error) { - // let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/); let lines = stdout.split('\r\n'); result.manufacturer = util.getValue(lines, 'vendor', ':'); result.model = util.getValue(lines, 'name', ':'); @@ -352,20 +242,22 @@ function system(callback) { result.uuid = util.getValue(lines, 'uuid', ':').toLowerCase(); // detect virtual (1) const model = result.model.toLowerCase(); - if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu')) { + if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu') || model.startsWith('parallels')) { result.virtual = true; if (model.startsWith('virtualbox')) { result.virtualHost = 'VirtualBox'; } if (model.startsWith('vmware')) { result.virtualHost = 'VMware'; } if (model.startsWith('kvm')) { result.virtualHost = 'KVM'; } if (model.startsWith('bochs')) { result.virtualHost = 'bochs'; } if (model.startsWith('qemu')) { result.virtualHost = 'KVM'; } + if (model.startsWith('parallels')) { result.virtualHost = 'Parallels'; } } const manufacturer = result.manufacturer.toLowerCase(); - if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen') { + if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen' || manufacturer.startsWith('parallels')) { result.virtual = true; if (manufacturer.startsWith('vmware')) { result.virtualHost = 'VMware'; } if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; } if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; } + if (manufacturer.startsWith('parallels')) { result.virtualHost = 'Parallels'; } } util.powerShell('Get-CimInstance MS_Systeminformation -Namespace "root/wmi" | select systemsku | fl ').then((stdout, error) => { if (!error) { @@ -376,7 +268,7 @@ function system(callback) { util.powerShell('Get-CimInstance Win32_bios | select Version, SerialNumber, SMBIOSBIOSVersion').then((stdout, error) => { if (!error) { let lines = stdout.toString(); - if (lines.indexOf('VRTUAL') >= 0 || lines.indexOf('A M I ') >= 0 || lines.indexOf('VirtualBox') >= 0 || lines.indexOf('VMWare') >= 0 || lines.indexOf('Xen') >= 0) { + if (lines.indexOf('VRTUAL') >= 0 || lines.indexOf('A M I ') >= 0 || lines.indexOf('VirtualBox') >= 0 || lines.indexOf('VMWare') >= 0 || lines.indexOf('Xen') >= 0 || lines.indexOf('Parallels') >= 0) { result.virtual = true; if (lines.indexOf('VirtualBox') >= 0 && !result.virtualHost) { result.virtualHost = 'VirtualBox'; @@ -393,6 +285,9 @@ function system(callback) { if (lines.indexOf('A M I') >= 0 && !result.virtualHost) { result.virtualHost = 'Virtual PC'; } + if (lines.indexOf('Parallels') >= 0 && !result.virtualHost) { + result.virtualHost = 'Parallels'; + } } if (callback) { callback(result); } resolve(result); @@ -823,4 +718,3 @@ function chassis(callback) { } exports.chassis = chassis; -