systeminformation 6.0.0-beta.23 → 6.0.0-beta.25

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.
Files changed (71) hide show
  1. package/README.md +47 -5
  2. package/dist/bsd/index.d.ts +2 -0
  3. package/dist/bsd/index.js +5 -1
  4. package/dist/common/const.d.ts +2 -0
  5. package/dist/common/const.js +8 -3
  6. package/dist/common/defaults.js +15 -4
  7. package/dist/common/disk-speed.d.ts +20 -0
  8. package/dist/common/disk-speed.js +142 -0
  9. package/dist/common/exec.d.ts +5 -2
  10. package/dist/common/exec.js +6 -3
  11. package/dist/common/filesys.d.ts +1 -1
  12. package/dist/common/filesys.js +24 -4
  13. package/dist/common/mappings.d.ts +1 -1
  14. package/dist/common/mappings.js +14 -4
  15. package/dist/common/types.d.ts +32 -0
  16. package/dist/common/windows.d.ts +1 -0
  17. package/dist/common/windows.js +21 -7
  18. package/dist/cpu-current-load.js +45 -0
  19. package/dist/cpu-current-speed.js +6 -0
  20. package/dist/darwin/cpu-current-speed.d.ts +2 -0
  21. package/dist/darwin/cpu-current-speed.js +30 -0
  22. package/dist/darwin/cpu-temperature.js +7 -13
  23. package/dist/darwin/disk-speed.d.ts +2 -0
  24. package/dist/darwin/disk-speed.js +18 -0
  25. package/dist/darwin/disks-io.js +3 -1
  26. package/dist/darwin/fans.js +11 -13
  27. package/dist/darwin/gpu.d.ts +1 -1
  28. package/dist/darwin/gpu.js +4 -4
  29. package/dist/darwin/index.d.ts +2 -0
  30. package/dist/darwin/index.js +6 -2
  31. package/dist/darwin/network-interfaces.js +14 -4
  32. package/dist/darwin/network-routes.d.ts +3 -0
  33. package/dist/darwin/network-routes.js +74 -0
  34. package/dist/disk-speed.d.ts +1 -0
  35. package/dist/disk-speed.js +17 -0
  36. package/dist/get.js +5 -5
  37. package/dist/index.d.ts +11 -8
  38. package/dist/index.js +28 -21
  39. package/dist/linux/block-devices.d.ts +1 -1
  40. package/dist/linux/block-devices.js +21 -5
  41. package/dist/linux/cpu-topology.d.ts +2 -0
  42. package/dist/linux/cpu-topology.js +15 -0
  43. package/dist/linux/disk-speed.d.ts +2 -0
  44. package/dist/linux/disk-speed.js +16 -0
  45. package/dist/linux/disks-io.d.ts +1 -1
  46. package/dist/linux/disks-io.js +18 -7
  47. package/dist/linux/index.d.ts +2 -0
  48. package/dist/linux/index.js +6 -2
  49. package/dist/linux/mem.js +20 -1
  50. package/dist/linux/network-interfaces.js +18 -7
  51. package/dist/linux/network-routes.d.ts +4 -0
  52. package/dist/linux/network-routes.js +69 -0
  53. package/dist/linux/os-info.js +32 -4
  54. package/dist/linux/pci.d.ts +1 -1
  55. package/dist/linux/pci.js +4 -3
  56. package/dist/network-routes.d.ts +1 -0
  57. package/dist/network-routes.js +17 -0
  58. package/dist/powershell.d.ts +2 -0
  59. package/dist/powershell.js +15 -0
  60. package/dist/windows/block-devices.js +6 -1
  61. package/dist/windows/cpu-topology.d.ts +3 -0
  62. package/dist/windows/cpu-topology.js +90 -0
  63. package/dist/windows/disk-speed.d.ts +6 -0
  64. package/dist/windows/disk-speed.js +73 -0
  65. package/dist/windows/disks-io.js +3 -1
  66. package/dist/windows/index.d.ts +2 -0
  67. package/dist/windows/index.js +6 -2
  68. package/dist/windows/network-interfaces.js +6 -3
  69. package/dist/windows/network-routes.d.ts +3 -0
  70. package/dist/windows/network-routes.js +41 -0
  71. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.osInfo = void 0;
4
+ const promises_1 = require("node:fs/promises");
4
5
  const common_1 = require("../common");
5
6
  const codepage_1 = require("../common/codepage");
