systeminformation 5.33.3 → 6.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +873 -957
- package/dist/audio.d.ts +1 -0
- package/dist/audio.js +18 -0
- package/dist/baseboard.d.ts +1 -0
- package/dist/baseboard.js +17 -0
- package/dist/battery.d.ts +1 -0
- package/dist/battery.js +19 -0
- package/dist/bios.d.ts +1 -0
- package/dist/bios.js +17 -0
- package/dist/block-devices.d.ts +1 -0
- package/dist/block-devices.js +17 -0
- package/dist/bluetooth.d.ts +1 -0
- package/dist/bluetooth.js +17 -0
- package/dist/bsd/battery.d.ts +2 -0
- package/dist/bsd/battery.js +27 -0
- package/dist/bsd/cpu-cache.d.ts +1 -0
- package/dist/bsd/cpu-cache.js +37 -0
- package/dist/bsd/cpu-flags.d.ts +1 -0
- package/dist/bsd/cpu-flags.js +28 -0
- package/dist/bsd/cpu-temperature.d.ts +1 -0
- package/dist/bsd/cpu-temperature.js +29 -0
- package/dist/bsd/cpu.d.ts +1 -0
- package/dist/bsd/cpu.js +98 -0
- package/dist/bsd/index.d.ts +38 -0
- package/dist/bsd/index.js +85 -0
- package/dist/bsd/mem.d.ts +1 -0
- package/dist/bsd/mem.js +37 -0
- package/dist/bsd/network-stats.d.ts +2 -0
- package/dist/bsd/network-stats.js +92 -0
- package/dist/bsd/os-info.d.ts +21 -0
- package/dist/bsd/os-info.js +38 -0
- package/dist/bsd/uuid.d.ts +2 -0
- package/dist/bsd/uuid.js +30 -0
- package/dist/camera.d.ts +1 -0
- package/dist/camera.js +17 -0
- package/dist/chassis.d.ts +1 -0
- package/dist/chassis.js +17 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +107 -0
- package/dist/common/codepage.d.ts +1 -0
- package/dist/common/codepage.js +43 -0
- package/dist/common/const.d.ts +25 -0
- package/dist/common/const.js +26 -0
- package/dist/common/cpu.d.ts +2 -0
- package/dist/common/cpu.js +12 -0
- package/dist/common/darwin.d.ts +6 -0
- package/dist/common/darwin.js +266 -0
- package/dist/common/datetime.d.ts +9 -0
- package/dist/common/datetime.js +161 -0
- package/dist/common/defaults.d.ts +25 -0
- package/dist/common/defaults.js +299 -0
- package/dist/common/exec.d.ts +10 -0
- package/dist/common/exec.js +69 -0
- package/dist/common/files.d.ts +2 -0
- package/dist/common/files.js +39 -0
- package/dist/common/filesys.d.ts +11 -0
- package/dist/common/filesys.js +282 -0
- package/dist/common/host.d.ts +2 -0
- package/dist/common/host.js +67 -0
- package/dist/common/index.d.ts +12 -0
- package/dist/common/index.js +146 -0
- package/dist/common/internet.d.ts +1 -0
- package/dist/common/internet.js +47 -0
- package/dist/common/mappings.d.ts +55 -0
- package/dist/common/mappings.js +4133 -0
- package/dist/common/network.d.ts +8 -0
- package/dist/common/network.js +162 -0
- package/dist/common/nvidia.d.ts +22 -0
- package/dist/common/nvidia.js +159 -0
- package/dist/common/parse.d.ts +13 -0
- package/dist/common/parse.js +157 -0
- package/dist/common/raspberry.d.ts +5 -0
- package/dist/common/raspberry.js +277 -0
- package/dist/common/security.d.ts +31 -0
- package/dist/common/security.js +241 -0
- package/dist/common/types.d.ts +992 -0
- package/dist/common/types.js +2 -0
- package/dist/common/windows.d.ts +58 -0
- package/dist/common/windows.js +292 -0
- package/dist/cpu-cache.d.ts +1 -0
- package/dist/cpu-cache.js +19 -0
- package/dist/cpu-current-load.d.ts +2 -0
- package/dist/cpu-current-load.js +249 -0
- package/dist/cpu-current-speed.d.ts +3 -0
- package/dist/cpu-current-speed.js +84 -0
- package/dist/cpu-flags.d.ts +1 -0
- package/dist/cpu-flags.js +19 -0
- package/dist/cpu-full-load.d.ts +1 -0
- package/dist/cpu-full-load.js +30 -0
- package/dist/cpu-temperature.d.ts +1 -0
- package/dist/cpu-temperature.js +19 -0
- package/dist/cpu.d.ts +1 -0
- package/dist/cpu.js +19 -0
- package/dist/darwin/audio.d.ts +2 -0
- package/dist/darwin/audio.js +46 -0
- package/dist/darwin/baseboard.d.ts +1 -0
- package/dist/darwin/baseboard.js +48 -0
- package/dist/darwin/battery.d.ts +2 -0
- package/dist/darwin/battery.js +65 -0
- package/dist/darwin/bios.d.ts +1 -0
- package/dist/darwin/bios.js +45 -0
- package/dist/darwin/block-devices.d.ts +2 -0
- package/dist/darwin/block-devices.js +101 -0
- package/dist/darwin/bluetooth.d.ts +3 -0
- package/dist/darwin/bluetooth.js +84 -0
- package/dist/darwin/camera.d.ts +2 -0
- package/dist/darwin/camera.js +55 -0
- package/dist/darwin/chassis.d.ts +2 -0
- package/dist/darwin/chassis.js +32 -0
- package/dist/darwin/cpu-cache.d.ts +2 -0
- package/dist/darwin/cpu-cache.js +29 -0
- package/dist/darwin/cpu-flags.d.ts +1 -0
- package/dist/darwin/cpu-flags.js +16 -0
- package/dist/darwin/cpu-temperature.d.ts +1 -0
- package/dist/darwin/cpu-temperature.js +44 -0
- package/dist/darwin/cpu.d.ts +1 -0
- package/dist/darwin/cpu.js +69 -0
- package/dist/darwin/disk-layout.d.ts +2 -0
- package/dist/darwin/disk-layout.js +231 -0
- package/dist/darwin/disks-io.d.ts +2 -0
- package/dist/darwin/disks-io.js +56 -0
- package/dist/darwin/displays.d.ts +2 -0
- package/dist/darwin/displays.js +98 -0
- package/dist/darwin/fs-open-files.d.ts +2 -0
- package/dist/darwin/fs-open-files.js +27 -0
- package/dist/darwin/fs-stats.d.ts +2 -0
- package/dist/darwin/fs-stats.js +47 -0
- package/dist/darwin/gpu.d.ts +2 -0
- package/dist/darwin/gpu.js +55 -0
- package/dist/darwin/index.d.ts +56 -0
- package/dist/darwin/index.js +122 -0
- package/dist/darwin/keyboard.d.ts +2 -0
- package/dist/darwin/keyboard.js +73 -0
- package/dist/darwin/mem-layout.d.ts +2 -0
- package/dist/darwin/mem-layout.js +60 -0
- package/dist/darwin/mem.d.ts +2 -0
- package/dist/darwin/mem.js +50 -0
- package/dist/darwin/mouse.d.ts +2 -0
- package/dist/darwin/mouse.js +78 -0
- package/dist/darwin/network-connections.d.ts +2 -0
- package/dist/darwin/network-connections.js +98 -0
- package/dist/darwin/network-gateway-default.d.ts +1 -0
- package/dist/darwin/network-gateway-default.js +26 -0
- package/dist/darwin/network-interface-default.d.ts +2 -0
- package/dist/darwin/network-interface-default.js +41 -0
- package/dist/darwin/network-interfaces.d.ts +2 -0
- package/dist/darwin/network-interfaces.js +205 -0
- package/dist/darwin/network-stats.d.ts +2 -0
- package/dist/darwin/network-stats.js +86 -0
- package/dist/darwin/npm.d.ts +1 -0
- package/dist/darwin/npm.js +5 -0
- package/dist/darwin/npu.d.ts +2 -0
- package/dist/darwin/npu.js +41 -0
- package/dist/darwin/os-info.d.ts +1 -0
- package/dist/darwin/os-info.js +110 -0
- package/dist/darwin/pci.d.ts +2 -0
- package/dist/darwin/pci.js +37 -0
- package/dist/darwin/printer.d.ts +2 -0
- package/dist/darwin/printer.js +45 -0
- package/dist/darwin/software.d.ts +2 -0
- package/dist/darwin/software.js +39 -0
- package/dist/darwin/system.d.ts +1 -0
- package/dist/darwin/system.js +29 -0
- package/dist/darwin/thunderbolt.d.ts +1 -0
- package/dist/darwin/thunderbolt.js +53 -0
- package/dist/darwin/usb.d.ts +3 -0
- package/dist/darwin/usb.js +69 -0
- package/dist/darwin/users.d.ts +2 -0
- package/dist/darwin/users.js +13 -0
- package/dist/darwin/uuid.d.ts +2 -0
- package/dist/darwin/uuid.js +39 -0
- package/dist/darwin/wifi-connections.d.ts +2 -0
- package/dist/darwin/wifi-connections.js +60 -0
- package/dist/darwin/wifi-interfaces.d.ts +2 -0
- package/dist/darwin/wifi-interfaces.js +27 -0
- package/dist/darwin/wifi-networks.d.ts +2 -0
- package/dist/darwin/wifi-networks.js +61 -0
- package/dist/disk-layout.d.ts +1 -0
- package/dist/disk-layout.js +17 -0
- package/dist/disks-io.d.ts +1 -0
- package/dist/disks-io.js +17 -0
- package/dist/displays.d.ts +1 -0
- package/dist/displays.js +17 -0
- package/dist/docker-socket.d.ts +11 -0
- package/dist/docker-socket.js +113 -0
- package/dist/docker.d.ts +102 -0
- package/dist/docker.js +532 -0
- package/dist/fs-open-files.d.ts +1 -0
- package/dist/fs-open-files.js +17 -0
- package/dist/fs-size.d.ts +1 -0
- package/dist/fs-size.js +23 -0
- package/dist/fs-stats.d.ts +1 -0
- package/dist/fs-stats.js +17 -0
- package/dist/get-data.d.ts +110 -0
- package/dist/get-data.js +151 -0
- package/dist/get.d.ts +5 -0
- package/dist/get.js +117 -0
- package/dist/gpu.d.ts +1 -0
- package/dist/gpu.js +17 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +130 -0
- package/dist/inet-checksite.d.ts +1 -0
- package/dist/inet-checksite.js +11 -0
- package/dist/inet-latency.d.ts +1 -0
- package/dist/inet-latency.js +17 -0
- package/dist/keyboard.d.ts +1 -0
- package/dist/keyboard.js +17 -0
- package/dist/linux/audio.d.ts +2 -0
- package/dist/linux/audio.js +67 -0
- package/dist/linux/baseboard.d.ts +1 -0
- package/dist/linux/baseboard.js +81 -0
- package/dist/linux/battery.d.ts +2 -0
- package/dist/linux/battery.js +88 -0
- package/dist/linux/bios.d.ts +2 -0
- package/dist/linux/bios.js +55 -0
- package/dist/linux/block-devices.d.ts +2 -0
- package/dist/linux/block-devices.js +30 -0
- package/dist/linux/bluetooth.d.ts +2 -0
- package/dist/linux/bluetooth.js +86 -0
- package/dist/linux/camera.d.ts +2 -0
- package/dist/linux/camera.js +63 -0
- package/dist/linux/chassis.d.ts +1 -0
- package/dist/linux/chassis.js +41 -0
- package/dist/linux/cpu-cache.d.ts +1 -0
- package/dist/linux/cpu-cache.js +35 -0
- package/dist/linux/cpu-flags.d.ts +1 -0
- package/dist/linux/cpu-flags.js +33 -0
- package/dist/linux/cpu-temperature.d.ts +1 -0
- package/dist/linux/cpu-temperature.js +179 -0
- package/dist/linux/cpu.d.ts +1 -0
- package/dist/linux/cpu.js +135 -0
- package/dist/linux/disk-layout.d.ts +2 -0
- package/dist/linux/disk-layout.js +151 -0
- package/dist/linux/disks-io.d.ts +2 -0
- package/dist/linux/disks-io.js +58 -0
- package/dist/linux/displays.d.ts +2 -0
- package/dist/linux/displays.js +193 -0
- package/dist/linux/fs-open-files.d.ts +2 -0
- package/dist/linux/fs-open-files.js +44 -0
- package/dist/linux/fs-size.d.ts +2 -0
- package/dist/linux/fs-size.js +157 -0
- package/dist/linux/fs-stats.d.ts +2 -0
- package/dist/linux/fs-stats.js +65 -0
- package/dist/linux/gpu.d.ts +2 -0
- package/dist/linux/gpu.js +273 -0
- package/dist/linux/index.d.ts +56 -0
- package/dist/linux/index.js +122 -0
- package/dist/linux/inet-latency.d.ts +1 -0
- package/dist/linux/inet-latency.js +39 -0
- package/dist/linux/keyboard.d.ts +2 -0
- package/dist/linux/keyboard.js +61 -0
- package/dist/linux/mem-layout.d.ts +2 -0
- package/dist/linux/mem-layout.js +112 -0
- package/dist/linux/mem.d.ts +2 -0
- package/dist/linux/mem.js +61 -0
- package/dist/linux/mouse.d.ts +2 -0
- package/dist/linux/mouse.js +73 -0
- package/dist/linux/network-connections.d.ts +2 -0
- package/dist/linux/network-connections.js +114 -0
- package/dist/linux/network-gateway-default.d.ts +1 -0
- package/dist/linux/network-gateway-default.js +22 -0
- package/dist/linux/network-interface-default.d.ts +2 -0
- package/dist/linux/network-interface-default.js +46 -0
- package/dist/linux/network-interfaces.d.ts +3 -0
- package/dist/linux/network-interfaces.js +353 -0
- package/dist/linux/network-stats.d.ts +2 -0
- package/dist/linux/network-stats.js +99 -0
- package/dist/linux/npm.d.ts +1 -0
- package/dist/linux/npm.js +5 -0
- package/dist/linux/npu.d.ts +2 -0
- package/dist/linux/npu.js +77 -0
- package/dist/linux/os-info.d.ts +1 -0
- package/dist/linux/os-info.js +104 -0
- package/dist/linux/pci.d.ts +2 -0
- package/dist/linux/pci.js +56 -0
- package/dist/linux/printer.d.ts +2 -0
- package/dist/linux/printer.js +80 -0
- package/dist/linux/process-load.d.ts +2 -0
- package/dist/linux/process-load.js +164 -0
- package/dist/linux/processes.d.ts +2 -0
- package/dist/linux/processes.js +358 -0
- package/dist/linux/services.d.ts +2 -0
- package/dist/linux/services.js +222 -0
- package/dist/linux/software.d.ts +2 -0
- package/dist/linux/software.js +110 -0
- package/dist/linux/system.d.ts +1 -0
- package/dist/linux/system.js +186 -0
- package/dist/linux/thunderbolt.d.ts +2 -0
- package/dist/linux/thunderbolt.js +51 -0
- package/dist/linux/time.d.ts +6 -0
- package/dist/linux/time.js +28 -0
- package/dist/linux/usb.d.ts +2 -0
- package/dist/linux/usb.js +62 -0
- package/dist/linux/users.d.ts +2 -0
- package/dist/linux/users.js +102 -0
- package/dist/linux/uuid.d.ts +2 -0
- package/dist/linux/uuid.js +44 -0
- package/dist/linux/wifi-connections.d.ts +2 -0
- package/dist/linux/wifi-connections.js +196 -0
- package/dist/linux/wifi-interfaces.d.ts +2 -0
- package/dist/linux/wifi-interfaces.js +96 -0
- package/dist/linux/wifi-networks.d.ts +2 -0
- package/dist/linux/wifi-networks.js +176 -0
- package/dist/mem-layout.d.ts +1 -0
- package/dist/mem-layout.js +17 -0
- package/dist/mem.d.ts +1 -0
- package/dist/mem.js +19 -0
- package/dist/mouse.d.ts +1 -0
- package/dist/mouse.js +17 -0
- package/dist/network-connections.d.ts +1 -0
- package/dist/network-connections.js +17 -0
- package/dist/network-gateway-default.d.ts +1 -0
- package/dist/network-gateway-default.js +17 -0
- package/dist/network-interface-default.d.ts +1 -0
- package/dist/network-interface-default.js +17 -0
- package/dist/network-interfaces.d.ts +1 -0
- package/dist/network-interfaces.js +18 -0
- package/dist/network-stats.d.ts +1 -0
- package/dist/network-stats.js +19 -0
- package/dist/npm.d.ts +2 -0
- package/dist/npm.js +22 -0
- package/dist/npu.d.ts +1 -0
- package/dist/npu.js +17 -0
- package/dist/observe.d.ts +5 -0
- package/dist/observe.js +16 -0
- package/dist/os-info.d.ts +1 -0
- package/dist/os-info.js +21 -0
- package/dist/pci.d.ts +1 -0
- package/dist/pci.js +17 -0
- package/dist/printer.d.ts +1 -0
- package/dist/printer.js +17 -0
- package/dist/process-load.d.ts +1 -0
- package/dist/process-load.js +15 -0
- package/dist/processes.d.ts +1 -0
- package/dist/processes.js +15 -0
- package/dist/services.d.ts +1 -0
- package/dist/services.js +15 -0
- package/dist/shell.d.ts +1 -0
- package/dist/shell.js +16 -0
- package/dist/software.d.ts +1 -0
- package/dist/software.js +17 -0
- package/dist/sun/index.d.ts +17 -0
- package/dist/sun/index.js +43 -0
- package/dist/sun/inet-latency.d.ts +1 -0
- package/dist/sun/inet-latency.js +30 -0
- package/dist/sun/os-info.d.ts +1 -0
- package/dist/sun/os-info.js +26 -0
- package/dist/sun/users.d.ts +2 -0
- package/dist/sun/users.js +13 -0
- package/dist/system.d.ts +1 -0
- package/dist/system.js +17 -0
- package/dist/thunderbolt.d.ts +1 -0
- package/dist/thunderbolt.js +17 -0
- package/dist/time.d.ts +6 -0
- package/dist/time.js +28 -0
- package/dist/usb.d.ts +1 -0
- package/dist/usb.js +17 -0
- package/dist/users.d.ts +1 -0
- package/dist/users.js +21 -0
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +19 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +16 -0
- package/dist/versions.d.ts +2 -0
- package/dist/versions.js +1122 -0
- package/dist/virtualbox.d.ts +2 -0
- package/dist/virtualbox.js +89 -0
- package/dist/wifi-connections.d.ts +1 -0
- package/dist/wifi-connections.js +17 -0
- package/dist/wifi-interfaces.d.ts +1 -0
- package/dist/wifi-interfaces.js +17 -0
- package/dist/wifi-networks.d.ts +1 -0
- package/dist/wifi-networks.js +17 -0
- package/dist/windows/audio.d.ts +2 -0
- package/dist/windows/audio.js +23 -0
- package/dist/windows/baseboard.d.ts +1 -0
- package/dist/windows/baseboard.js +35 -0
- package/dist/windows/battery.d.ts +1 -0
- package/dist/windows/battery.js +81 -0
- package/dist/windows/bios.d.ts +1 -0
- package/dist/windows/bios.js +37 -0
- package/dist/windows/block-devices.d.ts +2 -0
- package/dist/windows/block-devices.js +48 -0
- package/dist/windows/bluetooth.d.ts +2 -0
- package/dist/windows/bluetooth.js +31 -0
- package/dist/windows/camera.d.ts +2 -0
- package/dist/windows/camera.js +47 -0
- package/dist/windows/chassis.d.ts +1 -0
- package/dist/windows/chassis.js +29 -0
- package/dist/windows/cpu-cache.d.ts +2 -0
- package/dist/windows/cpu-cache.js +59 -0
- package/dist/windows/cpu-flags.d.ts +1 -0
- package/dist/windows/cpu-flags.js +61 -0
- package/dist/windows/cpu-temperature.d.ts +1 -0
- package/dist/windows/cpu-temperature.js +32 -0
- package/dist/windows/cpu.d.ts +1 -0
- package/dist/windows/cpu.js +96 -0
- package/dist/windows/disk-layout.d.ts +2 -0
- package/dist/windows/disk-layout.js +112 -0
- package/dist/windows/disks-io.d.ts +2 -0
- package/dist/windows/disks-io.js +43 -0
- package/dist/windows/displays.d.ts +2 -0
- package/dist/windows/displays.js +213 -0
- package/dist/windows/fs-open-files.d.ts +2 -0
- package/dist/windows/fs-open-files.js +22 -0
- package/dist/windows/fs-size.d.ts +2 -0
- package/dist/windows/fs-size.js +47 -0
- package/dist/windows/fs-stats.d.ts +2 -0
- package/dist/windows/fs-stats.js +37 -0
- package/dist/windows/gpu.d.ts +2 -0
- package/dist/windows/gpu.js +128 -0
- package/dist/windows/index.d.ts +56 -0
- package/dist/windows/index.js +122 -0
- package/dist/windows/inet-latency.d.ts +1 -0
- package/dist/windows/inet-latency.js +34 -0
- package/dist/windows/keyboard.d.ts +2 -0
- package/dist/windows/keyboard.js +47 -0
- package/dist/windows/mem-layout.d.ts +2 -0
- package/dist/windows/mem-layout.js +39 -0
- package/dist/windows/mem.d.ts +2 -0
- package/dist/windows/mem.js +33 -0
- package/dist/windows/mouse.d.ts +2 -0
- package/dist/windows/mouse.js +64 -0
- package/dist/windows/network-connections.d.ts +2 -0
- package/dist/windows/network-connections.js +93 -0
- package/dist/windows/network-gateway-default.d.ts +1 -0
- package/dist/windows/network-gateway-default.js +36 -0
- package/dist/windows/network-interface-default.d.ts +2 -0
- package/dist/windows/network-interface-default.js +56 -0
- package/dist/windows/network-interfaces.d.ts +2 -0
- package/dist/windows/network-interfaces.js +346 -0
- package/dist/windows/network-stats.d.ts +2 -0
- package/dist/windows/network-stats.js +135 -0
- package/dist/windows/npm.d.ts +1 -0
- package/dist/windows/npm.js +5 -0
- package/dist/windows/npu.d.ts +2 -0
- package/dist/windows/npu.js +29 -0
- package/dist/windows/os-info.d.ts +1 -0
- package/dist/windows/os-info.js +65 -0
- package/dist/windows/pci.d.ts +2 -0
- package/dist/windows/pci.js +33 -0
- package/dist/windows/printer.d.ts +2 -0
- package/dist/windows/printer.js +36 -0
- package/dist/windows/process-load.d.ts +2 -0
- package/dist/windows/process-load.js +121 -0
- package/dist/windows/processes.d.ts +9 -0
- package/dist/windows/processes.js +139 -0
- package/dist/windows/services.d.ts +2 -0
- package/dist/windows/services.js +83 -0
- package/dist/windows/shell.d.ts +1 -0
- package/dist/windows/shell.js +19 -0
- package/dist/windows/software.d.ts +2 -0
- package/dist/windows/software.js +53 -0
- package/dist/windows/system.d.ts +1 -0
- package/dist/windows/system.js +98 -0
- package/dist/windows/thunderbolt.d.ts +2 -0
- package/dist/windows/thunderbolt.js +34 -0
- package/dist/windows/usb.d.ts +2 -0
- package/dist/windows/usb.js +37 -0
- package/dist/windows/users.d.ts +2 -0
- package/dist/windows/users.js +151 -0
- package/dist/windows/uuid.d.ts +2 -0
- package/dist/windows/uuid.js +28 -0
- package/dist/windows/wifi-connections.d.ts +2 -0
- package/dist/windows/wifi-connections.js +56 -0
- package/dist/windows/wifi-interfaces.d.ts +2 -0
- package/dist/windows/wifi-interfaces.js +45 -0
- package/dist/windows/wifi-networks.d.ts +2 -0
- package/dist/windows/wifi-networks.js +50 -0
- package/package.json +78 -12
- package/lib/audio.js +0 -277
- package/lib/battery.js +0 -334
- package/lib/bluetooth.js +0 -315
- package/lib/bluetoothVendors.js +0 -1138
- package/lib/cli.js +0 -100
- package/lib/cpu.js +0 -2285
- package/lib/docker.js +0 -791
- package/lib/dockerSocket.js +0 -117
- package/lib/filesystem.js +0 -1832
- package/lib/graphics.js +0 -1321
- package/lib/index.d.ts +0 -1051
- package/lib/index.js +0 -520
- package/lib/internet.js +0 -259
- package/lib/memory.js +0 -622
- package/lib/network.js +0 -2008
- package/lib/osinfo.js +0 -1321
- package/lib/printer.js +0 -209
- package/lib/processes.js +0 -1459
- package/lib/system.js +0 -855
- package/lib/usb.js +0 -309
- package/lib/users.js +0 -412
- package/lib/util.js +0 -2824
- package/lib/virtualbox.js +0 -116
- package/lib/wifi.js +0 -839
package/lib/osinfo.js
DELETED
|
@@ -1,1321 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// @ts-check
|
|
3
|
-
// ==================================================================================
|
|
4
|
-
// osinfo.js
|
|
5
|
-
// ----------------------------------------------------------------------------------
|
|
6
|
-
// Description: System Information - library
|
|
7
|
-
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 - 2026
|
|
9
|
-
// Author: Sebastian Hildebrandt
|
|
10
|
-
// ----------------------------------------------------------------------------------
|
|
11
|
-
// License: MIT
|
|
12
|
-
// ==================================================================================
|
|
13
|
-
// 3. Operating System
|
|
14
|
-
// ----------------------------------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
const os = require('os');
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const util = require('./util');
|
|
19
|
-
const exec = require('child_process').exec;
|
|
20
|
-
const execSync = require('child_process').execSync;
|
|
21
|
-
const execFile = require('child_process').execFile;
|
|
22
|
-
|
|
23
|
-
const _platform = process.platform;
|
|
24
|
-
|
|
25
|
-
const _linux = _platform === 'linux' || _platform === 'android';
|
|
26
|
-
const _darwin = _platform === 'darwin';
|
|
27
|
-
const _windows = _platform === 'win32';
|
|
28
|
-
const _freebsd = _platform === 'freebsd';
|
|
29
|
-
const _openbsd = _platform === 'openbsd';
|
|
30
|
-
const _netbsd = _platform === 'netbsd';
|
|
31
|
-
const _sunos = _platform === 'sunos';
|
|
32
|
-
|
|
33
|
-
// --------------------------
|
|
34
|
-
// Get current time and OS uptime
|
|
35
|
-
|
|
36
|
-
function time() {
|
|
37
|
-
const t = new Date().toString().split(' ');
|
|
38
|
-
let timezoneName = '';
|
|
39
|
-
try {
|
|
40
|
-
timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
41
|
-
} catch {
|
|
42
|
-
timezoneName = t.length >= 7 ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : '';
|
|
43
|
-
}
|
|
44
|
-
const result = {
|
|
45
|
-
current: Date.now(),
|
|
46
|
-
uptime: os.uptime(),
|
|
47
|
-
timezone: t.length >= 7 ? t[5] : '',
|
|
48
|
-
timezoneName
|
|
49
|
-
};
|
|
50
|
-
if (_darwin || _linux) {
|
|
51
|
-
try {
|
|
52
|
-
const stdout = execSync('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null', util.execOptsLinux);
|
|
53
|
-
const lines = stdout.toString().split(os.EOL);
|
|
54
|
-
if (lines.length > 3 && !lines[0]) {
|
|
55
|
-
lines.shift();
|
|
56
|
-
}
|
|
57
|
-
let timezone = lines[0] || '';
|
|
58
|
-
if (timezone.startsWith('+') || timezone.startsWith('-')) {
|
|
59
|
-
timezone = 'GMT';
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
current: Date.now(),
|
|
63
|
-
uptime: os.uptime(),
|
|
64
|
-
timezone: lines[1] ? timezone + lines[1] : timezone,
|
|
65
|
-
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? lines[2].split('/zoneinfo/')[1] || '' : ''
|
|
66
|
-
};
|
|
67
|
-
} catch {
|
|
68
|
-
util.noop();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
exports.time = time;
|
|
75
|
-
|
|
76
|
-
// --------------------------
|
|
77
|
-
// Get logo filename of OS distribution
|
|
78
|
-
|
|
79
|
-
function getLogoFile(distro) {
|
|
80
|
-
distro = distro || '';
|
|
81
|
-
distro = distro.toLowerCase();
|
|
82
|
-
let result = _platform;
|
|
83
|
-
if (_windows) {
|
|
84
|
-
result = 'windows';
|
|
85
|
-
} else if (distro.indexOf('mac os') !== -1 || distro.indexOf('macos') !== -1) {
|
|
86
|
-
result = 'apple';
|
|
87
|
-
} else if (distro.indexOf('arch') !== -1) {
|
|
88
|
-
result = 'arch';
|
|
89
|
-
} else if (distro.indexOf('cachy') !== -1) {
|
|
90
|
-
result = 'cachy';
|
|
91
|
-
} else if (distro.indexOf('centos') !== -1) {
|
|
92
|
-
result = 'centos';
|
|
93
|
-
} else if (distro.indexOf('coreos') !== -1) {
|
|
94
|
-
result = 'coreos';
|
|
95
|
-
} else if (distro.indexOf('debian') !== -1) {
|
|
96
|
-
result = 'debian';
|
|
97
|
-
} else if (distro.indexOf('deepin') !== -1) {
|
|
98
|
-
result = 'deepin';
|
|
99
|
-
} else if (distro.indexOf('elementary') !== -1) {
|
|
100
|
-
result = 'elementary';
|
|
101
|
-
} else if (distro.indexOf('endeavour') !== -1) {
|
|
102
|
-
result = 'endeavour';
|
|
103
|
-
} else if (distro.indexOf('fedora') !== -1) {
|
|
104
|
-
result = 'fedora';
|
|
105
|
-
} else if (distro.indexOf('gentoo') !== -1) {
|
|
106
|
-
result = 'gentoo';
|
|
107
|
-
} else if (distro.indexOf('mageia') !== -1) {
|
|
108
|
-
result = 'mageia';
|
|
109
|
-
} else if (distro.indexOf('mandriva') !== -1) {
|
|
110
|
-
result = 'mandriva';
|
|
111
|
-
} else if (distro.indexOf('manjaro') !== -1) {
|
|
112
|
-
result = 'manjaro';
|
|
113
|
-
} else if (distro.indexOf('mint') !== -1) {
|
|
114
|
-
result = 'mint';
|
|
115
|
-
} else if (distro.indexOf('mx') !== -1) {
|
|
116
|
-
result = 'mx';
|
|
117
|
-
} else if (distro.indexOf('openbsd') !== -1) {
|
|
118
|
-
result = 'openbsd';
|
|
119
|
-
} else if (distro.indexOf('freebsd') !== -1) {
|
|
120
|
-
result = 'freebsd';
|
|
121
|
-
} else if (distro.indexOf('opensuse') !== -1) {
|
|
122
|
-
result = 'opensuse';
|
|
123
|
-
} else if (distro.indexOf('pclinuxos') !== -1) {
|
|
124
|
-
result = 'pclinuxos';
|
|
125
|
-
} else if (distro.indexOf('puppy') !== -1) {
|
|
126
|
-
result = 'puppy';
|
|
127
|
-
} else if (distro.indexOf('popos') !== -1) {
|
|
128
|
-
result = 'popos';
|
|
129
|
-
} else if (distro.indexOf('raspbian') !== -1) {
|
|
130
|
-
result = 'raspbian';
|
|
131
|
-
} else if (distro.indexOf('reactos') !== -1) {
|
|
132
|
-
result = 'reactos';
|
|
133
|
-
} else if (distro.indexOf('redhat') !== -1) {
|
|
134
|
-
result = 'redhat';
|
|
135
|
-
} else if (distro.indexOf('slackware') !== -1) {
|
|
136
|
-
result = 'slackware';
|
|
137
|
-
} else if (distro.indexOf('sugar') !== -1) {
|
|
138
|
-
result = 'sugar';
|
|
139
|
-
} else if (distro.indexOf('steam') !== -1) {
|
|
140
|
-
result = 'steam';
|
|
141
|
-
} else if (distro.indexOf('suse') !== -1) {
|
|
142
|
-
result = 'suse';
|
|
143
|
-
} else if (distro.indexOf('mate') !== -1) {
|
|
144
|
-
result = 'ubuntu-mate';
|
|
145
|
-
} else if (distro.indexOf('lubuntu') !== -1) {
|
|
146
|
-
result = 'lubuntu';
|
|
147
|
-
} else if (distro.indexOf('xubuntu') !== -1) {
|
|
148
|
-
result = 'xubuntu';
|
|
149
|
-
} else if (distro.indexOf('ubuntu') !== -1) {
|
|
150
|
-
result = 'ubuntu';
|
|
151
|
-
} else if (distro.indexOf('solaris') !== -1) {
|
|
152
|
-
result = 'solaris';
|
|
153
|
-
} else if (distro.indexOf('tails') !== -1) {
|
|
154
|
-
result = 'tails';
|
|
155
|
-
} else if (distro.indexOf('feren') !== -1) {
|
|
156
|
-
result = 'ferenos';
|
|
157
|
-
} else if (distro.indexOf('robolinux') !== -1) {
|
|
158
|
-
result = 'robolinux';
|
|
159
|
-
} else if (_linux && distro) {
|
|
160
|
-
result = distro.toLowerCase().trim().replace(/\s+/g, '-');
|
|
161
|
-
}
|
|
162
|
-
return result;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const WINDOWS_RELEASES = [
|
|
166
|
-
[26200, '25H2'],
|
|
167
|
-
[26100, '24H2'],
|
|
168
|
-
[22631, '23H2'],
|
|
169
|
-
[22621, '22H2'],
|
|
170
|
-
[19045, '22H2'],
|
|
171
|
-
[22000, '21H2'],
|
|
172
|
-
[19044, '21H2'],
|
|
173
|
-
[19043, '21H1'],
|
|
174
|
-
[19042, '20H2'],
|
|
175
|
-
[19041, '2004'],
|
|
176
|
-
[18363, '1909'],
|
|
177
|
-
[18362, '1903'],
|
|
178
|
-
[17763, '1809'],
|
|
179
|
-
[17134, '1803']
|
|
180
|
-
];
|
|
181
|
-
|
|
182
|
-
function getWindowsRelease(build) {
|
|
183
|
-
for (const [minBuild, label] of WINDOWS_RELEASES) {
|
|
184
|
-
if (build >= minBuild) return label;
|
|
185
|
-
}
|
|
186
|
-
return '';
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// --------------------------
|
|
190
|
-
// FQDN
|
|
191
|
-
|
|
192
|
-
function getFQDN() {
|
|
193
|
-
let fqdn = os.hostname();
|
|
194
|
-
if (_linux || _darwin) {
|
|
195
|
-
try {
|
|
196
|
-
const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux);
|
|
197
|
-
fqdn = stdout.toString().split(os.EOL)[0];
|
|
198
|
-
} catch {
|
|
199
|
-
util.noop();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (_freebsd || _openbsd || _netbsd) {
|
|
203
|
-
try {
|
|
204
|
-
const stdout = execSync('hostname 2>/dev/null');
|
|
205
|
-
fqdn = stdout.toString().split(os.EOL)[0];
|
|
206
|
-
} catch {
|
|
207
|
-
util.noop();
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (_windows) {
|
|
211
|
-
try {
|
|
212
|
-
const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin);
|
|
213
|
-
fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0];
|
|
214
|
-
} catch {
|
|
215
|
-
util.noop();
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return fqdn;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// --------------------------
|
|
222
|
-
// OS Information
|
|
223
|
-
|
|
224
|
-
function osInfo(callback) {
|
|
225
|
-
return new Promise((resolve) => {
|
|
226
|
-
process.nextTick(() => {
|
|
227
|
-
let result = {
|
|
228
|
-
platform: _platform === 'win32' ? 'Windows' : _platform,
|
|
229
|
-
distro: 'unknown',
|
|
230
|
-
release: 'unknown',
|
|
231
|
-
codename: '',
|
|
232
|
-
kernel: os.release(),
|
|
233
|
-
arch: os.arch(),
|
|
234
|
-
hostname: os.hostname(),
|
|
235
|
-
fqdn: getFQDN(),
|
|
236
|
-
codepage: '',
|
|
237
|
-
logofile: '',
|
|
238
|
-
serial: '',
|
|
239
|
-
build: '',
|
|
240
|
-
servicepack: '',
|
|
241
|
-
uefi: false
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
if (_linux) {
|
|
245
|
-
exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', (error, stdout) => {
|
|
246
|
-
/**
|
|
247
|
-
* @namespace
|
|
248
|
-
* @property {string} DISTRIB_ID
|
|
249
|
-
* @property {string} NAME
|
|
250
|
-
* @property {string} DISTRIB_RELEASE
|
|
251
|
-
* @property {string} VERSION_ID
|
|
252
|
-
* @property {string} DISTRIB_CODENAME
|
|
253
|
-
*/
|
|
254
|
-
let release = {};
|
|
255
|
-
let lines = stdout.toString().split('\n');
|
|
256
|
-
lines.forEach((line) => {
|
|
257
|
-
if (line.indexOf('=') !== -1) {
|
|
258
|
-
release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim();
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
result.distro = (release.DISTRIB_ID || release.NAME || 'unknown').replace(/"/g, '');
|
|
262
|
-
result.logofile = getLogoFile(result.distro);
|
|
263
|
-
let releaseVersion = (release.VERSION || '').replace(/"/g, '');
|
|
264
|
-
let codename = (release.DISTRIB_CODENAME || release.VERSION_CODENAME || '').replace(/"/g, '');
|
|
265
|
-
const prettyName = (release.PRETTY_NAME || '').replace(/"/g, '');
|
|
266
|
-
if (prettyName.indexOf(result.distro + ' ') === 0) {
|
|
267
|
-
releaseVersion = prettyName.replace(result.distro + ' ', '').trim();
|
|
268
|
-
}
|
|
269
|
-
if (releaseVersion.indexOf('(') >= 0) {
|
|
270
|
-
codename = releaseVersion.split('(')[1].replace(/[()]/g, '').trim();
|
|
271
|
-
releaseVersion = releaseVersion.split('(')[0].trim();
|
|
272
|
-
}
|
|
273
|
-
result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, '');
|
|
274
|
-
result.codename = codename;
|
|
275
|
-
result.codepage = util.getCodepage();
|
|
276
|
-
result.build = (release.BUILD_ID || '').replace(/"/g, '').trim();
|
|
277
|
-
isUefiLinux().then((uefi) => {
|
|
278
|
-
result.uefi = uefi;
|
|
279
|
-
uuid().then((data) => {
|
|
280
|
-
result.serial = data.os;
|
|
281
|
-
if (callback) {
|
|
282
|
-
callback(result);
|
|
283
|
-
}
|
|
284
|
-
resolve(result);
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
if (_freebsd || _openbsd || _netbsd) {
|
|
290
|
-
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', (error, stdout) => {
|
|
291
|
-
let lines = stdout.toString().split('\n');
|
|
292
|
-
const distro = util.getValue(lines, 'kern.ostype');
|
|
293
|
-
const logofile = getLogoFile(distro);
|
|
294
|
-
const release = util.getValue(lines, 'kern.osrelease').split('-')[0];
|
|
295
|
-
const serial = util.getValue(lines, 'kern.hostuuid');
|
|
296
|
-
const bootmethod = util.getValue(lines, 'machdep.bootmethod');
|
|
297
|
-
const uefiConf = stdout.toString().indexOf('<type>efi</type>') >= 0;
|
|
298
|
-
const uefi = bootmethod ? bootmethod.toLowerCase().indexOf('uefi') >= 0 : uefiConf ? uefiConf : null;
|
|
299
|
-
result.distro = distro || result.distro;
|
|
300
|
-
result.logofile = logofile || result.logofile;
|
|
301
|
-
result.release = release || result.release;
|
|
302
|
-
result.serial = serial || result.serial;
|
|
303
|
-
result.codename = '';
|
|
304
|
-
result.codepage = util.getCodepage();
|
|
305
|
-
result.uefi = uefi || null;
|
|
306
|
-
if (callback) {
|
|
307
|
-
callback(result);
|
|
308
|
-
}
|
|
309
|
-
resolve(result);
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
if (_darwin) {
|
|
313
|
-
exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', (error, stdout) => {
|
|
314
|
-
let lines = stdout.toString().split('\n');
|
|
315
|
-
result.serial = util.getValue(lines, 'kern.uuid');
|
|
316
|
-
result.distro = util.getValue(lines, 'ProductName');
|
|
317
|
-
result.release = (util.getValue(lines, 'ProductVersion', ':', true, true) + ' ' + util.getValue(lines, 'ProductVersionExtra', ':', true, true)).trim();
|
|
318
|
-
result.build = util.getValue(lines, 'BuildVersion');
|
|
319
|
-
result.logofile = getLogoFile(result.distro);
|
|
320
|
-
result.codename = 'macOS';
|
|
321
|
-
result.codename = result.release.indexOf('10.4') > -1 ? 'OS X Tiger' : result.codename;
|
|
322
|
-
result.codename = result.release.indexOf('10.5') > -1 ? 'OS X Leopard' : result.codename;
|
|
323
|
-
result.codename = result.release.indexOf('10.6') > -1 ? 'OS X Snow Leopard' : result.codename;
|
|
324
|
-
result.codename = result.release.indexOf('10.7') > -1 ? 'OS X Lion' : result.codename;
|
|
325
|
-
result.codename = result.release.indexOf('10.8') > -1 ? 'OS X Mountain Lion' : result.codename;
|
|
326
|
-
result.codename = result.release.indexOf('10.9') > -1 ? 'OS X Mavericks' : result.codename;
|
|
327
|
-
result.codename = result.release.indexOf('10.10') > -1 ? 'OS X Yosemite' : result.codename;
|
|
328
|
-
result.codename = result.release.indexOf('10.11') > -1 ? 'OS X El Capitan' : result.codename;
|
|
329
|
-
result.codename = result.release.indexOf('10.12') > -1 ? 'Sierra' : result.codename;
|
|
330
|
-
result.codename = result.release.indexOf('10.13') > -1 ? 'High Sierra' : result.codename;
|
|
331
|
-
result.codename = result.release.indexOf('10.14') > -1 ? 'Mojave' : result.codename;
|
|
332
|
-
result.codename = result.release.indexOf('10.15') > -1 ? 'Catalina' : result.codename;
|
|
333
|
-
result.codename = result.release.startsWith('11.') ? 'Big Sur' : result.codename;
|
|
334
|
-
result.codename = result.release.startsWith('12.') ? 'Monterey' : result.codename;
|
|
335
|
-
result.codename = result.release.startsWith('13.') ? 'Ventura' : result.codename;
|
|
336
|
-
result.codename = result.release.startsWith('14.') ? 'Sonoma' : result.codename;
|
|
337
|
-
result.codename = result.release.startsWith('15.') ? 'Sequoia' : result.codename;
|
|
338
|
-
result.codename = result.release.startsWith('26.') ? 'Tahoe' : result.codename;
|
|
339
|
-
result.uefi = true;
|
|
340
|
-
result.codepage = util.getCodepage();
|
|
341
|
-
if (callback) {
|
|
342
|
-
callback(result);
|
|
343
|
-
}
|
|
344
|
-
resolve(result);
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
if (_sunos) {
|
|
348
|
-
result.release = result.kernel;
|
|
349
|
-
exec('uname -o', (error, stdout) => {
|
|
350
|
-
const lines = stdout.toString().split('\n');
|
|
351
|
-
result.distro = lines[0];
|
|
352
|
-
result.logofile = getLogoFile(result.distro);
|
|
353
|
-
if (callback) {
|
|
354
|
-
callback(result);
|
|
355
|
-
}
|
|
356
|
-
resolve(result);
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
if (_windows) {
|
|
360
|
-
result.logofile = getLogoFile();
|
|
361
|
-
result.release = result.kernel;
|
|
362
|
-
try {
|
|
363
|
-
const workload = [];
|
|
364
|
-
workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
|
|
365
|
-
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
|
366
|
-
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
|
|
367
|
-
workload.push(util.powerShell('reg query "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" /v DisplayVersion'));
|
|
368
|
-
util.promiseAll(workload).then((data) => {
|
|
369
|
-
const lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
|
|
370
|
-
result.distro = util.getValue(lines, 'Caption', ':').trim();
|
|
371
|
-
result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
|
|
372
|
-
result.build = util.getValue(lines, 'BuildNumber', ':').trim();
|
|
373
|
-
result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim();
|
|
374
|
-
result.codepage = util.getCodepage();
|
|
375
|
-
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
|
|
376
|
-
result.hypervisor = hyperv.indexOf('true') !== -1;
|
|
377
|
-
const term = data.results[2] ? data.results[2].toString() : '';
|
|
378
|
-
if (data.results[3]) {
|
|
379
|
-
const codenameParts = data.results[3].split('REG_SZ');
|
|
380
|
-
result.codename = codenameParts.length > 1 ? codenameParts[1].trim() : '';
|
|
381
|
-
}
|
|
382
|
-
if (!result.codename) {
|
|
383
|
-
const buildNum = parseInt(result.build, 10);
|
|
384
|
-
result.codename = getWindowsRelease(buildNum);
|
|
385
|
-
}
|
|
386
|
-
result.remoteSession = term.toString().toLowerCase().indexOf('true') >= 0;
|
|
387
|
-
isUefiWindows().then((uefi) => {
|
|
388
|
-
result.uefi = uefi;
|
|
389
|
-
if (callback) {
|
|
390
|
-
callback(result);
|
|
391
|
-
}
|
|
392
|
-
resolve(result);
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
} catch {
|
|
396
|
-
if (callback) {
|
|
397
|
-
callback(result);
|
|
398
|
-
}
|
|
399
|
-
resolve(result);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
exports.osInfo = osInfo;
|
|
407
|
-
|
|
408
|
-
function isUefiLinux() {
|
|
409
|
-
return new Promise((resolve) => {
|
|
410
|
-
process.nextTick(() => {
|
|
411
|
-
fs.stat('/sys/firmware/efi', (err) => {
|
|
412
|
-
if (!err) {
|
|
413
|
-
return resolve(true);
|
|
414
|
-
} else {
|
|
415
|
-
exec('dmesg | grep -E "EFI v"', (error, stdout) => {
|
|
416
|
-
if (!error) {
|
|
417
|
-
const lines = stdout.toString().split('\n');
|
|
418
|
-
return resolve(lines.length > 0);
|
|
419
|
-
}
|
|
420
|
-
return resolve(false);
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
function isUefiWindows() {
|
|
429
|
-
return new Promise((resolve) => {
|
|
430
|
-
process.nextTick(() => {
|
|
431
|
-
try {
|
|
432
|
-
exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, (error, stdout) => {
|
|
433
|
-
if (!error) {
|
|
434
|
-
const line = stdout.toString().split('\n\r')[0];
|
|
435
|
-
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
|
436
|
-
} else {
|
|
437
|
-
exec('echo %firmware_type%', util.execOptsWin, (error, stdout) => {
|
|
438
|
-
if (!error) {
|
|
439
|
-
const line = stdout.toString() || '';
|
|
440
|
-
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
|
441
|
-
} else {
|
|
442
|
-
return resolve(false);
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
} catch {
|
|
448
|
-
return resolve(false);
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function versions(apps, callback) {
|
|
455
|
-
let versionObject = {
|
|
456
|
-
kernel: os.release(),
|
|
457
|
-
apache: '',
|
|
458
|
-
bash: '',
|
|
459
|
-
bun: '',
|
|
460
|
-
deno: '',
|
|
461
|
-
docker: '',
|
|
462
|
-
dotnet: '',
|
|
463
|
-
fish: '',
|
|
464
|
-
gcc: '',
|
|
465
|
-
git: '',
|
|
466
|
-
grunt: '',
|
|
467
|
-
gulp: '',
|
|
468
|
-
homebrew: '',
|
|
469
|
-
java: '',
|
|
470
|
-
mongodb: '',
|
|
471
|
-
mysql: '',
|
|
472
|
-
nginx: '',
|
|
473
|
-
node: '', //process.versions.node,
|
|
474
|
-
npm: '',
|
|
475
|
-
openssl: '',
|
|
476
|
-
perl: '',
|
|
477
|
-
php: '',
|
|
478
|
-
pip3: '',
|
|
479
|
-
pip: '',
|
|
480
|
-
pm2: '',
|
|
481
|
-
postfix: '',
|
|
482
|
-
postgresql: '',
|
|
483
|
-
powershell: '',
|
|
484
|
-
python3: '',
|
|
485
|
-
python: '',
|
|
486
|
-
redis: '',
|
|
487
|
-
systemOpenssl: '',
|
|
488
|
-
systemOpensslLib: '',
|
|
489
|
-
tsc: '',
|
|
490
|
-
v8: process.versions.v8,
|
|
491
|
-
virtualbox: '',
|
|
492
|
-
yarn: '',
|
|
493
|
-
zsh: ''
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
function checkVersionParam(apps) {
|
|
497
|
-
if (apps === '*') {
|
|
498
|
-
return {
|
|
499
|
-
versions: versionObject,
|
|
500
|
-
counter: 34
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
if (!Array.isArray(apps)) {
|
|
504
|
-
apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|');
|
|
505
|
-
apps = apps.split('|');
|
|
506
|
-
const result = {
|
|
507
|
-
versions: {},
|
|
508
|
-
counter: 0
|
|
509
|
-
};
|
|
510
|
-
apps.forEach((el) => {
|
|
511
|
-
if (el) {
|
|
512
|
-
for (let key in versionObject) {
|
|
513
|
-
if ({}.hasOwnProperty.call(versionObject, key)) {
|
|
514
|
-
if (key.toLowerCase() === el.toLowerCase() && !{}.hasOwnProperty.call(result.versions, key)) {
|
|
515
|
-
result.versions[key] = versionObject[key];
|
|
516
|
-
if (key === 'openssl') {
|
|
517
|
-
result.versions.systemOpenssl = '';
|
|
518
|
-
result.versions.systemOpensslLib = '';
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
if (!result.versions[key]) {
|
|
522
|
-
result.counter++;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
return result;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
return new Promise((resolve) => {
|
|
534
|
-
process.nextTick(() => {
|
|
535
|
-
if (util.isFunction(apps) && !callback) {
|
|
536
|
-
callback = apps;
|
|
537
|
-
apps = '*';
|
|
538
|
-
} else {
|
|
539
|
-
apps = apps || '*';
|
|
540
|
-
if (typeof apps !== 'string') {
|
|
541
|
-
if (callback) {
|
|
542
|
-
callback({});
|
|
543
|
-
}
|
|
544
|
-
return resolve({});
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
const appsObj = checkVersionParam(apps);
|
|
548
|
-
let totalFunctions = appsObj.counter;
|
|
549
|
-
|
|
550
|
-
if (totalFunctions <= 0) {
|
|
551
|
-
if (callback) {
|
|
552
|
-
callback(appsObj.versions);
|
|
553
|
-
}
|
|
554
|
-
return resolve(appsObj.versions);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
let functionProcessed = (() => {
|
|
558
|
-
return () => {
|
|
559
|
-
if (--totalFunctions === 0) {
|
|
560
|
-
if (callback) {
|
|
561
|
-
callback(appsObj.versions);
|
|
562
|
-
}
|
|
563
|
-
resolve(appsObj.versions);
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
})();
|
|
567
|
-
|
|
568
|
-
let cmd = '';
|
|
569
|
-
try {
|
|
570
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) {
|
|
571
|
-
appsObj.versions.openssl = process.versions.openssl;
|
|
572
|
-
exec('openssl version', (error, stdout) => {
|
|
573
|
-
if (!error) {
|
|
574
|
-
let openssl_string = stdout.toString().split('\n')[0].trim();
|
|
575
|
-
let openssl = openssl_string.split(' ');
|
|
576
|
-
appsObj.versions.systemOpenssl = openssl.length > 0 ? openssl[1] : openssl[0];
|
|
577
|
-
appsObj.versions.systemOpensslLib = openssl.length > 0 ? openssl[0] : 'openssl';
|
|
578
|
-
}
|
|
579
|
-
functionProcessed();
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) {
|
|
583
|
-
exec('npm -v', (error, stdout) => {
|
|
584
|
-
if (!error) {
|
|
585
|
-
appsObj.versions.npm = stdout.toString().split('\n')[0];
|
|
586
|
-
}
|
|
587
|
-
functionProcessed();
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'pm2')) {
|
|
591
|
-
cmd = 'pm2';
|
|
592
|
-
if (_windows) {
|
|
593
|
-
cmd += '.cmd';
|
|
594
|
-
}
|
|
595
|
-
exec(`${cmd} -v`, (error, stdout) => {
|
|
596
|
-
if (!error) {
|
|
597
|
-
let pm2 = stdout.toString().split('\n')[0].trim();
|
|
598
|
-
if (!pm2.startsWith('[PM2]')) {
|
|
599
|
-
appsObj.versions.pm2 = pm2;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
functionProcessed();
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) {
|
|
606
|
-
exec('yarn --version', (error, stdout) => {
|
|
607
|
-
if (!error) {
|
|
608
|
-
appsObj.versions.yarn = stdout.toString().split('\n')[0];
|
|
609
|
-
}
|
|
610
|
-
functionProcessed();
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'gulp')) {
|
|
614
|
-
cmd = 'gulp';
|
|
615
|
-
if (_windows) {
|
|
616
|
-
cmd += '.cmd';
|
|
617
|
-
}
|
|
618
|
-
exec(`${cmd} --version`, (error, stdout) => {
|
|
619
|
-
if (!error) {
|
|
620
|
-
const gulp = stdout.toString().split('\n')[0] || '';
|
|
621
|
-
appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim();
|
|
622
|
-
}
|
|
623
|
-
functionProcessed();
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'homebrew')) {
|
|
627
|
-
cmd = 'brew';
|
|
628
|
-
exec(`${cmd} --version`, (error, stdout) => {
|
|
629
|
-
if (!error) {
|
|
630
|
-
const brew = stdout.toString().split('\n')[0] || '';
|
|
631
|
-
appsObj.versions.homebrew = (brew.toLowerCase().split(' ')[1] || '').trim();
|
|
632
|
-
}
|
|
633
|
-
functionProcessed();
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'tsc')) {
|
|
637
|
-
cmd = 'tsc';
|
|
638
|
-
if (_windows) {
|
|
639
|
-
cmd += '.cmd';
|
|
640
|
-
}
|
|
641
|
-
exec(`${cmd} --version`, (error, stdout) => {
|
|
642
|
-
if (!error) {
|
|
643
|
-
const tsc = stdout.toString().split('\n')[0] || '';
|
|
644
|
-
appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim();
|
|
645
|
-
}
|
|
646
|
-
functionProcessed();
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'grunt')) {
|
|
650
|
-
cmd = 'grunt';
|
|
651
|
-
if (_windows) {
|
|
652
|
-
cmd += '.cmd';
|
|
653
|
-
}
|
|
654
|
-
exec(`${cmd} --version`, (error, stdout) => {
|
|
655
|
-
if (!error) {
|
|
656
|
-
const grunt = stdout.toString().split('\n')[0] || '';
|
|
657
|
-
appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim();
|
|
658
|
-
}
|
|
659
|
-
functionProcessed();
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'git')) {
|
|
663
|
-
if (_darwin) {
|
|
664
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
|
|
665
|
-
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
666
|
-
exec('git --version', (error, stdout) => {
|
|
667
|
-
if (!error) {
|
|
668
|
-
let git = stdout.toString().split('\n')[0] || '';
|
|
669
|
-
git = (git.toLowerCase().split('version')[1] || '').trim();
|
|
670
|
-
appsObj.versions.git = (git.split(' ')[0] || '').trim();
|
|
671
|
-
}
|
|
672
|
-
functionProcessed();
|
|
673
|
-
});
|
|
674
|
-
} else {
|
|
675
|
-
functionProcessed();
|
|
676
|
-
}
|
|
677
|
-
} else {
|
|
678
|
-
exec('git --version', (error, stdout) => {
|
|
679
|
-
if (!error) {
|
|
680
|
-
let git = stdout.toString().split('\n')[0] || '';
|
|
681
|
-
git = (git.toLowerCase().split('version')[1] || '').trim();
|
|
682
|
-
appsObj.versions.git = (git.split(' ')[0] || '').trim();
|
|
683
|
-
}
|
|
684
|
-
functionProcessed();
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) {
|
|
689
|
-
exec('apachectl -v 2>&1', (error, stdout) => {
|
|
690
|
-
if (!error) {
|
|
691
|
-
const apache = (stdout.toString().split('\n')[0] || '').split(':');
|
|
692
|
-
appsObj.versions.apache = apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : '';
|
|
693
|
-
}
|
|
694
|
-
functionProcessed();
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) {
|
|
698
|
-
exec('nginx -v 2>&1', (error, stdout) => {
|
|
699
|
-
if (!error) {
|
|
700
|
-
const nginx = stdout.toString().split('\n')[0] || '';
|
|
701
|
-
appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim();
|
|
702
|
-
}
|
|
703
|
-
functionProcessed();
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) {
|
|
707
|
-
exec('mysql -V', (error, stdout) => {
|
|
708
|
-
if (!error) {
|
|
709
|
-
let mysql = stdout.toString().split('\n')[0] || '';
|
|
710
|
-
mysql = mysql.toLowerCase();
|
|
711
|
-
if (mysql.indexOf(',') > -1) {
|
|
712
|
-
mysql = (mysql.split(',')[0] || '').trim();
|
|
713
|
-
const parts = mysql.split(' ');
|
|
714
|
-
appsObj.versions.mysql = (parts[parts.length - 1] || '').trim();
|
|
715
|
-
} else {
|
|
716
|
-
if (mysql.indexOf(' ver ') > -1) {
|
|
717
|
-
mysql = mysql.split(' ver ')[1];
|
|
718
|
-
appsObj.versions.mysql = mysql.split(' ')[0];
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
functionProcessed();
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'php')) {
|
|
726
|
-
exec('php -v', (error, stdout) => {
|
|
727
|
-
if (!error) {
|
|
728
|
-
const php = stdout.toString().split('\n')[0] || '';
|
|
729
|
-
let parts = php.split('(');
|
|
730
|
-
if (parts[0].indexOf('-')) {
|
|
731
|
-
parts = parts[0].split('-');
|
|
732
|
-
}
|
|
733
|
-
appsObj.versions.php = parts[0].replace(/[^0-9.]/g, '');
|
|
734
|
-
}
|
|
735
|
-
functionProcessed();
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) {
|
|
739
|
-
exec('redis-server --version', (error, stdout) => {
|
|
740
|
-
if (!error) {
|
|
741
|
-
const redis = stdout.toString().split('\n')[0] || '';
|
|
742
|
-
const parts = redis.split(' ');
|
|
743
|
-
appsObj.versions.redis = util.getValue(parts, 'v', '=', true);
|
|
744
|
-
}
|
|
745
|
-
functionProcessed();
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) {
|
|
749
|
-
exec('docker --version', (error, stdout) => {
|
|
750
|
-
if (!error) {
|
|
751
|
-
const docker = stdout.toString().split('\n')[0] || '';
|
|
752
|
-
const parts = docker.split(' ');
|
|
753
|
-
appsObj.versions.docker = parts.length > 2 && parts[2].endsWith(',') ? parts[2].slice(0, -1) : '';
|
|
754
|
-
}
|
|
755
|
-
functionProcessed();
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) {
|
|
759
|
-
exec('postconf -d | grep mail_version', (error, stdout) => {
|
|
760
|
-
if (!error) {
|
|
761
|
-
const postfix = stdout.toString().split('\n') || [];
|
|
762
|
-
appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true);
|
|
763
|
-
}
|
|
764
|
-
functionProcessed();
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) {
|
|
768
|
-
exec('mongod --version', (error, stdout) => {
|
|
769
|
-
if (!error) {
|
|
770
|
-
const mongodb = stdout.toString().split('\n')[0] || '';
|
|
771
|
-
appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
|
|
772
|
-
}
|
|
773
|
-
functionProcessed();
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) {
|
|
777
|
-
if (_linux) {
|
|
778
|
-
exec('locate bin/postgres', (error, stdout) => {
|
|
779
|
-
if (!error) {
|
|
780
|
-
const safePath = /^[a-zA-Z0-9/_.-]+$/;
|
|
781
|
-
const postgresqlBin = stdout
|
|
782
|
-
.toString()
|
|
783
|
-
.split('\n')
|
|
784
|
-
.filter((p) => safePath.test(p.trim()))
|
|
785
|
-
.sort();
|
|
786
|
-
if (postgresqlBin.length) {
|
|
787
|
-
execFile(postgresqlBin[postgresqlBin.length - 1], ['-V'], (error, stdout) => {
|
|
788
|
-
if (!error) {
|
|
789
|
-
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
790
|
-
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
791
|
-
}
|
|
792
|
-
functionProcessed();
|
|
793
|
-
});
|
|
794
|
-
} else {
|
|
795
|
-
functionProcessed();
|
|
796
|
-
}
|
|
797
|
-
} else {
|
|
798
|
-
exec('psql -V', (error, stdout) => {
|
|
799
|
-
if (!error) {
|
|
800
|
-
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
801
|
-
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
802
|
-
appsObj.versions.postgresql = appsObj.versions.postgresql.split('-')[0];
|
|
803
|
-
}
|
|
804
|
-
functionProcessed();
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
});
|
|
808
|
-
} else {
|
|
809
|
-
if (_windows) {
|
|
810
|
-
util.powerShell('Get-CimInstance Win32_Service | select caption | fl').then((stdout) => {
|
|
811
|
-
let serviceSections = stdout.split(/\n\s*\n/);
|
|
812
|
-
serviceSections.forEach((item) => {
|
|
813
|
-
if (item.trim() !== '') {
|
|
814
|
-
let lines = item.trim().split('\r\n');
|
|
815
|
-
let srvCaption = util.getValue(lines, 'caption', ':', true).toLowerCase();
|
|
816
|
-
if (srvCaption.indexOf('postgresql') > -1) {
|
|
817
|
-
const parts = srvCaption.split(' server ');
|
|
818
|
-
if (parts.length > 1) {
|
|
819
|
-
appsObj.versions.postgresql = parts[1];
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
functionProcessed();
|
|
825
|
-
});
|
|
826
|
-
} else {
|
|
827
|
-
exec('postgres -V', (error, stdout) => {
|
|
828
|
-
if (!error) {
|
|
829
|
-
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
830
|
-
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
831
|
-
if (appsObj.versions.postgresql.includes('(') && postgresql.length >= 2 && !postgresql[postgresql.length - 2].includes('(')) {
|
|
832
|
-
appsObj.versions.postgresql = postgresql[postgresql.length - 2];
|
|
833
|
-
}
|
|
834
|
-
functionProcessed();
|
|
835
|
-
} else {
|
|
836
|
-
exec('pg_config --version', (error, stdout) => {
|
|
837
|
-
if (!error) {
|
|
838
|
-
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
839
|
-
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
840
|
-
if (appsObj.versions.postgresql.includes('(') && postgresql.length >= 2 && !postgresql[postgresql.length - 2].includes('(')) {
|
|
841
|
-
appsObj.versions.postgresql = postgresql[postgresql.length - 2];
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
functionProcessed();
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) {
|
|
852
|
-
exec('perl -v', (error, stdout) => {
|
|
853
|
-
if (!error) {
|
|
854
|
-
const perl = stdout.toString().split('\n') || '';
|
|
855
|
-
while (perl.length > 0 && perl[0].trim() === '') {
|
|
856
|
-
perl.shift();
|
|
857
|
-
}
|
|
858
|
-
if (perl.length > 0) {
|
|
859
|
-
appsObj.versions.perl = perl[0].split('(').pop().split(')')[0].replace('v', '');
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
functionProcessed();
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
|
|
866
|
-
if (_darwin) {
|
|
867
|
-
try {
|
|
868
|
-
const stdout = execSync('sw_vers');
|
|
869
|
-
const lines = stdout.toString().split('\n');
|
|
870
|
-
const osVersion = util.getValue(lines, 'ProductVersion', ':');
|
|
871
|
-
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
|
872
|
-
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
|
873
|
-
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
|
874
|
-
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1';
|
|
875
|
-
exec(cmd, (error, stdout) => {
|
|
876
|
-
if (!error) {
|
|
877
|
-
const python = stdout.toString().split('\n')[0] || '';
|
|
878
|
-
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
|
879
|
-
}
|
|
880
|
-
functionProcessed();
|
|
881
|
-
});
|
|
882
|
-
} else {
|
|
883
|
-
functionProcessed();
|
|
884
|
-
}
|
|
885
|
-
} catch {
|
|
886
|
-
functionProcessed();
|
|
887
|
-
}
|
|
888
|
-
} else {
|
|
889
|
-
exec('python -V 2>&1', (error, stdout) => {
|
|
890
|
-
if (!error) {
|
|
891
|
-
const python = stdout.toString().split('\n')[0] || '';
|
|
892
|
-
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
|
893
|
-
}
|
|
894
|
-
functionProcessed();
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'python3')) {
|
|
899
|
-
if (_darwin) {
|
|
900
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
|
|
901
|
-
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
902
|
-
exec('python3 -V 2>&1', (error, stdout) => {
|
|
903
|
-
if (!error) {
|
|
904
|
-
const python = stdout.toString().split('\n')[0] || '';
|
|
905
|
-
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
|
906
|
-
}
|
|
907
|
-
functionProcessed();
|
|
908
|
-
});
|
|
909
|
-
} else {
|
|
910
|
-
functionProcessed();
|
|
911
|
-
}
|
|
912
|
-
} else {
|
|
913
|
-
exec('python3 -V 2>&1', (error, stdout) => {
|
|
914
|
-
if (!error) {
|
|
915
|
-
const python = stdout.toString().split('\n')[0] || '';
|
|
916
|
-
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
|
917
|
-
}
|
|
918
|
-
functionProcessed();
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'pip')) {
|
|
923
|
-
if (_darwin) {
|
|
924
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
|
|
925
|
-
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
926
|
-
exec('pip -V 2>&1', (error, stdout) => {
|
|
927
|
-
if (!error) {
|
|
928
|
-
const pip = stdout.toString().split('\n')[0] || '';
|
|
929
|
-
const parts = pip.split(' ');
|
|
930
|
-
appsObj.versions.pip = parts.length >= 2 ? parts[1] : '';
|
|
931
|
-
}
|
|
932
|
-
functionProcessed();
|
|
933
|
-
});
|
|
934
|
-
} else {
|
|
935
|
-
functionProcessed();
|
|
936
|
-
}
|
|
937
|
-
} else {
|
|
938
|
-
exec('pip -V 2>&1', (error, stdout) => {
|
|
939
|
-
if (!error) {
|
|
940
|
-
const pip = stdout.toString().split('\n')[0] || '';
|
|
941
|
-
const parts = pip.split(' ');
|
|
942
|
-
appsObj.versions.pip = parts.length >= 2 ? parts[1] : '';
|
|
943
|
-
}
|
|
944
|
-
functionProcessed();
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'pip3')) {
|
|
949
|
-
if (_darwin) {
|
|
950
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
|
|
951
|
-
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
952
|
-
exec('pip3 -V 2>&1', (error, stdout) => {
|
|
953
|
-
if (!error) {
|
|
954
|
-
const pip = stdout.toString().split('\n')[0] || '';
|
|
955
|
-
const parts = pip.split(' ');
|
|
956
|
-
appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : '';
|
|
957
|
-
}
|
|
958
|
-
functionProcessed();
|
|
959
|
-
});
|
|
960
|
-
} else {
|
|
961
|
-
functionProcessed();
|
|
962
|
-
}
|
|
963
|
-
} else {
|
|
964
|
-
exec('pip3 -V 2>&1', (error, stdout) => {
|
|
965
|
-
if (!error) {
|
|
966
|
-
const pip = stdout.toString().split('\n')[0] || '';
|
|
967
|
-
const parts = pip.split(' ');
|
|
968
|
-
appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : '';
|
|
969
|
-
}
|
|
970
|
-
functionProcessed();
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'java')) {
|
|
975
|
-
if (_darwin) {
|
|
976
|
-
// check if any JVM is installed but avoid dialog box that Java needs to be installed
|
|
977
|
-
exec('/usr/libexec/java_home -V 2>&1', (error, stdout) => {
|
|
978
|
-
if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) {
|
|
979
|
-
// now this can be done savely
|
|
980
|
-
exec('java -version 2>&1', (error, stdout) => {
|
|
981
|
-
if (!error) {
|
|
982
|
-
const java = stdout.toString().split('\n')[0] || '';
|
|
983
|
-
const parts = java.split('"');
|
|
984
|
-
appsObj.versions.java = parts.length === 3 ? parts[1].trim() : '';
|
|
985
|
-
}
|
|
986
|
-
functionProcessed();
|
|
987
|
-
});
|
|
988
|
-
} else {
|
|
989
|
-
functionProcessed();
|
|
990
|
-
}
|
|
991
|
-
});
|
|
992
|
-
} else {
|
|
993
|
-
exec('java -version 2>&1', (error, stdout) => {
|
|
994
|
-
if (!error) {
|
|
995
|
-
const java = stdout.toString().split('\n')[0] || '';
|
|
996
|
-
const parts = java.split('"');
|
|
997
|
-
appsObj.versions.java = parts.length === 3 ? parts[1].trim() : '';
|
|
998
|
-
}
|
|
999
|
-
functionProcessed();
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) {
|
|
1004
|
-
if ((_darwin && util.darwinXcodeExists()) || !_darwin) {
|
|
1005
|
-
exec('gcc -dumpversion', (error, stdout) => {
|
|
1006
|
-
if (!error) {
|
|
1007
|
-
appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || '';
|
|
1008
|
-
}
|
|
1009
|
-
if (appsObj.versions.gcc.indexOf('.') > -1) {
|
|
1010
|
-
functionProcessed();
|
|
1011
|
-
} else {
|
|
1012
|
-
exec('gcc --version', (error, stdout) => {
|
|
1013
|
-
if (!error) {
|
|
1014
|
-
const gcc = stdout.toString().split('\n')[0].trim();
|
|
1015
|
-
if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) {
|
|
1016
|
-
const parts = gcc.split(')');
|
|
1017
|
-
appsObj.versions.gcc = parts[1].trim() || appsObj.versions.gcc;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
functionProcessed();
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
|
-
});
|
|
1024
|
-
} else {
|
|
1025
|
-
functionProcessed();
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) {
|
|
1029
|
-
exec(util.getVboxmanage() + ' -v 2>&1', (error, stdout) => {
|
|
1030
|
-
if (!error) {
|
|
1031
|
-
const vbox = stdout.toString().split('\n')[0] || '';
|
|
1032
|
-
const parts = vbox.split('r');
|
|
1033
|
-
appsObj.versions.virtualbox = parts[0];
|
|
1034
|
-
}
|
|
1035
|
-
functionProcessed();
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) {
|
|
1039
|
-
exec('bash --version', (error, stdout) => {
|
|
1040
|
-
if (!error) {
|
|
1041
|
-
const line = stdout.toString().split('\n')[0];
|
|
1042
|
-
const parts = line.split(' version ');
|
|
1043
|
-
if (parts.length > 1) {
|
|
1044
|
-
appsObj.versions.bash = parts[1].split(' ')[0].split('(')[0];
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
functionProcessed();
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) {
|
|
1051
|
-
exec('zsh --version', (error, stdout) => {
|
|
1052
|
-
if (!error) {
|
|
1053
|
-
const line = stdout.toString().split('\n')[0];
|
|
1054
|
-
const parts = line.split('zsh ');
|
|
1055
|
-
if (parts.length > 1) {
|
|
1056
|
-
appsObj.versions.zsh = parts[1].split(' ')[0];
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
functionProcessed();
|
|
1060
|
-
});
|
|
1061
|
-
}
|
|
1062
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) {
|
|
1063
|
-
exec('fish --version', (error, stdout) => {
|
|
1064
|
-
if (!error) {
|
|
1065
|
-
const line = stdout.toString().split('\n')[0];
|
|
1066
|
-
const parts = line.split(' version ');
|
|
1067
|
-
if (parts.length > 1) {
|
|
1068
|
-
appsObj.versions.fish = parts[1].split(' ')[0];
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
functionProcessed();
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'bun')) {
|
|
1075
|
-
exec('bun -v', (error, stdout) => {
|
|
1076
|
-
if (!error) {
|
|
1077
|
-
const line = stdout.toString().split('\n')[0].trim();
|
|
1078
|
-
appsObj.versions.bun = line;
|
|
1079
|
-
}
|
|
1080
|
-
functionProcessed();
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1083
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'deno')) {
|
|
1084
|
-
exec('deno -v', (error, stdout) => {
|
|
1085
|
-
if (!error) {
|
|
1086
|
-
const line = stdout.toString().split('\n')[0].trim();
|
|
1087
|
-
const parts = line.split(' ');
|
|
1088
|
-
if (parts.length > 1) {
|
|
1089
|
-
appsObj.versions.deno = parts[1];
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
functionProcessed();
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1095
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'node')) {
|
|
1096
|
-
exec('node -v', (error, stdout) => {
|
|
1097
|
-
if (!error) {
|
|
1098
|
-
let line = stdout.toString().split('\n')[0].trim();
|
|
1099
|
-
if (line.startsWith('v')) {
|
|
1100
|
-
line = line.slice(1);
|
|
1101
|
-
}
|
|
1102
|
-
appsObj.versions.node = line;
|
|
1103
|
-
}
|
|
1104
|
-
functionProcessed();
|
|
1105
|
-
});
|
|
1106
|
-
}
|
|
1107
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) {
|
|
1108
|
-
if (_windows) {
|
|
1109
|
-
util.powerShell('$PSVersionTable').then((stdout) => {
|
|
1110
|
-
const lines = stdout
|
|
1111
|
-
.toString()
|
|
1112
|
-
.toLowerCase()
|
|
1113
|
-
.split('\n')
|
|
1114
|
-
.map((line) => line.replace(/ +/g, ' ').replace(/ +/g, ':'));
|
|
1115
|
-
appsObj.versions.powershell = util.getValue(lines, 'psversion');
|
|
1116
|
-
functionProcessed();
|
|
1117
|
-
});
|
|
1118
|
-
} else {
|
|
1119
|
-
functionProcessed();
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) {
|
|
1123
|
-
if (_windows) {
|
|
1124
|
-
util
|
|
1125
|
-
.powerShell(
|
|
1126
|
-
'gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release'
|
|
1127
|
-
)
|
|
1128
|
-
.then((stdout) => {
|
|
1129
|
-
const lines = stdout.toString().split('\r\n');
|
|
1130
|
-
let dotnet = '';
|
|
1131
|
-
lines.forEach((line) => {
|
|
1132
|
-
line = line.replace(/ +/g, ' ');
|
|
1133
|
-
const parts = line.split(' ');
|
|
1134
|
-
dotnet =
|
|
1135
|
-
dotnet ||
|
|
1136
|
-
(parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : '');
|
|
1137
|
-
});
|
|
1138
|
-
appsObj.versions.dotnet = dotnet.trim();
|
|
1139
|
-
functionProcessed();
|
|
1140
|
-
});
|
|
1141
|
-
} else {
|
|
1142
|
-
functionProcessed();
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
} catch {
|
|
1146
|
-
if (callback) {
|
|
1147
|
-
callback(appsObj.versions);
|
|
1148
|
-
}
|
|
1149
|
-
resolve(appsObj.versions);
|
|
1150
|
-
}
|
|
1151
|
-
});
|
|
1152
|
-
});
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
exports.versions = versions;
|
|
1156
|
-
|
|
1157
|
-
function shell(callback) {
|
|
1158
|
-
return new Promise((resolve) => {
|
|
1159
|
-
process.nextTick(() => {
|
|
1160
|
-
if (_windows) {
|
|
1161
|
-
try {
|
|
1162
|
-
util.powerShell(`Get-CimInstance -className win32_process | where-object {$_.ProcessId -eq ${process.ppid} } | select Name`).then((stdout) => {
|
|
1163
|
-
let result = 'CMD';
|
|
1164
|
-
if (stdout) {
|
|
1165
|
-
if (stdout.toString().toLowerCase().indexOf('powershell') >= 0) {
|
|
1166
|
-
result = 'PowerShell';
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
if (callback) {
|
|
1170
|
-
callback(result);
|
|
1171
|
-
}
|
|
1172
|
-
resolve(result);
|
|
1173
|
-
});
|
|
1174
|
-
} catch {
|
|
1175
|
-
if (callback) {
|
|
1176
|
-
callback('CMD');
|
|
1177
|
-
}
|
|
1178
|
-
resolve('CMD');
|
|
1179
|
-
}
|
|
1180
|
-
} else {
|
|
1181
|
-
let result = '';
|
|
1182
|
-
exec('echo $SHELL', (error, stdout) => {
|
|
1183
|
-
if (!error) {
|
|
1184
|
-
result = stdout.toString().split('\n')[0];
|
|
1185
|
-
}
|
|
1186
|
-
if (callback) {
|
|
1187
|
-
callback(result);
|
|
1188
|
-
}
|
|
1189
|
-
resolve(result);
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
});
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
exports.shell = shell;
|
|
1197
|
-
|
|
1198
|
-
function getUniqueMacAdresses() {
|
|
1199
|
-
let macs = [];
|
|
1200
|
-
try {
|
|
1201
|
-
const ifaces = os.networkInterfaces();
|
|
1202
|
-
for (let dev in ifaces) {
|
|
1203
|
-
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
|
1204
|
-
ifaces[dev].forEach((details) => {
|
|
1205
|
-
if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
|
|
1206
|
-
const mac = details.mac.toLowerCase();
|
|
1207
|
-
if (macs.indexOf(mac) === -1) {
|
|
1208
|
-
macs.push(mac);
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
macs = macs.sort((a, b) => {
|
|
1215
|
-
if (a < b) {
|
|
1216
|
-
return -1;
|
|
1217
|
-
}
|
|
1218
|
-
if (a > b) {
|
|
1219
|
-
return 1;
|
|
1220
|
-
}
|
|
1221
|
-
return 0;
|
|
1222
|
-
});
|
|
1223
|
-
} catch {
|
|
1224
|
-
macs.push('00:00:00:00:00:00');
|
|
1225
|
-
}
|
|
1226
|
-
return macs;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
function uuid(callback) {
|
|
1230
|
-
return new Promise((resolve) => {
|
|
1231
|
-
process.nextTick(() => {
|
|
1232
|
-
let result = {
|
|
1233
|
-
os: '',
|
|
1234
|
-
hardware: '',
|
|
1235
|
-
macs: getUniqueMacAdresses()
|
|
1236
|
-
};
|
|
1237
|
-
let parts;
|
|
1238
|
-
|
|
1239
|
-
if (_darwin) {
|
|
1240
|
-
exec('system_profiler SPHardwareDataType -json', (error, stdout) => {
|
|
1241
|
-
if (!error) {
|
|
1242
|
-
try {
|
|
1243
|
-
const jsonObj = JSON.parse(stdout.toString());
|
|
1244
|
-
if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) {
|
|
1245
|
-
const spHardware = jsonObj.SPHardwareDataType[0];
|
|
1246
|
-
result.os = spHardware.platform_UUID.toLowerCase();
|
|
1247
|
-
result.hardware = spHardware.serial_number;
|
|
1248
|
-
}
|
|
1249
|
-
} catch {
|
|
1250
|
-
util.noop();
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
if (callback) {
|
|
1254
|
-
callback(result);
|
|
1255
|
-
}
|
|
1256
|
-
resolve(result);
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
if (_linux) {
|
|
1260
|
-
const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null ||
|
|
1261
|
-
cat /etc/machine-id 2> /dev/null; echo;
|
|
1262
|
-
echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
1263
|
-
exec(cmd, (error, stdout) => {
|
|
1264
|
-
const lines = stdout.toString().split('\n');
|
|
1265
|
-
result.os = util.getValue(lines, 'os').toLowerCase();
|
|
1266
|
-
result.hardware = util.getValue(lines, 'hardware').toLowerCase();
|
|
1267
|
-
if (!result.hardware) {
|
|
1268
|
-
try {
|
|
1269
|
-
const lines = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
|
|
1270
|
-
const serial = util.getValue(lines, 'serial');
|
|
1271
|
-
result.hardware = serial || '';
|
|
1272
|
-
} catch {
|
|
1273
|
-
result.hardware = '';
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
if (callback) {
|
|
1277
|
-
callback(result);
|
|
1278
|
-
}
|
|
1279
|
-
resolve(result);
|
|
1280
|
-
});
|
|
1281
|
-
}
|
|
1282
|
-
if (_freebsd || _openbsd || _netbsd) {
|
|
1283
|
-
exec('sysctl -i kern.hostid kern.hostuuid', (error, stdout) => {
|
|
1284
|
-
const lines = stdout.toString().split('\n');
|
|
1285
|
-
result.hardware = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
|
1286
|
-
result.os = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
|
1287
|
-
if (result.os.indexOf('unknown') >= 0) {
|
|
1288
|
-
result.os = '';
|
|
1289
|
-
}
|
|
1290
|
-
if (result.hardware.indexOf('unknown') >= 0) {
|
|
1291
|
-
result.hardware = '';
|
|
1292
|
-
}
|
|
1293
|
-
if (callback) {
|
|
1294
|
-
callback(result);
|
|
1295
|
-
}
|
|
1296
|
-
resolve(result);
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
if (_windows) {
|
|
1300
|
-
let sysdir = '%windir%\\System32';
|
|
1301
|
-
if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) {
|
|
1302
|
-
sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
|
|
1303
|
-
}
|
|
1304
|
-
util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
|
|
1305
|
-
let lines = stdout.split('\r\n');
|
|
1306
|
-
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
|
1307
|
-
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, (error, stdout) => {
|
|
1308
|
-
parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
|
|
1309
|
-
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/gi, '').toLowerCase() : '';
|
|
1310
|
-
if (callback) {
|
|
1311
|
-
callback(result);
|
|
1312
|
-
}
|
|
1313
|
-
resolve(result);
|
|
1314
|
-
});
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
});
|
|
1318
|
-
});
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
exports.uuid = uuid;
|