systeminformation 5.33.2 → 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 +882 -931
- 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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkConnections = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const const_1 = require("../common/const");
|
|
6
|
+
const exec_1 = require("../common/exec");
|
|
7
|
+
const networkConnections = async () => {
|
|
8
|
+
await (0, common_1.nextTick)();
|
|
9
|
+
const result = [];
|
|
10
|
+
const { stdout, stderr } = await (0, exec_1.execSave)('netstat -nao', const_1.execOptsWin);
|
|
11
|
+
if (!stderr) {
|
|
12
|
+
const lineParts = stdout.split('\r\n');
|
|
13
|
+
lineParts.forEach((line) => {
|
|
14
|
+
const lineParts = line.trim().replace(/ +/g, ' ').split(' ');
|
|
15
|
+
if (lineParts.length >= 4) {
|
|
16
|
+
let localip = lineParts[1];
|
|
17
|
+
let localport = '';
|
|
18
|
+
const localaddress = lineParts[1].split(':');
|
|
19
|
+
if (localaddress.length > 1) {
|
|
20
|
+
localport = localaddress[localaddress.length - 1];
|
|
21
|
+
localaddress.pop();
|
|
22
|
+
localip = localaddress.join(':');
|
|
23
|
+
}
|
|
24
|
+
localip = localip.replace(/\[/g, '').replace(/\]/g, '');
|
|
25
|
+
let peerip = lineParts[2];
|
|
26
|
+
let peerport = '';
|
|
27
|
+
const peeraddress = lineParts[2].split(':');
|
|
28
|
+
if (peeraddress.length > 1) {
|
|
29
|
+
peerport = peeraddress[peeraddress.length - 1];
|
|
30
|
+
peeraddress.pop();
|
|
31
|
+
peerip = peeraddress.join(':');
|
|
32
|
+
}
|
|
33
|
+
peerip = peerip.replace(/\[/g, '').replace(/\]/g, '');
|
|
34
|
+
const pid = (0, common_1.toInt)(lineParts[4]);
|
|
35
|
+
let connstate = lineParts[3];
|
|
36
|
+
if (connstate === 'HERGESTELLT') {
|
|
37
|
+
connstate = 'ESTABLISHED';
|
|
38
|
+
}
|
|
39
|
+
if (connstate.startsWith('ABH')) {
|
|
40
|
+
connstate = 'LISTEN';
|
|
41
|
+
}
|
|
42
|
+
if (connstate === 'SCHLIESSEN_WARTEN') {
|
|
43
|
+
connstate = 'CLOSE_WAIT';
|
|
44
|
+
}
|
|
45
|
+
if (connstate === 'WARTEND') {
|
|
46
|
+
connstate = 'TIME_WAIT';
|
|
47
|
+
}
|
|
48
|
+
if (connstate === 'SYN_GESENDET') {
|
|
49
|
+
connstate = 'SYN_SENT';
|
|
50
|
+
}
|
|
51
|
+
if (connstate === 'LISTENING') {
|
|
52
|
+
connstate = 'LISTEN';
|
|
53
|
+
}
|
|
54
|
+
if (connstate === 'SYN_RECEIVED') {
|
|
55
|
+
connstate = 'SYN_RECV';
|
|
56
|
+
}
|
|
57
|
+
if (connstate === 'FIN_WAIT_1') {
|
|
58
|
+
connstate = 'FIN_WAIT1';
|
|
59
|
+
}
|
|
60
|
+
if (connstate === 'FIN_WAIT_2') {
|
|
61
|
+
connstate = 'FIN_WAIT2';
|
|
62
|
+
}
|
|
63
|
+
if (lineParts[0].toLowerCase() !== 'udp' && connstate) {
|
|
64
|
+
result.push({
|
|
65
|
+
protocol: lineParts[0].toLowerCase(),
|
|
66
|
+
localAddress: localip,
|
|
67
|
+
localPort: localport,
|
|
68
|
+
peerAddress: peerip,
|
|
69
|
+
peerPort: peerport,
|
|
70
|
+
state: connstate,
|
|
71
|
+
pid,
|
|
72
|
+
process: ''
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else if (lineParts[0].toLowerCase() === 'udp') {
|
|
76
|
+
result.push({
|
|
77
|
+
protocol: lineParts[0].toLowerCase(),
|
|
78
|
+
localAddress: localip,
|
|
79
|
+
localPort: localport,
|
|
80
|
+
peerAddress: peerip,
|
|
81
|
+
peerPort: peerport,
|
|
82
|
+
state: '',
|
|
83
|
+
pid: parseInt(lineParts[3], 10),
|
|
84
|
+
process: ''
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
};
|
|
93
|
+
exports.networkConnections = networkConnections;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const networkGatewayDefault: () => Promise<string>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkGatewayDefault = void 0;
|
|
4
|
+
const node_os_1 = require("node:os");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const const_1 = require("../common/const");
|
|
7
|
+
const exec_1 = require("../common/exec");
|
|
8
|
+
const windows_1 = require("../common/windows");
|
|
9
|
+
const networkGatewayDefault = async () => {
|
|
10
|
+
await (0, common_1.nextTick)();
|
|
11
|
+
let result = '';
|
|
12
|
+
let stdout = '';
|
|
13
|
+
({ stdout } = await (0, exec_1.execSave)('netstat -r', const_1.execOptsWin));
|
|
14
|
+
const lines = stdout.split(node_os_1.EOL);
|
|
15
|
+
lines.forEach((line) => {
|
|
16
|
+
line = line.replace(/\s+/g, ' ').trim();
|
|
17
|
+
if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !/[a-zA-Z]/.test(line)) {
|
|
18
|
+
const parts = line.split(' ');
|
|
19
|
+
if (parts.length >= 5 && parts[parts.length - 3].indexOf('.') > -1) {
|
|
20
|
+
result = parts[parts.length - 3];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (!result) {
|
|
25
|
+
try {
|
|
26
|
+
const data = await windows_1.ps.exec("Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq '0.0.0.0' -and $_.Mask -eq '0.0.0.0' }");
|
|
27
|
+
const lineParts = String(data || '').split('\r\n');
|
|
28
|
+
if (lineParts.length > 1) {
|
|
29
|
+
result = (0, common_1.getValue)(lineParts, 'NextHop');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch { }
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
exports.networkGatewayDefault = networkGatewayDefault;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkInterfaceDefault = exports.getFirstExternalNetworkInterface = void 0;
|
|
4
|
+
const node_os_1 = require("node:os");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const const_1 = require("../common/const");
|
|
7
|
+
const exec_1 = require("../common/exec");
|
|
8
|
+
const getFirstExternalNetworkInterface = (interfaces) => {
|
|
9
|
+
let ifacename = '';
|
|
10
|
+
let ifacenameFirst = '';
|
|
11
|
+
let scopeid = 9999;
|
|
12
|
+
for (const dev in interfaces) {
|
|
13
|
+
(interfaces[dev] || []).forEach((details) => {
|
|
14
|
+
if (details && details.internal === false) {
|
|
15
|
+
ifacenameFirst = ifacenameFirst || dev;
|
|
16
|
+
if (details.scopeid && details.scopeid < scopeid) {
|
|
17
|
+
ifacename = dev;
|
|
18
|
+
scopeid = details.scopeid;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return ifacename || ifacenameFirst || '';
|
|
24
|
+
};
|
|
25
|
+
exports.getFirstExternalNetworkInterface = getFirstExternalNetworkInterface;
|
|
26
|
+
const networkInterfaceDefault = async () => {
|
|
27
|
+
await (0, common_1.nextTick)();
|
|
28
|
+
const interfaces = (0, node_os_1.networkInterfaces)();
|
|
29
|
+
let ifacename = (0, exports.getFirstExternalNetworkInterface)(interfaces);
|
|
30
|
+
try {
|
|
31
|
+
let defaultIp = '';
|
|
32
|
+
const { stdout } = await (0, exec_1.exec)('netstat -r', const_1.execOptsWin);
|
|
33
|
+
const lines = stdout.split(node_os_1.EOL);
|
|
34
|
+
lines.forEach((line) => {
|
|
35
|
+
line = line.replace(/\s+/g, ' ').trim();
|
|
36
|
+
if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !/[a-zA-Z]/.test(line)) {
|
|
37
|
+
const parts = line.split(' ');
|
|
38
|
+
if (parts.length >= 5) {
|
|
39
|
+
defaultIp = parts[parts.length - 2];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (defaultIp) {
|
|
44
|
+
for (const dev in interfaces) {
|
|
45
|
+
(interfaces[dev] || []).forEach((details) => {
|
|
46
|
+
if (details?.address && details.address === defaultIp) {
|
|
47
|
+
ifacename = dev;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch { }
|
|
54
|
+
return ifacename;
|
|
55
|
+
};
|
|
56
|
+
exports.networkInterfaceDefault = networkInterfaceDefault;
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkInterfaces = void 0;
|
|
4
|
+
const node_os_1 = require("node:os");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const const_1 = require("../common/const");
|
|
7
|
+
const defaults_1 = require("../common/defaults");
|
|
8
|
+
const exec_1 = require("../common/exec");
|
|
9
|
+
const index_1 = require("../common/index");
|
|
10
|
+
const network_1 = require("../common/network");
|
|
11
|
+
const security_1 = require("../common/security");
|
|
12
|
+
const windows_1 = require("../common/windows");
|
|
13
|
+
const network_interface_default_1 = require("./network-interface-default");
|
|
14
|
+
let _interfaces = {};
|
|
15
|
+
let _networkInterfaces = [];
|
|
16
|
+
const parseLinesWindowsNics = (sections, nconfigsections) => {
|
|
17
|
+
const nics = [];
|
|
18
|
+
for (let i = 0; i < sections.length; i++) {
|
|
19
|
+
try {
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(sections, i)) {
|
|
21
|
+
if (sections[i].trim() !== '') {
|
|
22
|
+
const lines = sections[i].trim().split('\r\n');
|
|
23
|
+
let linesNicConfig = null;
|
|
24
|
+
try {
|
|
25
|
+
linesNicConfig = nconfigsections?.[i] ? nconfigsections[i].trim().split('\r\n') : [];
|
|
26
|
+
}
|
|
27
|
+
catch { }
|
|
28
|
+
const netEnabled = (0, common_1.getValue)(lines, 'NetEnabled', ':');
|
|
29
|
+
let adapterType = (0, common_1.getValue)(lines, 'AdapterTypeID', ':') === '9' ? 'wireless' : 'wired';
|
|
30
|
+
const ifacename = (0, common_1.getValue)(lines, 'Name', ':').replace(/\]/g, ')').replace(/\[/g, '(');
|
|
31
|
+
const iface = (0, common_1.getValue)(lines, 'NetConnectionID', ':').replace(/\]/g, ')').replace(/\[/g, '(');
|
|
32
|
+
if (ifacename.toLowerCase().indexOf('wi-fi') >= 0 || ifacename.toLowerCase().indexOf('wireless') >= 0) {
|
|
33
|
+
adapterType = 'wireless';
|
|
34
|
+
}
|
|
35
|
+
if (netEnabled !== '') {
|
|
36
|
+
const speed = (0, common_1.toInt)((0, common_1.getValue)(lines, 'speed', ':').trim()) / 1000000;
|
|
37
|
+
nics.push({
|
|
38
|
+
mac: (0, common_1.getValue)(lines, 'MACAddress', ':').toLowerCase(),
|
|
39
|
+
dhcp: (0, common_1.getValue)(linesNicConfig, 'dhcpEnabled', ':').toLowerCase() === 'true',
|
|
40
|
+
name: ifacename,
|
|
41
|
+
iface,
|
|
42
|
+
netEnabled: netEnabled === 'TRUE',
|
|
43
|
+
speed: Number.isNaN(speed) ? null : speed,
|
|
44
|
+
operstate: (0, common_1.getValue)(lines, 'NetConnectionStatus', ':') === '2' ? 'up' : 'down',
|
|
45
|
+
type: adapterType
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch { }
|
|
52
|
+
}
|
|
53
|
+
return nics;
|
|
54
|
+
};
|
|
55
|
+
const getWindowsNics = async () => {
|
|
56
|
+
let cmd = 'Get-CimInstance Win32_NetworkAdapter | fl *' + "; echo '#-#-#-#';";
|
|
57
|
+
cmd += 'Get-CimInstance Win32_NetworkAdapterConfiguration | fl DHCPEnabled' + '';
|
|
58
|
+
try {
|
|
59
|
+
const stdout = String((await windows_1.ps.exec(cmd)) || '');
|
|
60
|
+
const data = stdout.split('#-#-#-#');
|
|
61
|
+
const nsections = (data[0] || '').split(/\n\s*\n/);
|
|
62
|
+
const nconfigsections = (data[1] || '').split(/\n\s*\n/);
|
|
63
|
+
return parseLinesWindowsNics(nsections, nconfigsections);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const getWindowsDNSsuffixes = async () => {
|
|
70
|
+
let iface = {};
|
|
71
|
+
const dnsSuffixes = {
|
|
72
|
+
primaryDNS: '',
|
|
73
|
+
exitCode: 0,
|
|
74
|
+
interfaces: []
|
|
75
|
+
};
|
|
76
|
+
try {
|
|
77
|
+
const { stdout } = await (0, exec_1.exec)('ipconfig /all', const_1.execOptsWin);
|
|
78
|
+
const ipconfigArray = stdout.split('\r\n\r\n');
|
|
79
|
+
ipconfigArray.forEach((element, index) => {
|
|
80
|
+
if (index === 1) {
|
|
81
|
+
const longPrimaryDNS = element.split('\r\n').filter((element) => {
|
|
82
|
+
return element.toUpperCase().includes('DNS');
|
|
83
|
+
});
|
|
84
|
+
const primaryDNS = longPrimaryDNS[0].substring(longPrimaryDNS[0].lastIndexOf(':') + 1);
|
|
85
|
+
dnsSuffixes.primaryDNS = primaryDNS.trim();
|
|
86
|
+
if (!dnsSuffixes.primaryDNS) {
|
|
87
|
+
dnsSuffixes.primaryDNS = 'Not defined';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (index > 1) {
|
|
91
|
+
if (index % 2 === 0) {
|
|
92
|
+
const name = element.substring(element.lastIndexOf(' ') + 1).replace(':', '');
|
|
93
|
+
iface.name = name;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const connectionSpecificDNS = element.split('\r\n').filter((element) => {
|
|
97
|
+
return element.toUpperCase().includes('DNS');
|
|
98
|
+
});
|
|
99
|
+
const dnsSuffix = connectionSpecificDNS[0].substring(connectionSpecificDNS[0].lastIndexOf(':') + 1);
|
|
100
|
+
iface.dnsSuffix = dnsSuffix.trim();
|
|
101
|
+
dnsSuffixes.interfaces.push(iface);
|
|
102
|
+
iface = {};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return dnsSuffixes;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return {
|
|
110
|
+
primaryDNS: '',
|
|
111
|
+
exitCode: 0,
|
|
112
|
+
interfaces: []
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const getWindowsIfaceDNSsuffix = (interfaces, ifacename) => {
|
|
117
|
+
let dnsSuffix = '';
|
|
118
|
+
const interfaceName = `${ifacename}.`;
|
|
119
|
+
try {
|
|
120
|
+
const connectionDnsSuffix = interfaces
|
|
121
|
+
.filter((iface) => {
|
|
122
|
+
return interfaceName.includes(`${iface.name}.`);
|
|
123
|
+
})
|
|
124
|
+
.map((iface) => iface.dnsSuffix);
|
|
125
|
+
if (connectionDnsSuffix[0]) {
|
|
126
|
+
dnsSuffix = connectionDnsSuffix[0];
|
|
127
|
+
}
|
|
128
|
+
if (!dnsSuffix) {
|
|
129
|
+
dnsSuffix = '';
|
|
130
|
+
}
|
|
131
|
+
return dnsSuffix;
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return 'Unknown';
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const getWindowsWiredProfilesInformation = async () => {
|
|
138
|
+
try {
|
|
139
|
+
const { stdout } = await (0, exec_1.exec)('netsh lan show profiles', const_1.execOptsWin);
|
|
140
|
+
const profileList = stdout.split('\r\nProfile on interface');
|
|
141
|
+
return profileList;
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (error.code === 1 && (error.stdout || '').includes('AutoConfig')) {
|
|
145
|
+
return 'Disabled';
|
|
146
|
+
}
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const getWindowsWirelessIfaceSSID = async (interfaceName) => {
|
|
151
|
+
try {
|
|
152
|
+
const { stdout } = await (0, exec_1.exec)(`netsh wlan show interface name="${interfaceName}" | findstr "SSID"`, const_1.execOptsWin);
|
|
153
|
+
const SSID = stdout.split('\r\n')[0];
|
|
154
|
+
const parseSSID = (SSID.split(':').pop() || '').trim();
|
|
155
|
+
return parseSSID;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return 'Unknown';
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const getWindowsIEEE8021x = async (connectionType, iface, interfaces) => {
|
|
162
|
+
const i8021x = {
|
|
163
|
+
state: 'Unknown',
|
|
164
|
+
protocol: 'Unknown'
|
|
165
|
+
};
|
|
166
|
+
if (interfaces === 'Disabled') {
|
|
167
|
+
i8021x.state = 'Disabled';
|
|
168
|
+
i8021x.protocol = 'Not defined';
|
|
169
|
+
return i8021x;
|
|
170
|
+
}
|
|
171
|
+
if (connectionType === 'wired' && interfaces.length > 0) {
|
|
172
|
+
try {
|
|
173
|
+
const iface8021xInfo = interfaces.find((element) => {
|
|
174
|
+
return element.includes(`${iface}\r\n`);
|
|
175
|
+
});
|
|
176
|
+
const arrayIface8021xInfo = iface8021xInfo.split('\r\n');
|
|
177
|
+
const state8021x = arrayIface8021xInfo.find((element) => {
|
|
178
|
+
return element.includes('802.1x');
|
|
179
|
+
});
|
|
180
|
+
if (state8021x.includes('Disabled')) {
|
|
181
|
+
i8021x.state = 'Disabled';
|
|
182
|
+
i8021x.protocol = 'Not defined';
|
|
183
|
+
}
|
|
184
|
+
else if (state8021x.includes('Enabled')) {
|
|
185
|
+
const protocol8021x = arrayIface8021xInfo.find((element) => {
|
|
186
|
+
return element.includes('EAP');
|
|
187
|
+
});
|
|
188
|
+
i8021x.protocol = protocol8021x.split(':').pop();
|
|
189
|
+
i8021x.state = 'Enabled';
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return i8021x;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (connectionType === 'wireless') {
|
|
197
|
+
let i8021xState = '';
|
|
198
|
+
let i8021xProtocol = '';
|
|
199
|
+
try {
|
|
200
|
+
const SSID = await getWindowsWirelessIfaceSSID((0, security_1.sanitizeString)(iface));
|
|
201
|
+
if (SSID !== 'Unknown') {
|
|
202
|
+
const ifaceSanitized = (0, security_1.sanitizeString)(SSID);
|
|
203
|
+
const { stdout } = await (0, exec_1.exec)(`netsh wlan show profiles "${ifaceSanitized}"`, const_1.execOptsWin);
|
|
204
|
+
const profiles = stdout.split('\r\n');
|
|
205
|
+
i8021xState = (profiles.find((l) => l.indexOf('802.1X') >= 0) || '').trim();
|
|
206
|
+
i8021xProtocol = (profiles.find((l) => l.indexOf('EAP') >= 0) || '').trim();
|
|
207
|
+
}
|
|
208
|
+
if (i8021xState.includes(':') && i8021xProtocol.includes(':')) {
|
|
209
|
+
let parts = i8021xState.split(':');
|
|
210
|
+
i8021x.state = parts[parts.length - 1];
|
|
211
|
+
parts = i8021xProtocol.split(':');
|
|
212
|
+
i8021x.protocol = parts[parts.length - 1];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
if (error.code === 1 && (error.stdout || '').includes('AutoConfig')) {
|
|
217
|
+
i8021x.state = 'Disabled';
|
|
218
|
+
i8021x.protocol = 'Not defined';
|
|
219
|
+
}
|
|
220
|
+
return i8021x;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return i8021x;
|
|
224
|
+
};
|
|
225
|
+
const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
226
|
+
await (0, common_1.nextTick)();
|
|
227
|
+
const interfaces = (0, node_os_1.networkInterfaces)();
|
|
228
|
+
if (JSON.stringify(interfaces) === JSON.stringify(_interfaces) && !rescan) {
|
|
229
|
+
return _networkInterfaces;
|
|
230
|
+
}
|
|
231
|
+
_interfaces = (0, index_1.cloneObj)(interfaces);
|
|
232
|
+
let result = [];
|
|
233
|
+
try {
|
|
234
|
+
const defaultInterface = await (0, network_interface_default_1.networkInterfaceDefault)();
|
|
235
|
+
const nics = await getWindowsNics();
|
|
236
|
+
nics.forEach((nic) => {
|
|
237
|
+
let found = false;
|
|
238
|
+
Object.keys(interfaces).forEach((key) => {
|
|
239
|
+
if (!found) {
|
|
240
|
+
(interfaces[key] || []).forEach((value) => {
|
|
241
|
+
if (Object.keys(value).indexOf('mac') >= 0) {
|
|
242
|
+
found = value['mac'] === nic.mac;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
if (!found) {
|
|
248
|
+
interfaces[nic.name] = [{ mac: nic.mac }];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const nics8021xInfo = await getWindowsWiredProfilesInformation();
|
|
252
|
+
const dnsSuffixes = await getWindowsDNSsuffixes();
|
|
253
|
+
for (const dev in interfaces) {
|
|
254
|
+
const ifaceSanitized = (0, security_1.sanitizeString)(dev);
|
|
255
|
+
let iface = dev;
|
|
256
|
+
let ip4 = '';
|
|
257
|
+
let ip4subnet = '';
|
|
258
|
+
let ip6 = '';
|
|
259
|
+
let ip6subnet = '';
|
|
260
|
+
let mac = '';
|
|
261
|
+
let speed = 0;
|
|
262
|
+
let operstate = 'down';
|
|
263
|
+
let dhcp = false;
|
|
264
|
+
let dnsSuffix = '';
|
|
265
|
+
let ieee8021xAuth = '';
|
|
266
|
+
let ieee8021xState = '';
|
|
267
|
+
let type = '';
|
|
268
|
+
let ifaceName = dev;
|
|
269
|
+
(interfaces[dev] || []).forEach((details) => {
|
|
270
|
+
if (details.family === 'IPv4' || details.family === 4) {
|
|
271
|
+
ip4 = details.address;
|
|
272
|
+
ip4subnet = details.netmask;
|
|
273
|
+
}
|
|
274
|
+
if (details.family === 'IPv6' || details.family === 6) {
|
|
275
|
+
if (!ip6 || ip6.match(/^fe80::/i)) {
|
|
276
|
+
ip6 = details.address;
|
|
277
|
+
ip6subnet = details.netmask;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
mac = details.mac;
|
|
281
|
+
});
|
|
282
|
+
dnsSuffix = getWindowsIfaceDNSsuffix(dnsSuffixes.interfaces, ifaceSanitized);
|
|
283
|
+
let foundFirst = false;
|
|
284
|
+
nics.forEach((detail) => {
|
|
285
|
+
if (detail.mac === mac && !foundFirst) {
|
|
286
|
+
iface = detail.iface || iface;
|
|
287
|
+
ifaceName = detail.name;
|
|
288
|
+
dhcp = detail.dhcp;
|
|
289
|
+
operstate = detail.operstate;
|
|
290
|
+
speed = operstate === 'up' ? detail.speed : 0;
|
|
291
|
+
type = detail.type;
|
|
292
|
+
foundFirst = true;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
if (dev.toLowerCase().indexOf('wlan') >= 0 ||
|
|
296
|
+
ifaceName.toLowerCase().indexOf('wlan') >= 0 ||
|
|
297
|
+
ifaceName.toLowerCase().indexOf('802.11n') >= 0 ||
|
|
298
|
+
ifaceName.toLowerCase().indexOf('wireless') >= 0 ||
|
|
299
|
+
ifaceName.toLowerCase().indexOf('wi-fi') >= 0 ||
|
|
300
|
+
ifaceName.toLowerCase().indexOf('wifi') >= 0) {
|
|
301
|
+
type = 'wireless';
|
|
302
|
+
}
|
|
303
|
+
const IEEE8021x = await getWindowsIEEE8021x(type, ifaceSanitized, nics8021xInfo);
|
|
304
|
+
ieee8021xAuth = IEEE8021x.protocol;
|
|
305
|
+
ieee8021xState = IEEE8021x.state;
|
|
306
|
+
let internal = interfaces[dev] && (interfaces[dev] || [])[0] ? (interfaces[dev] || [])[0].internal : false;
|
|
307
|
+
if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) {
|
|
308
|
+
internal = true;
|
|
309
|
+
}
|
|
310
|
+
const virtual = internal ? false : (0, network_1.testVirtualNic)(dev, ifaceName, mac);
|
|
311
|
+
result.push({
|
|
312
|
+
...defaults_1.initNetworkInterface,
|
|
313
|
+
iface,
|
|
314
|
+
ifaceName,
|
|
315
|
+
default: iface === defaultInterface,
|
|
316
|
+
ip4,
|
|
317
|
+
ip4subnet,
|
|
318
|
+
ip6,
|
|
319
|
+
ip6subnet,
|
|
320
|
+
mac,
|
|
321
|
+
internal,
|
|
322
|
+
virtual,
|
|
323
|
+
operstate,
|
|
324
|
+
type,
|
|
325
|
+
speed,
|
|
326
|
+
dhcp,
|
|
327
|
+
dnsSuffix,
|
|
328
|
+
ieee8021xAuth,
|
|
329
|
+
ieee8021xState
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
catch { }
|
|
334
|
+
_networkInterfaces = result;
|
|
335
|
+
if (defaultString.toLowerCase().indexOf('default') >= 0) {
|
|
336
|
+
result = result.filter((item) => item.default);
|
|
337
|
+
if (result.length > 0) {
|
|
338
|
+
return [result[0]];
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
return [];
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return result;
|
|
345
|
+
};
|
|
346
|
+
exports.networkInterfaces = networkInterfaces;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkStats = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const defaults_1 = require("../common/defaults");
|
|
7
|
+
const network_1 = require("../common/network");
|
|
8
|
+
const security_1 = require("../common/security");
|
|
9
|
+
const windows_1 = require("../common/windows");
|
|
10
|
+
const _network = {};
|
|
11
|
+
const parseLinesWindowsPerfData = (sections) => {
|
|
12
|
+
const perfData = [];
|
|
13
|
+
for (const i in sections) {
|
|
14
|
+
if (sections[i].trim() !== '') {
|
|
15
|
+
const lines = sections[i].trim().split('\r\n');
|
|
16
|
+
perfData.push({
|
|
17
|
+
name: (0, common_1.getValue)(lines, 'Name', ':').toLowerCase(),
|
|
18
|
+
desc: (0, common_1.getValue)(lines, 'InterfaceDescription', ':')
|
|
19
|
+
.replace(/[()[\] ]+/g, '')
|
|
20
|
+
.replace(/#|\//g, '_')
|
|
21
|
+
.toLowerCase(),
|
|
22
|
+
rx_bytes: (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedBytes', ':')),
|
|
23
|
+
rx_errors: (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedPacketErrors', ':')),
|
|
24
|
+
rx_dropped: (0, common_1.toInt)((0, common_1.getValue)(lines, 'ReceivedDiscardedPackets', ':')),
|
|
25
|
+
tx_bytes: (0, common_1.toInt)((0, common_1.getValue)(lines, 'SentBytes', ':')),
|
|
26
|
+
tx_errors: (0, common_1.toInt)((0, common_1.getValue)(lines, 'OutboundPacketErrors', ':')),
|
|
27
|
+
tx_dropped: (0, common_1.toInt)((0, common_1.getValue)(lines, 'OutboundDiscardedPackets', ':'))
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return perfData;
|
|
32
|
+
};
|
|
33
|
+
const networkStatsSingle = async (iface) => {
|
|
34
|
+
await (0, common_1.nextTick)();
|
|
35
|
+
const defaults = defaults_1.initNetworkSpeed;
|
|
36
|
+
if (!_network[iface] || (_network[iface] && !_network[iface].ms) || (_network[iface] && _network[iface].ms && Date.now() - _network[iface].ms >= 500)) {
|
|
37
|
+
let operstate = 'unknown';
|
|
38
|
+
let rx_bytes = 0;
|
|
39
|
+
let tx_bytes = 0;
|
|
40
|
+
let rx_dropped = 0;
|
|
41
|
+
let rx_errors = 0;
|
|
42
|
+
let tx_dropped = 0;
|
|
43
|
+
let tx_errors = 0;
|
|
44
|
+
let perfData = [];
|
|
45
|
+
let ifaceName = iface;
|
|
46
|
+
try {
|
|
47
|
+
const stdout = String((await windows_1.ps.exec('Get-NetAdapterStatistics | select Name,InterfaceDescription,ReceivedBytes,ReceivedPacketErrors,ReceivedDiscardedPackets,SentBytes,OutboundPacketErrors,OutboundDiscardedPackets | fl')) || '');
|
|
48
|
+
if (stdout) {
|
|
49
|
+
const psections = stdout.split(/\n\s*\n/);
|
|
50
|
+
perfData = parseLinesWindowsPerfData(psections);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch { }
|
|
54
|
+
const interfaces = await (0, index_1.networkInterfaces)('', false);
|
|
55
|
+
rx_bytes = 0;
|
|
56
|
+
tx_bytes = 0;
|
|
57
|
+
perfData.forEach((detail) => {
|
|
58
|
+
(interfaces || []).forEach((det) => {
|
|
59
|
+
if ((det.iface.toLowerCase() === iface.toLowerCase() ||
|
|
60
|
+
det.mac.toLowerCase() === iface.toLowerCase() ||
|
|
61
|
+
det.ip4.toLowerCase() === iface.toLowerCase() ||
|
|
62
|
+
det.ip6.toLowerCase() === iface.toLowerCase() ||
|
|
63
|
+
det.ifaceName
|
|
64
|
+
.replace(/[()[\] ]+/g, '')
|
|
65
|
+
.replace(/#|\//g, '_')
|
|
66
|
+
.toLowerCase() ===
|
|
67
|
+
iface
|
|
68
|
+
.replace(/[()[\] ]+/g, '')
|
|
69
|
+
.replace('#', '_')
|
|
70
|
+
.toLowerCase()) &&
|
|
71
|
+
(det.iface.toLowerCase() === detail.name ||
|
|
72
|
+
det.ifaceName
|
|
73
|
+
.replace(/[()[\] ]+/g, '')
|
|
74
|
+
.replace(/#|\//g, '_')
|
|
75
|
+
.toLowerCase() === detail.desc)) {
|
|
76
|
+
ifaceName = det.iface;
|
|
77
|
+
rx_bytes = detail.rx_bytes;
|
|
78
|
+
rx_dropped = detail.rx_dropped;
|
|
79
|
+
rx_errors = detail.rx_errors;
|
|
80
|
+
tx_bytes = detail.tx_bytes;
|
|
81
|
+
tx_dropped = detail.tx_dropped;
|
|
82
|
+
tx_errors = detail.tx_errors;
|
|
83
|
+
operstate = det.operstate;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
if (rx_bytes && tx_bytes) {
|
|
88
|
+
return (0, network_1.calcNetworkSpeed)(ifaceName, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network);
|
|
89
|
+
}
|
|
90
|
+
return defaults;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return {
|
|
94
|
+
...defaults,
|
|
95
|
+
rx_bytes: _network[iface].rx_bytes,
|
|
96
|
+
tx_bytes: _network[iface].tx_bytes,
|
|
97
|
+
rx_sec: _network[iface].rx_sec,
|
|
98
|
+
tx_sec: _network[iface].tx_sec,
|
|
99
|
+
rx_dropped: _network[iface].rx_dropped,
|
|
100
|
+
tx_dropped: _network[iface].tx_dropped,
|
|
101
|
+
rx_errors: _network[iface].rx_errors,
|
|
102
|
+
tx_errors: _network[iface].tx_errors,
|
|
103
|
+
ms: _network[iface].last_ms,
|
|
104
|
+
operstate: _network[iface].operstate
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const networkStats = async (interfaces) => {
|
|
109
|
+
const result = [];
|
|
110
|
+
let interfacesArray = [];
|
|
111
|
+
const interfacesSanitized = (0, security_1.sanitizeInterfacesString)(interfaces);
|
|
112
|
+
if (interfacesSanitized === '-') {
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
if (interfacesSanitized === '*') {
|
|
116
|
+
const allIFaces = await (0, index_1.networkInterfaces)('', false);
|
|
117
|
+
for (const iface of allIFaces || []) {
|
|
118
|
+
interfacesArray.push(iface.iface);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
interfacesArray = interfacesSanitized.split('|');
|
|
123
|
+
}
|
|
124
|
+
const workload = [];
|
|
125
|
+
for (const iface of interfacesArray) {
|
|
126
|
+
workload.push(networkStatsSingle(iface.trim()));
|
|
127
|
+
}
|
|
128
|
+
if (workload.length) {
|
|
129
|
+
return await Promise.all(workload);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
exports.networkStats = networkStats;
|