6
7
  const const_1 = require("../common/const");
7
8
  const defaults_1 = require("../common/defaults");
8
9
  const exec_1 = require("../common/exec");
9
- const promises_1 = require("node:fs/promises");
10
10
  const files_1 = require("../common/files");
11
11
  const mappings_1 = require("../common/mappings");
12
- const uuid_1 = require("./uuid");
13
12
  const security_1 = require("../common/security");
13
+ const uuid_1 = require("./uuid");
14
14
  const getInstallDate = async () => {
15
15
  try {
16
16
  const { stdout } = await (0, exec_1.exec)('stat -c %W / 2>/dev/null', const_1.execOptsLinux);
@@ -104,6 +104,33 @@ const getSecurity = async () => {
104
104
  }
105
105
  return { module: '', enabled: false, mode: '', policy: '' };
106
106
  };
107
+ const UBUNTU_FLAVORS = [
108
+ ['ubuntustudio-desktop', 'Ubuntu Studio'],
109
+ ['kubuntu-desktop', 'Kubuntu'],
110
+ ['xubuntu-desktop', 'Xubuntu'],
111
+ ['lubuntu-desktop', 'Lubuntu'],
112
+ ['ubuntu-mate-desktop', 'Ubuntu MATE'],
113
+ ['ubuntu-budgie-desktop', 'Ubuntu Budgie'],
114
+ ['ubuntucinnamon-desktop', 'Ubuntu Cinnamon'],
115
+ ['ubuntu-unity-desktop', 'Ubuntu Unity'],
116
+ ['ubuntukylin-desktop', 'Ubuntu Kylin']
117
+ ];
118
+ const getDistroVariant = async (distro, variant) => {
119
+ if (distro.toLowerCase() === 'ubuntu') {
120
+ const installed = await Promise.all(UBUNTU_FLAVORS.map(([pkg]) => (0, files_1.fileExists)(`/var/lib/dpkg/info/${pkg}.list`)));
121
+ const flavor = UBUNTU_FLAVORS.find((_, i) => installed[i]);
122
+ if (flavor) {
123
+ return flavor[1];
124
+ }
125
+ }
126
+ if (distro.toLowerCase().startsWith('debian') && (await (0, files_1.fileExists)('/etc/rpi-issue'))) {
127
+ return 'Raspberry Pi OS';
128
+ }
129
+ if (distro.toLowerCase().startsWith('fedora') && variant && !/edition|container/i.test(variant)) {
130
+ return `${distro} (${variant})`;
131
+ }
132
+ return distro;
133
+ };
107
134
  const parseOsInfo = async (stdout, defaults) => {
108
135
  const release = {};
109
136
  const lines = stdout.toString().split('\n');
@@ -123,10 +150,11 @@ const parseOsInfo = async (stdout, defaults) => {
123
150
  codename = releaseVersion.split('(')[1].replace(/[()]/g, '').trim();
124
151
  releaseVersion = releaseVersion.split('(')[0].trim();
125
152
  }
153
+ const distroName = await getDistroVariant(distro, (release.VARIANT || '').replace(/"/g, '').trim());
126
154
  return {
127
155
  ...defaults,
128
- distro: (release.DISTRIB_ID || release.NAME || 'unknown').replace(/"/g, ''),
129
- logofile: (0, mappings_1.getLogoFile)(distro),
156
+ distro: distroName,
157
+ logofile: (0, mappings_1.getLogoFile)(distroName),
130
158
  release: (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, ''),
131
159
  codename: codename,
132
160
  codepage: (0, codepage_1.getCodepage)(),
@@ -1,2 +1,2 @@
1
- import { PciData } from '../common/types';
1
+ import type { PciData } from '../common/types';
2
2
  export declare const pci: () => Promise<PciData[]>;
package/dist/linux/pci.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pci = void 0;
4
- const exec_1 = require("../common/exec");
5
4
  const common_1 = require("../common");
6
- const defaults_1 = require("../common/defaults");
7
5
  const const_1 = require("../common/const");
6
+ const defaults_1 = require("../common/defaults");
7
+ const exec_1 = require("../common/exec");
8
8
  const splitId = (value) => {
9
9
  const match = value.match(/^(.*?)\s*\[([0-9a-fA-F]{4})\]\s*$/);
10
10
  if (match) {
@@ -38,7 +38,8 @@ const parsePci = (stdout) => {
38
38
  subVendorId: svendor.id,
39
39
  subDeviceId: sdevice.id,
40
40
  revision: (0, common_1.getValue)(lines, 'Rev', ':', true),
41
- driver: (0, common_1.getValue)(lines, 'Driver', ':', true)
41
+ driver: (0, common_1.getValue)(lines, 'Driver', ':', true),
42
+ iommuGroup: (0, common_1.getValue)(lines, 'IOMMUGroup', ':', true)
42
43
  });
43
44
  });
44
45
  return result;
@@ -0,0 +1 @@
1
+ export declare const networkRoutes: () => Promise<import("./common/types").NetworkRouteData[] | null>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.networkRoutes = void 0;
4
+ const const_1 = require("./common/const");
5
+ const networkRoutes = async () => {
6
+ switch (true) {
7
+ case const_1.LINUX:
8
+ return (await import('./linux/network-routes.js')).networkRoutes();
9
+ case const_1.DARWIN || const_1.FREEBSD || const_1.NETBSD || const_1.OPENBSD:
10
+ return (await import('./darwin/network-routes.js')).networkRoutes();
11
+ case const_1.WINDOWS:
12
+ return (await import('./windows/network-routes.js')).networkRoutes();
13
+ default:
14
+ return null;
15
+ }
16
+ };
17
+ exports.networkRoutes = networkRoutes;
@@ -0,0 +1,2 @@
1
+ export declare const powerShellStart: () => Promise<void>;
2
+ export declare const powerShellRelease: () => Promise<void>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.powerShellRelease = exports.powerShellStart = void 0;
4
+ const const_1 = require("./common/const");
5
+ const windows_1 = require("./common/windows");
6
+ const powerShellStart = async () => {
7
+ if (const_1.WINDOWS) {
8
+ await windows_1.ps.start();
9
+ }
10
+ };
11
+ exports.powerShellStart = powerShellStart;
12
+ const powerShellRelease = async () => {
13
+ await windows_1.ps.stop();
14
+ };
15
+ exports.powerShellRelease = powerShellRelease;
@@ -33,7 +33,12 @@ const parseBlockDevices = (logicalDisks, volumes) => {
33
33
  removable: drivetype === 2,
34
34
  protocol: '',
35
35
  group: '',
36
- device: ''
36
+ device: '',
37
+ partUuid: '',
38
+ partLabel: '',
39
+ partType: '',
40
+ partFlags: '',
41
+ partStart: null
37
42
  });
38
43
  }
39
44
  });
@@ -0,0 +1,3 @@
1
+ import type { CpuTopologyData } from '../common/types';
2
+ export declare const parseCpuTopology: (stdout: string) => CpuTopologyData[];
3
+ export declare const cpuTopology: () => Promise<CpuTopologyData[]>;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cpuTopology = exports.parseCpuTopology = void 0;
4
+ const common_1 = require("../common");
5
+ const windows_1 = require("../common/windows");
6
+ const TOPOLOGY_SOURCE = `
7
+ using System;
8
+ using System.Runtime.InteropServices;
9
+ public static class SiCpuTopology {
10
+ [DllImport("kernel32.dll", SetLastError = true)]
11
+ static extern bool GetLogicalProcessorInformationEx(int relationship, IntPtr buffer, ref uint length);
12
+ [DllImport("kernel32.dll")]
13
+ static extern ushort GetActiveProcessorGroupCount();
14
+ [DllImport("kernel32.dll")]
15
+ static extern uint GetActiveProcessorCount(ushort group);
16
+
17
+ public static string Get() {
18
+ int groups = GetActiveProcessorGroupCount();
19
+ int[] offset = new int[groups + 1];
20
+ for (int g = 0; g < groups; g++) offset[g + 1] = offset[g] + (int)GetActiveProcessorCount((ushort)g);
21
+ int total = offset[groups];
22
+ int[] core = new int[total];
23
+ int[] socket = new int[total];
24
+ for (int i = 0; i < total; i++) { core[i] = -1; socket[i] = -1; }
25
+
26
+ uint len = 0;
27
+ GetLogicalProcessorInformationEx(0xffff, IntPtr.Zero, ref len);
28
+ if (len == 0) return "";
29
+ IntPtr buf = Marshal.AllocHGlobal((int)len);
30
+ try {
31
+ if (!GetLogicalProcessorInformationEx(0xffff, buf, ref len)) return "";
32
+ // PROCESSOR_RELATIONSHIP: GroupCount at 30, GROUP_AFFINITY[] at 32
33
+ // (KAFFINITY mask + WORD Group + WORD Reserved[3] = 16 bytes on 64 bit, 12 on 32 bit)
34
+ int stride = IntPtr.Size == 8 ? 16 : 12;
35
+ int coreIdx = 0;
36
+ int pkgIdx = 0;
37
+ long pos = 0;
38
+ while (pos < len) {
39
+ IntPtr rec = new IntPtr(buf.ToInt64() + pos);
40
+ int rel = Marshal.ReadInt32(rec, 0);
41
+ int size = Marshal.ReadInt32(rec, 4);
42
+ if (size <= 0) break;
43
+ // 0 = RelationProcessorCore, 3 = RelationProcessorPackage
44
+ if (rel == 0 || rel == 3) {
45
+ int groupCount = Marshal.ReadInt16(rec, 30);
46
+ for (int k = 0; k < groupCount; k++) {
47
+ int entry = 32 + k * stride;
48
+ ulong mask = IntPtr.Size == 8 ? (ulong)Marshal.ReadInt64(rec, entry) : (uint)Marshal.ReadInt32(rec, entry);
49
+ int group = Marshal.ReadInt16(rec, entry + IntPtr.Size);
50
+ if (group < 0 || group >= groups) continue;
51
+ for (int bit = 0; bit < IntPtr.Size * 8; bit++) {
52
+ if (((mask >> bit) & 1UL) == 0) continue;
53
+ int idx = offset[group] + bit;
54
+ if (idx >= total) continue;
55
+ if (rel == 0) core[idx] = coreIdx; else socket[idx] = pkgIdx;
56
+ }
57
+ }
58
+ if (rel == 0) coreIdx++; else pkgIdx++;
59
+ }
60
+ pos += size;
61
+ }
62
+ } finally {
63
+ Marshal.FreeHGlobal(buf);
64
+ }
65
+ string[] parts = new string[total];
66
+ for (int i = 0; i < total; i++) parts[i] = core[i] + "," + socket[i];
67
+ return String.Join(";", parts);
68
+ }
69
+ }
70
+ `;
71
+ const toId = (value) => (/^\d+$/.test((value || '').trim()) ? (0, common_1.toInt)(value) : null);
72
+ const parseCpuTopology = (stdout) => stdout
73
+ .trim()
74
+ .split(';')
75
+ .filter((part) => part.includes(','))
76
+ .map((part) => {
77
+ const [coreId, socketId] = part.split(',');
78
+ return { coreId: toId(coreId), socketId: toId(socketId) };
79
+ });
80
+ exports.parseCpuTopology = parseCpuTopology;
81
+ const cpuTopology = async () => {
82
+ try {
83
+ const stdout = await windows_1.ps.exec(`if (-not ('SiCpuTopology' -as [type])) { Add-Type -TypeDefinition @'${TOPOLOGY_SOURCE}'@ }; [SiCpuTopology]::Get()`);
84
+ return (0, exports.parseCpuTopology)(String(stdout || ''));
85
+ }
86
+ catch {
87
+ return [];
88
+ }
89
+ };
90
+ exports.cpuTopology = cpuTopology;
@@ -0,0 +1,6 @@
1
+ import type { DiskSpeedData } from '../common/types';
2
+ export declare const parseReadResult: (stdout: string) => {
3
+ bytes: number;
4
+ ms: number;
5
+ } | null;
6
+ export declare const diskSpeed: (path?: string, sizeMB?: number) => Promise<DiskSpeedData | null>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.diskSpeed = exports.parseReadResult = void 0;
4
+ const disk_speed_1 = require("../common/disk-speed");
5
+ const windows_1 = require("../common/windows");
6
+ const READ_SOURCE = `
7
+ using System;
8
+ using System.Diagnostics;
9
+ using System.Globalization;
10
+ using System.Runtime.InteropServices;
11
+ using System.Threading;
12
+ using Microsoft.Win32.SafeHandles;
13
+ public static class SiDiskRead {
14
+ [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
15
+ static extern SafeFileHandle CreateFileW(string name, uint access, uint share, IntPtr security, uint disposition, uint flags, IntPtr template);
16
+ [DllImport("kernel32.dll", SetLastError = true)]
17
+ static extern bool ReadFile(SafeFileHandle handle, IntPtr buffer, uint toRead, out uint read, ref NativeOverlapped overlapped);
18
+ [DllImport("kernel32.dll", SetLastError = true)]
19
+ static extern IntPtr VirtualAlloc(IntPtr address, UIntPtr size, uint type, uint protect);
20
+ [DllImport("kernel32.dll", SetLastError = true)]
21
+ static extern bool VirtualFree(IntPtr address, UIntPtr size, uint type);
22
+
23
+ public static string Read(string path, long maxBytes, long budgetMs, int block, int queue) {
24
+ long next = 0;
25
+ long total = 0;
26
+ bool failed = false;
27
+ Stopwatch watch = Stopwatch.StartNew();
28
+ Thread[] threads = new Thread[queue];
29
+ for (int i = 0; i < queue; i++) {
30
+ threads[i] = new Thread(() => {
31
+ // GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING
32
+ using (SafeFileHandle handle = CreateFileW(path, 0x80000000, 1, IntPtr.Zero, 3, 0x20000000, IntPtr.Zero)) {
33
+ if (handle.IsInvalid) { failed = true; return; }
34
+ // MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE
35
+ IntPtr buffer = VirtualAlloc(IntPtr.Zero, (UIntPtr)(uint)block, 0x3000, 0x04);
36
+ if (buffer == IntPtr.Zero) { failed = true; return; }
37
+ try {
38
+ while (watch.ElapsedMilliseconds < budgetMs) {
39
+ long pos = Interlocked.Add(ref next, block) - block;
40
+ if (pos >= maxBytes) break;
41
+ NativeOverlapped position = new NativeOverlapped();
42
+ position.OffsetLow = (int)(pos & 0xFFFFFFFF);
43
+ position.OffsetHigh = (int)(pos >> 32);
44
+ uint read;
45
+ if (!ReadFile(handle, buffer, (uint)block, out read, ref position) || read == 0) break;
46
+ Interlocked.Add(ref total, read);
47
+ }
48
+ } finally {
49
+ VirtualFree(buffer, UIntPtr.Zero, 0x8000);
50
+ }
51
+ }
52
+ });
53
+ threads[i].Start();
54
+ }
55
+ foreach (Thread thread in threads) thread.Join();
56
+ watch.Stop();
57
+ if (failed) return "";
58
+ return total + "," + watch.Elapsed.TotalMilliseconds.ToString(CultureInfo.InvariantCulture);
59
+ }
60
+ }
61
+ `;
62
+ const parseReadResult = (stdout) => {
63
+ const [bytes, ms] = stdout.trim().split(',').map(Number);
64
+ return bytes !== undefined && ms !== undefined && Number.isFinite(bytes) && Number.isFinite(ms) && bytes > 0 && ms > 0 ? { bytes, ms } : null;
65
+ };
66
+ exports.parseReadResult = parseReadResult;
67
+ const readUncached = async (file, bytes) => {
68
+ const path64 = Buffer.from(file, 'utf8').toString('base64');
69
+ const script = `if (-not ('SiDiskRead' -as [type])) { Add-Type -TypeDefinition @'${READ_SOURCE}'@ }; [SiDiskRead]::Read([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${path64}')), ${Math.trunc(bytes)}, ${disk_speed_1.DISK_SPEED.budgetMs}, ${disk_speed_1.DISK_SPEED.block}, ${disk_speed_1.DISK_SPEED.queue})`;
70
+ return (0, exports.parseReadResult)(String((await windows_1.ps.exec(script)) || ''));
71
+ };
72
+ const diskSpeed = (path, sizeMB) => (0, disk_speed_1.runDiskSpeed)(path, sizeMB, { readUncached });
73
+ exports.diskSpeed = diskSpeed;
@@ -39,7 +39,9 @@ const disksIO = async () => {
39
39
  tWaitTime: filesys_1._disk_io.tWaitTimeDelta,
40
40
  rWaitPercent: filesys_1._disk_io.rWaitPercent,
41
41
  wWaitPercent: filesys_1._disk_io.wWaitPercent,
42
- tWaitPercent: filesys_1._disk_io.tWaitPercent
42
+ tWaitPercent: filesys_1._disk_io.tWaitPercent,
43
+ busyPercent: filesys_1._disk_io.busyPercent,
44
+ idlePercent: filesys_1._disk_io.idlePercent
43
45
  };
44
46
  }
