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
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRaspbian = exports.getRpiGpu = exports.isRaspberry = exports.decodePiCpuinfo = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
let _rpi_cpuinfo = [];
|
|
7
|
+
const decodePiCpuinfo = (lines) => {
|
|
8
|
+
if (_rpi_cpuinfo.length === 0) {
|
|
9
|
+
_rpi_cpuinfo = lines || [];
|
|
10
|
+
}
|
|
11
|
+
if (lines === undefined) {
|
|
12
|
+
lines = _rpi_cpuinfo;
|
|
13
|
+
}
|
|
14
|
+
const oldRevisionCodes = {
|
|
15
|
+
'0002': {
|
|
16
|
+
type: 'B',
|
|
17
|
+
revision: '1.0',
|
|
18
|
+
memory: 256,
|
|
19
|
+
manufacturer: 'Egoman',
|
|
20
|
+
processor: 'BCM2835'
|
|
21
|
+
},
|
|
22
|
+
'0003': {
|
|
23
|
+
type: 'B',
|
|
24
|
+
revision: '1.0',
|
|
25
|
+
memory: 256,
|
|
26
|
+
manufacturer: 'Egoman',
|
|
27
|
+
processor: 'BCM2835'
|
|
28
|
+
},
|
|
29
|
+
'0004': {
|
|
30
|
+
type: 'B',
|
|
31
|
+
revision: '2.0',
|
|
32
|
+
memory: 256,
|
|
33
|
+
manufacturer: 'Sony UK',
|
|
34
|
+
processor: 'BCM2835'
|
|
35
|
+
},
|
|
36
|
+
'0005': {
|
|
37
|
+
type: 'B',
|
|
38
|
+
revision: '2.0',
|
|
39
|
+
memory: 256,
|
|
40
|
+
manufacturer: 'Qisda',
|
|
41
|
+
processor: 'BCM2835'
|
|
42
|
+
},
|
|
43
|
+
'0006': {
|
|
44
|
+
type: 'B',
|
|
45
|
+
revision: '2.0',
|
|
46
|
+
memory: 256,
|
|
47
|
+
manufacturer: 'Egoman',
|
|
48
|
+
processor: 'BCM2835'
|
|
49
|
+
},
|
|
50
|
+
'0007': {
|
|
51
|
+
type: 'A',
|
|
52
|
+
revision: '2.0',
|
|
53
|
+
memory: 256,
|
|
54
|
+
manufacturer: 'Egoman',
|
|
55
|
+
processor: 'BCM2835'
|
|
56
|
+
},
|
|
57
|
+
'0008': {
|
|
58
|
+
type: 'A',
|
|
59
|
+
revision: '2.0',
|
|
60
|
+
memory: 256,
|
|
61
|
+
manufacturer: 'Sony UK',
|
|
62
|
+
processor: 'BCM2835'
|
|
63
|
+
},
|
|
64
|
+
'0009': {
|
|
65
|
+
type: 'A',
|
|
66
|
+
revision: '2.0',
|
|
67
|
+
memory: 256,
|
|
68
|
+
manufacturer: 'Qisda',
|
|
69
|
+
processor: 'BCM2835'
|
|
70
|
+
},
|
|
71
|
+
'000d': {
|
|
72
|
+
type: 'B',
|
|
73
|
+
revision: '2.0',
|
|
74
|
+
memory: 512,
|
|
75
|
+
manufacturer: 'Egoman',
|
|
76
|
+
processor: 'BCM2835'
|
|
77
|
+
},
|
|
78
|
+
'000e': {
|
|
79
|
+
type: 'B',
|
|
80
|
+
revision: '2.0',
|
|
81
|
+
memory: 512,
|
|
82
|
+
manufacturer: 'Sony UK',
|
|
83
|
+
processor: 'BCM2835'
|
|
84
|
+
},
|
|
85
|
+
'000f': {
|
|
86
|
+
type: 'B',
|
|
87
|
+
revision: '2.0',
|
|
88
|
+
memory: 512,
|
|
89
|
+
manufacturer: 'Egoman',
|
|
90
|
+
processor: 'BCM2835'
|
|
91
|
+
},
|
|
92
|
+
'0010': {
|
|
93
|
+
type: 'B+',
|
|
94
|
+
revision: '1.2',
|
|
95
|
+
memory: 512,
|
|
96
|
+
manufacturer: 'Sony UK',
|
|
97
|
+
processor: 'BCM2835'
|
|
98
|
+
},
|
|
99
|
+
'0011': {
|
|
100
|
+
type: 'CM1',
|
|
101
|
+
revision: '1.0',
|
|
102
|
+
memory: 512,
|
|
103
|
+
manufacturer: 'Sony UK',
|
|
104
|
+
processor: 'BCM2835'
|
|
105
|
+
},
|
|
106
|
+
'0012': {
|
|
107
|
+
type: 'A+',
|
|
108
|
+
revision: '1.1',
|
|
109
|
+
memory: 256,
|
|
110
|
+
manufacturer: 'Sony UK',
|
|
111
|
+
processor: 'BCM2835'
|
|
112
|
+
},
|
|
113
|
+
'0013': {
|
|
114
|
+
type: 'B+',
|
|
115
|
+
revision: '1.2',
|
|
116
|
+
memory: 512,
|
|
117
|
+
manufacturer: 'Embest',
|
|
118
|
+
processor: 'BCM2835'
|
|
119
|
+
},
|
|
120
|
+
'0014': {
|
|
121
|
+
type: 'CM1',
|
|
122
|
+
revision: '1.0',
|
|
123
|
+
memory: 512,
|
|
124
|
+
manufacturer: 'Embest',
|
|
125
|
+
processor: 'BCM2835'
|
|
126
|
+
},
|
|
127
|
+
'0015': {
|
|
128
|
+
type: 'A+',
|
|
129
|
+
revision: '1.1',
|
|
130
|
+
memory: 256,
|
|
131
|
+
manufacturer: '512MB Embest',
|
|
132
|
+
processor: 'BCM2835'
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const processorList = ['BCM2835', 'BCM2836', 'BCM2837', 'BCM2711', 'BCM2712'];
|
|
136
|
+
const manufacturerList = ['Sony UK', 'Egoman', 'Embest', 'Sony Japan', 'Embest', 'Stadium'];
|
|
137
|
+
const typeList = {
|
|
138
|
+
'00': 'A',
|
|
139
|
+
'01': 'B',
|
|
140
|
+
'02': 'A+',
|
|
141
|
+
'03': 'B+',
|
|
142
|
+
'04': '2B',
|
|
143
|
+
'05': 'Alpha (early prototype)',
|
|
144
|
+
'06': 'CM1',
|
|
145
|
+
'08': '3B',
|
|
146
|
+
'09': 'Zero',
|
|
147
|
+
'0a': 'CM3',
|
|
148
|
+
'0c': 'Zero W',
|
|
149
|
+
'0d': '3B+',
|
|
150
|
+
'0e': '3A+',
|
|
151
|
+
'0f': 'Internal use only',
|
|
152
|
+
'10': 'CM3+',
|
|
153
|
+
'11': '4B',
|
|
154
|
+
'12': 'Zero 2 W',
|
|
155
|
+
'13': '400',
|
|
156
|
+
'14': 'CM4',
|
|
157
|
+
'15': 'CM4S',
|
|
158
|
+
'16': 'Internal use only',
|
|
159
|
+
'17': '5',
|
|
160
|
+
'18': 'CM5 (EMMC)',
|
|
161
|
+
'19': '500',
|
|
162
|
+
'1a': 'CM5 (Lite)'
|
|
163
|
+
};
|
|
164
|
+
const revisionCode = (0, index_1.getValue)(lines, 'revision', ':', true);
|
|
165
|
+
const model = (0, index_1.getValue)(lines, 'model:', ':', true);
|
|
166
|
+
const serial = (0, index_1.getValue)(lines, 'serial', ':', true);
|
|
167
|
+
let result = {
|
|
168
|
+
model: '',
|
|
169
|
+
serial: '',
|
|
170
|
+
revisionCode: '',
|
|
171
|
+
memory: 0,
|
|
172
|
+
manufacturer: '',
|
|
173
|
+
processor: '',
|
|
174
|
+
type: '',
|
|
175
|
+
revision: ''
|
|
176
|
+
};
|
|
177
|
+
if (Object.keys(oldRevisionCodes).includes(revisionCode)) {
|
|
178
|
+
result = {
|
|
179
|
+
model,
|
|
180
|
+
serial,
|
|
181
|
+
revisionCode,
|
|
182
|
+
memory: oldRevisionCodes[revisionCode].memory,
|
|
183
|
+
manufacturer: oldRevisionCodes[revisionCode].manufacturer,
|
|
184
|
+
processor: oldRevisionCodes[revisionCode].processor,
|
|
185
|
+
type: oldRevisionCodes[revisionCode].type,
|
|
186
|
+
revision: oldRevisionCodes[revisionCode].revision
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
const revision = `00000000${(0, index_1.getValue)(lines, 'revision', ':', true).toLowerCase()}`.substr(-8);
|
|
191
|
+
const memSizeCode = parseInt((0, index_1.hex2bin)(revision.substr(2, 1)).substr(5, 3), 2) || 0;
|
|
192
|
+
const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)];
|
|
193
|
+
const processor = processorList[parseInt(revision.substr(4, 1), 10)];
|
|
194
|
+
const typeCode = revision.substr(5, 2);
|
|
195
|
+
result = {
|
|
196
|
+
model,
|
|
197
|
+
serial,
|
|
198
|
+
revisionCode,
|
|
199
|
+
memory: 256 * Math.pow(2, memSizeCode),
|
|
200
|
+
manufacturer,
|
|
201
|
+
processor,
|
|
202
|
+
type: Object.keys(typeList).includes(typeCode) ? typeList[typeCode] : '',
|
|
203
|
+
revision: '1.' + revision.substr(7, 1)
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
};
|
|
208
|
+
exports.decodePiCpuinfo = decodePiCpuinfo;
|
|
209
|
+
let _is_raspberry = null;
|
|
210
|
+
const isRaspberry = async (cpuinfo) => {
|
|
211
|
+
if (_is_raspberry !== null) {
|
|
212
|
+
return _is_raspberry;
|
|
213
|
+
}
|
|
214
|
+
const PI_MODEL_NO = ['BCM2708', 'BCM2709', 'BCM2710', 'BCM2711', 'BCM2712', 'BCM2835', 'BCM2836', 'BCM2837', 'BCM2837B0'];
|
|
215
|
+
if (_rpi_cpuinfo.length !== 0) {
|
|
216
|
+
cpuinfo = _rpi_cpuinfo;
|
|
217
|
+
}
|
|
218
|
+
else if (cpuinfo === undefined) {
|
|
219
|
+
try {
|
|
220
|
+
cpuinfo = (await (0, promises_1.readFile)('/proc/cpuinfo', { encoding: 'utf8' })).split('\n');
|
|
221
|
+
_rpi_cpuinfo = cpuinfo;
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
_is_raspberry = false;
|
|
225
|
+
return _is_raspberry;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const hardware = (0, index_1.getValue)(cpuinfo, 'hardware');
|
|
229
|
+
const model = (0, index_1.getValue)(cpuinfo, 'model');
|
|
230
|
+
_is_raspberry = (hardware !== '' && PI_MODEL_NO.indexOf(hardware) > -1) || (model !== '' && model.indexOf('Raspberry Pi') > -1);
|
|
231
|
+
return _is_raspberry;
|
|
232
|
+
};
|
|
233
|
+
exports.isRaspberry = isRaspberry;
|
|
234
|
+
const getRpiGpu = async (cpuinfo) => {
|
|
235
|
+
if (_rpi_cpuinfo.length === 0 && cpuinfo !== undefined) {
|
|
236
|
+
_rpi_cpuinfo = cpuinfo;
|
|
237
|
+
}
|
|
238
|
+
else if (cpuinfo === undefined && _rpi_cpuinfo.length > 0) {
|
|
239
|
+
cpuinfo = _rpi_cpuinfo;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
try {
|
|
243
|
+
cpuinfo = (await (0, promises_1.readFile)('/proc/cpuinfo', { encoding: 'utf8' })).split('\n');
|
|
244
|
+
_rpi_cpuinfo = cpuinfo;
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return '';
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const rpi = (0, exports.decodePiCpuinfo)(cpuinfo);
|
|
251
|
+
if (rpi.type === '4B' || rpi.type === 'CM4' || rpi.type === 'CM4S' || rpi.type === '400') {
|
|
252
|
+
return 'VideoCore VI';
|
|
253
|
+
}
|
|
254
|
+
if (rpi.type === '5' || rpi.type === '500') {
|
|
255
|
+
return 'VideoCore VII';
|
|
256
|
+
}
|
|
257
|
+
return 'VideoCore IV';
|
|
258
|
+
};
|
|
259
|
+
exports.getRpiGpu = getRpiGpu;
|
|
260
|
+
let _is_raspbian = null;
|
|
261
|
+
const isRaspbian = async () => {
|
|
262
|
+
if (_is_raspbian !== null) {
|
|
263
|
+
return _is_raspbian;
|
|
264
|
+
}
|
|
265
|
+
let osrelease = [];
|
|
266
|
+
try {
|
|
267
|
+
osrelease = (await (0, promises_1.readFile)('/etc/os-release', { encoding: 'utf8' })).split('\n');
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
_is_raspbian = false;
|
|
271
|
+
return _is_raspbian;
|
|
272
|
+
}
|
|
273
|
+
const id = (0, index_1.getValue)(osrelease, 'id', '=');
|
|
274
|
+
_is_raspbian = id !== '' && id.indexOf('raspbian') > -1;
|
|
275
|
+
return _is_raspbian;
|
|
276
|
+
};
|
|
277
|
+
exports.isRaspbian = isRaspbian;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const stringReplace: {
|
|
2
|
+
(searchValue: string | RegExp, replaceValue: string): string;
|
|
3
|
+
(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
|
|
4
|
+
(searchValue: {
|
|
5
|
+
[Symbol.replace](string: string, replaceValue: string): string;
|
|
6
|
+
}, replaceValue: string): string;
|
|
7
|
+
(searchValue: {
|
|
8
|
+
[Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
|
|
9
|
+
}, replacer: (substring: string, ...args: any[]) => string): string;
|
|
10
|
+
};
|
|
11
|
+
export declare const stringToLower: () => string;
|
|
12
|
+
export declare const stringToString: () => string;
|
|
13
|
+
export declare const stringSubstr: (from: number, length?: number) => string;
|
|
14
|
+
export declare const stringSubstring: (start: number, end?: number) => string;
|
|
15
|
+
export declare const stringTrim: () => string;
|
|
16
|
+
export declare const stringSplit: {
|
|
17
|
+
(separator: string | RegExp, limit?: number): string[];
|
|
18
|
+
(splitter: {
|
|
19
|
+
[Symbol.split](string: string, limit?: number): string[];
|
|
20
|
+
}, limit?: number): string[];
|
|
21
|
+
};
|
|
22
|
+
export declare const stringStartWith: (searchString: string, position?: number) => boolean;
|
|
23
|
+
export declare const mathMin: (...values: number[]) => number;
|
|
24
|
+
export declare const sanitizeShellString: (str: string, strict?: any) => string;
|
|
25
|
+
export declare const sanitizeContainerID: (str: string) => string;
|
|
26
|
+
export declare const sanitizeImageID: (str: string) => string;
|
|
27
|
+
export declare const isPrototypePolluted: () => boolean;
|
|
28
|
+
export declare const sanitizeUrl: (url: string) => string;
|
|
29
|
+
export declare const sanitizeServiceString: (str: string) => any;
|
|
30
|
+
export declare const sanitizeInterfacesString: (interfaces: string) => string;
|
|
31
|
+
export declare const sanitizeString: (str: string, strict?: any) => string;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sanitizeString = exports.sanitizeInterfacesString = exports.sanitizeServiceString = exports.sanitizeUrl = exports.isPrototypePolluted = exports.sanitizeImageID = exports.sanitizeContainerID = exports.sanitizeShellString = exports.mathMin = exports.stringStartWith = exports.stringSplit = exports.stringTrim = exports.stringSubstring = exports.stringSubstr = exports.stringToString = exports.stringToLower = exports.stringReplace = void 0;
|
|
4
|
+
exports.stringReplace = new String().replace;
|
|
5
|
+
exports.stringToLower = new String().toLowerCase;
|
|
6
|
+
exports.stringToString = new String().toString;
|
|
7
|
+
exports.stringSubstr = new String().substr;
|
|
8
|
+
exports.stringSubstring = new String().substring;
|
|
9
|
+
exports.stringTrim = new String().trim;
|
|
10
|
+
exports.stringSplit = new String().split;
|
|
11
|
+
exports.stringStartWith = new String().startsWith;
|
|
12
|
+
exports.mathMin = Math.min;
|
|
13
|
+
const sanitizeShellString = (str, strict) => {
|
|
14
|
+
if (typeof strict === 'undefined') {
|
|
15
|
+
strict = false;
|
|
16
|
+
}
|
|
17
|
+
const s = str || '';
|
|
18
|
+
const l = (0, exports.mathMin)(s.length, 2000);
|
|
19
|
+
let result = '';
|
|
20
|
+
for (let i = 0; i <= l; i++) {
|
|
21
|
+
if (!(s[i] === undefined ||
|
|
22
|
+
s[i] === '>' ||
|
|
23
|
+
s[i] === '<' ||
|
|
24
|
+
s[i] === '*' ||
|
|
25
|
+
s[i] === '?' ||
|
|
26
|
+
s[i] === '[' ||
|
|
27
|
+
s[i] === ']' ||
|
|
28
|
+
s[i] === '|' ||
|
|
29
|
+
s[i] === '˚' ||
|
|
30
|
+
s[i] === '$' ||
|
|
31
|
+
s[i] === ';' ||
|
|
32
|
+
s[i] === '&' ||
|
|
33
|
+
s[i] === ']' ||
|
|
34
|
+
s[i] === '#' ||
|
|
35
|
+
s[i] === '%' ||
|
|
36
|
+
s[i] === '!' ||
|
|
37
|
+
s[i] === '^' ||
|
|
38
|
+
s[i] === '\\' ||
|
|
39
|
+
s[i] === '\t' ||
|
|
40
|
+
s[i] === '\n' ||
|
|
41
|
+
s[i] === '\r' ||
|
|
42
|
+
s[i] === "'" ||
|
|
43
|
+
s[i] === '`' ||
|
|
44
|
+
s[i] === '"' ||
|
|
45
|
+
s[i].length > 1 ||
|
|
46
|
+
(strict && s[i] === '(') ||
|
|
47
|
+
(strict && s[i] === ')') ||
|
|
48
|
+
(strict && s[i] === '@') ||
|
|
49
|
+
(strict && s[i] === ' ') ||
|
|
50
|
+
(strict && s[i] === '{') ||
|
|
51
|
+
(strict && s[i] === ';') ||
|
|
52
|
+
(strict && s[i] === '}'))) {
|
|
53
|
+
result = result + s[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
exports.sanitizeShellString = sanitizeShellString;
|
|
59
|
+
const sanitizeContainerID = (str) => {
|
|
60
|
+
const s = String(str || '')
|
|
61
|
+
.substring(0, 2000)
|
|
62
|
+
.replace(/[^a-zA-Z0-9_.,*-]/g, '');
|
|
63
|
+
return s.indexOf('..') === -1 ? s : '';
|
|
64
|
+
};
|
|
65
|
+
exports.sanitizeContainerID = sanitizeContainerID;
|
|
66
|
+
const sanitizeImageID = (str) => {
|
|
67
|
+
const s = String(str || '')
|
|
68
|
+
.substring(0, 2000)
|
|
69
|
+
.replace(/[^a-zA-Z0-9_.,:@/-]/g, '');
|
|
70
|
+
return s.indexOf('..') === -1 ? s : '';
|
|
71
|
+
};
|
|
72
|
+
exports.sanitizeImageID = sanitizeImageID;
|
|
73
|
+
const isPrototypePolluted = () => {
|
|
74
|
+
const s = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
75
|
+
let notPolluted = true;
|
|
76
|
+
let st = '';
|
|
77
|
+
const proto = {
|
|
78
|
+
replace: exports.stringReplace,
|
|
79
|
+
toLowerCase: exports.stringToLower,
|
|
80
|
+
toString: exports.stringToString,
|
|
81
|
+
substr: exports.stringSubstr,
|
|
82
|
+
substring: exports.stringSubstring,
|
|
83
|
+
trim: exports.stringTrim,
|
|
84
|
+
split: exports.stringSplit,
|
|
85
|
+
startsWith: exports.stringStartWith
|
|
86
|
+
};
|
|
87
|
+
Object.setPrototypeOf(st, proto);
|
|
88
|
+
notPolluted = notPolluted || s.length !== 62;
|
|
89
|
+
const ms = Date.now();
|
|
90
|
+
if (typeof ms === 'number' && ms > 1600000000000) {
|
|
91
|
+
const l = (ms % 100) + 15;
|
|
92
|
+
for (let i = 0; i < l; i++) {
|
|
93
|
+
const r = Math.random() * 61.99999999 + 1;
|
|
94
|
+
const rs = parseInt(Math.floor(r).toString(), 10);
|
|
95
|
+
const rs2 = parseInt(r.toString().split('.')[0], 10);
|
|
96
|
+
const q = Math.random() * 61.99999999 + 1;
|
|
97
|
+
const qs = parseInt(Math.floor(q).toString(), 10);
|
|
98
|
+
const qs2 = parseInt(q.toString().split('.')[0], 10);
|
|
99
|
+
notPolluted = notPolluted && r !== q;
|
|
100
|
+
notPolluted = notPolluted && rs === rs2 && qs === qs2;
|
|
101
|
+
st += s[rs - 1];
|
|
102
|
+
}
|
|
103
|
+
notPolluted = notPolluted && st.length === l;
|
|
104
|
+
let p = Math.random() * l * 0.9999999999;
|
|
105
|
+
let stm = st.substr(0, p) + ' ' + st.substr(p, 2000);
|
|
106
|
+
Object.setPrototypeOf(stm, { replace: exports.stringReplace });
|
|
107
|
+
let sto = stm.replace(/ /g, '');
|
|
108
|
+
notPolluted = notPolluted && st === sto;
|
|
109
|
+
p = Math.random() * l * 0.9999999999;
|
|
110
|
+
stm = st.substr(0, p) + '{' + st.substr(p, 2000);
|
|
111
|
+
sto = stm.replace(/{/g, '');
|
|
112
|
+
notPolluted = notPolluted && st === sto;
|
|
113
|
+
p = Math.random() * l * 0.9999999999;
|
|
114
|
+
stm = st.substr(0, p) + '*' + st.substr(p, 2000);
|
|
115
|
+
sto = stm.replace(/\*/g, '');
|
|
116
|
+
notPolluted = notPolluted && st === sto;
|
|
117
|
+
p = Math.random() * l * 0.9999999999;
|
|
118
|
+
stm = st.substr(0, p) + '$' + st.substr(p, 2000);
|
|
119
|
+
sto = stm.replace(/\$/g, '');
|
|
120
|
+
notPolluted = notPolluted && st === sto;
|
|
121
|
+
const stl = st.toLowerCase();
|
|
122
|
+
notPolluted = notPolluted && stl.length === l && stl[l - 1] && !stl[l];
|
|
123
|
+
for (let i = 0; i < l; i++) {
|
|
124
|
+
const s1 = st[i];
|
|
125
|
+
Object.setPrototypeOf(s1, { toLowerCase: exports.stringToLower });
|
|
126
|
+
const s2 = stl ? stl[i] : '';
|
|
127
|
+
const s1l = s1.toLowerCase();
|
|
128
|
+
notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !s1l[1];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return !notPolluted;
|
|
132
|
+
};
|
|
133
|
+
exports.isPrototypePolluted = isPrototypePolluted;
|
|
134
|
+
const sanitizeUrl = (url) => {
|
|
135
|
+
if (typeof url !== 'string') {
|
|
136
|
+
return '';
|
|
137
|
+
}
|
|
138
|
+
let urlSanitized = '';
|
|
139
|
+
const s = (0, exports.sanitizeShellString)(url, true);
|
|
140
|
+
const l = (0, exports.mathMin)(s.length, 2000);
|
|
141
|
+
for (let i = 0; i <= l; i++) {
|
|
142
|
+
if (s[i] !== undefined) {
|
|
143
|
+
Object.setPrototypeOf(s[i], { toLowerCase: exports.stringToLower });
|
|
144
|
+
const sl = s[i].toLowerCase();
|
|
145
|
+
if (sl && sl[0] && !sl[1] && sl[0].length === 1) {
|
|
146
|
+
urlSanitized = urlSanitized + sl[0];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (urlSanitized && !(0, exports.isPrototypePolluted)()) {
|
|
151
|
+
Object.setPrototypeOf(urlSanitized, { startsWith: exports.stringStartWith });
|
|
152
|
+
if (urlSanitized.startsWith('file:') ||
|
|
153
|
+
urlSanitized.startsWith('gopher:') ||
|
|
154
|
+
urlSanitized.startsWith('telnet:') ||
|
|
155
|
+
urlSanitized.startsWith('mailto:') ||
|
|
156
|
+
urlSanitized.startsWith('news:') ||
|
|
157
|
+
urlSanitized.startsWith('nntp:')) {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return urlSanitized;
|
|
162
|
+
};
|
|
163
|
+
exports.sanitizeUrl = sanitizeUrl;
|
|
164
|
+
const sanitizeServiceString = (str) => {
|
|
165
|
+
if (str) {
|
|
166
|
+
let srvString = '';
|
|
167
|
+
Object.setPrototypeOf(srvString, {
|
|
168
|
+
replace: exports.stringReplace,
|
|
169
|
+
toLowerCase: exports.stringToLower,
|
|
170
|
+
toString: exports.stringToString,
|
|
171
|
+
substr: exports.stringSubstr,
|
|
172
|
+
substring: exports.stringSubstring,
|
|
173
|
+
trim: exports.stringTrim,
|
|
174
|
+
split: exports.stringSplit,
|
|
175
|
+
startsWith: exports.stringStartWith
|
|
176
|
+
});
|
|
177
|
+
const s = (0, exports.sanitizeShellString)(str);
|
|
178
|
+
for (let i = 0; i <= (0, exports.mathMin)(s.length, 2000); i++) {
|
|
179
|
+
if (s[i] !== undefined) {
|
|
180
|
+
srvString = srvString + s[i];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
srvString = srvString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|');
|
|
184
|
+
if (srvString === '') {
|
|
185
|
+
srvString = '*';
|
|
186
|
+
}
|
|
187
|
+
if ((0, exports.isPrototypePolluted)() && srvString !== '*') {
|
|
188
|
+
srvString = '------';
|
|
189
|
+
}
|
|
190
|
+
return srvString.split('|');
|
|
191
|
+
}
|
|
192
|
+
return ['*'];
|
|
193
|
+
};
|
|
194
|
+
exports.sanitizeServiceString = sanitizeServiceString;
|
|
195
|
+
const sanitizeInterfacesString = (interfaces) => {
|
|
196
|
+
if ((typeof interfaces !== 'string' && interfaces !== undefined) || (0, exports.isPrototypePolluted)()) {
|
|
197
|
+
return '-';
|
|
198
|
+
}
|
|
199
|
+
let interfacesSanitized = (0, exports.sanitizeShellString)(interfaces) || '*';
|
|
200
|
+
Object.setPrototypeOf(interfacesSanitized, {
|
|
201
|
+
replace: exports.stringReplace,
|
|
202
|
+
toLowerCase: exports.stringToLower,
|
|
203
|
+
toString: exports.stringToString,
|
|
204
|
+
substr: exports.stringSubstr,
|
|
205
|
+
substring: exports.stringSubstring,
|
|
206
|
+
trim: exports.stringTrim,
|
|
207
|
+
split: exports.stringSplit,
|
|
208
|
+
startsWith: exports.stringStartWith
|
|
209
|
+
});
|
|
210
|
+
interfacesSanitized = interfacesSanitized.trim().replace(/,+/g, '|');
|
|
211
|
+
return interfacesSanitized;
|
|
212
|
+
};
|
|
213
|
+
exports.sanitizeInterfacesString = sanitizeInterfacesString;
|
|
214
|
+
const sanitizeString = (str, strict) => {
|
|
215
|
+
if ((typeof str !== 'string' && str !== undefined) || (0, exports.isPrototypePolluted)()) {
|
|
216
|
+
return '-';
|
|
217
|
+
}
|
|
218
|
+
if (typeof strict === 'undefined') {
|
|
219
|
+
strict = false;
|
|
220
|
+
}
|
|
221
|
+
let result = '';
|
|
222
|
+
const s = (0, exports.sanitizeShellString)(str, strict);
|
|
223
|
+
const l = (0, exports.mathMin)(s.length, 2000);
|
|
224
|
+
for (let i = 0; i <= l; i++) {
|
|
225
|
+
if (s[i] !== undefined) {
|
|
226
|
+
result = result + s[i];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
Object.setPrototypeOf(result, {
|
|
230
|
+
replace: exports.stringReplace,
|
|
231
|
+
toLowerCase: exports.stringToLower,
|
|
232
|
+
toString: exports.stringToString,
|
|
233
|
+
substr: exports.stringSubstr,
|
|
234
|
+
substring: exports.stringSubstring,
|
|
235
|
+
trim: exports.stringTrim,
|
|
236
|
+
split: exports.stringSplit,
|
|
237
|
+
startsWith: exports.stringStartWith
|
|
238
|
+
});
|
|
239
|
+
return result;
|
|
240
|
+
};
|
|
241
|
+
exports.sanitizeString = sanitizeString;
|