45
47
  };
@@ -21,6 +21,7 @@ export { cpuFlags } from './cpu-flags';
21
21
  export { cpuTemperature } from './cpu-temperature';
22
22
  export { fans } from './fans';
23
23
  export { diskLayout } from './disk-layout';
24
+ export { diskSpeed } from './disk-speed';
24
25
  export { disksIO } from './disks-io';
25
26
  export { displays } from './displays';
26
27
  export { fsOpenFiles } from './fs-open-files';
@@ -36,6 +37,7 @@ export { networkConnections } from './network-connections';
36
37
  export { networkGatewayDefault } from './network-gateway-default';
37
38
  export { networkInterfaceDefault } from './network-interface-default';
38
39
  export { networkInterfaces } from './network-interfaces';
40
+ export { networkRoutes } from './network-routes';
39
41
  export { networkStats } from './network-stats';
40
42
  export { npm } from './npm';
41
43
  export { npu } from './npu';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.gpu = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.displays = exports.disksIO = exports.diskLayout = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
4
- exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.uuid = exports.users = exports.usb = exports.serialPorts = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processes = exports.processFocused = exports.processLoad = void 0;
3
+ exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkRoutes = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.gpu = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.displays = exports.disksIO = exports.diskSpeed = exports.diskLayout = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = exports.vboxInfo = exports.versions = exports.version = exports.time = exports.inetChecksite = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainerStats = exports.dockerContainers = exports.dockerContainerProcesses = exports.dockerAll = exports.fullLoad = exports.cpuCurrentSpeed = exports.currentLoad = void 0;
4
+ exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.uuid = exports.users = exports.usb = exports.serialPorts = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processes = exports.processFocused = exports.processLoad = exports.printer = exports.pci = void 0;
5
5
  var cpu_current_load_1 = require("../cpu-current-load");
6
6
  Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
7
7
  var cpu_current_speed_1 = require("../cpu-current-speed");
@@ -54,6 +54,8 @@ var fans_1 = require("./fans");
54
54
  Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
55
55
  var disk_layout_1 = require("./disk-layout");
56
56
  Object.defineProperty(exports, "diskLayout", { enumerable: true, get: function () { return disk_layout_1.diskLayout; } });
57
+ var disk_speed_1 = require("./disk-speed");
58
+ Object.defineProperty(exports, "diskSpeed", { enumerable: true, get: function () { return disk_speed_1.diskSpeed; } });
57
59
  var disks_io_1 = require("./disks-io");
58
60
  Object.defineProperty(exports, "disksIO", { enumerable: true, get: function () { return disks_io_1.disksIO; } });
59
61
  var displays_1 = require("./displays");
@@ -84,6 +86,8 @@ var network_interface_default_1 = require("./network-interface-default");
84
86
  Object.defineProperty(exports, "networkInterfaceDefault", { enumerable: true, get: function () { return network_interface_default_1.networkInterfaceDefault; } });
85
87
  var network_interfaces_1 = require("./network-interfaces");
86
88
  Object.defineProperty(exports, "networkInterfaces", { enumerable: true, get: function () { return network_interfaces_1.networkInterfaces; } });
89
+ var network_routes_1 = require("./network-routes");
90
+ Object.defineProperty(exports, "networkRoutes", { enumerable: true, get: function () { return network_routes_1.networkRoutes; } });
87
91
  var network_stats_1 = require("./network-stats");
88
92
  Object.defineProperty(exports, "networkStats", { enumerable: true, get: function () { return network_stats_1.networkStats; } });
89
93
  var npm_1 = require("./npm");
@@ -17,7 +17,7 @@ const parseLinesWindowsNics = (sections, nconfigsections) => {
17
17
  const nics = [];
18
18
  for (let i = 0; i < sections.length; i++) {
19
19
  try {
20
- if (Object.prototype.hasOwnProperty.call(sections, i)) {
20
+ if (Object.hasOwn(sections, i)) {
21
21
  if (sections[i].trim() !== '') {
22
22
  const lines = sections[i].trim().split('\r\n');
23
23
  let linesNicConfig = null;
@@ -154,7 +154,9 @@ const getWindowsWiredProfilesInformation = async () => {
154
154
  const getWindowsWirelessIfaceSSID = async (interfaceName) => {
155
155
  try {
156
156
  const { stdout } = await (0, exec_1.execFile)('netsh', ['wlan', 'show', 'interface', `name=${(0, security_1.sanitizeString)(interfaceName)}`], const_1.execOptsWin);
157
- const SSID = String(stdout).split('\r\n').find((l) => l.includes('SSID')) || '';
157
+ const SSID = String(stdout)
158
+ .split('\r\n')
159
+ .find((l) => l.includes('SSID')) || '';
158
160
  const parseSSID = (SSID.split(':').pop() || '').trim();
159
161
  return parseSSID;
160
162
  }
@@ -232,7 +234,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
232
234
  return (0, network_1.filterDefaultInterface)(_networkInterfaces, defaultString);
233
235
  }
234
236
  _interfaces = (0, index_1.cloneObj)(interfaces);
235
- let result = [];
237
+ const result = [];
236
238
  try {
237
239
  const defaultInterface = await (0, network_interface_default_1.networkInterfaceDefault)();
238
240
  const nics = await getWindowsNics();
@@ -311,6 +313,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
311
313
  const virtual = internal ? false : (0, network_1.testVirtualNic)(dev, ifaceName, mac);
312
314
  result.push({
313
315
  ...defaults_1.initNetworkInterface,
316
+ bridgeMembers: [],
314
317
  iface,
315
318
  ifaceName,
316
319
  vendor,
@@ -0,0 +1,3 @@
1
+ import type { NetworkRouteData } from '../common/types';
2
+ export declare const parseWindowsRoutes: (data: any) => NetworkRouteData[];
3
+ export declare const networkRoutes: () => Promise<NetworkRouteData[]>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.networkRoutes = exports.parseWindowsRoutes = void 0;
4
+ const common_1 = require("../common");
5
+ const windows_1 = require("../common/windows");
6
+ const ROUTES_SCRIPT = [
7
+ "$routes = @(Get-NetRoute -PolicyStore ActiveStore -ErrorAction SilentlyContinue | Select-Object DestinationPrefix,NextHop,InterfaceAlias,InterfaceIndex,RouteMetric,@{n='Family';e={[int]$_.AddressFamily}});",
8
+ "$ifaces = @(Get-NetIPInterface -ErrorAction SilentlyContinue | Select-Object InterfaceIndex,InterfaceMetric,@{n='Family';e={[int]$_.AddressFamily}});",
9
+ '@{ routes = $routes; ifaces = $ifaces } | ConvertTo-Json -Depth 3 -Compress'
10
+ ].join(' ');
11
+ const familyName = (value) => ((0, common_1.toInt)(String(value)) === 23 ? 'IPv6' : 'IPv4');
12
+ const parseWindowsRoutes = (data) => {
13
+ const ifaceMetrics = new Map();
14
+ for (const iface of (0, windows_1.psArray)(data?.ifaces)) {
15
+ ifaceMetrics.set(`${iface?.InterfaceIndex}/${familyName(iface?.Family)}`, (0, common_1.toInt)(String(iface?.InterfaceMetric)) || 0);
16
+ }
17
+ return (0, windows_1.psArray)(data?.routes).map((route) => {
18
+ const family = familyName(route?.Family);
19
+ const routeMetric = typeof route?.RouteMetric === 'number' ? route.RouteMetric : Number.NaN;
20
+ const ifaceMetric = ifaceMetrics.get(`${route?.InterfaceIndex}/${family}`) ?? 0;
21
+ const nextHop = String(route?.NextHop || '');
22
+ return {
23
+ destination: String(route?.DestinationPrefix || ''),
24
+ gateway: nextHop === '0.0.0.0' || nextHop === '::' ? '' : nextHop,
25
+ iface: String(route?.InterfaceAlias || ''),
26
+ metric: Number.isNaN(routeMetric) ? null : routeMetric + ifaceMetric,
27
+ family
28
+ };
29
+ });
30
+ };
31
+ exports.parseWindowsRoutes = parseWindowsRoutes;
32
+ const networkRoutes = async () => {
33
+ await (0, common_1.nextTick)();
34
+ try {
35
+ return (0, exports.parseWindowsRoutes)(await windows_1.ps.exec(ROUTES_SCRIPT));
36
+ }
37
+ catch {
38
+ return [];
39
+ }
40
+ };
41
+ exports.networkRoutes = networkRoutes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "6.0.0-beta.23",
3
+ "version": "6.0.0-beta.25",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",