systeminformation 6.0.0-beta.24 → 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.
- package/README.md +47 -5
- package/dist/bsd/index.d.ts +2 -0
- package/dist/bsd/index.js +5 -1
- package/dist/common/defaults.js +15 -4
- package/dist/common/disk-speed.d.ts +20 -0
- package/dist/common/disk-speed.js +142 -0
- package/dist/common/filesys.d.ts +1 -1
- package/dist/common/filesys.js +24 -4
- package/dist/common/mappings.d.ts +1 -1
- package/dist/common/mappings.js +14 -4
- package/dist/common/types.d.ts +32 -0
- package/dist/common/windows.d.ts +1 -0
- package/dist/common/windows.js +19 -5
- package/dist/cpu-current-load.js +45 -0
- package/dist/cpu-current-speed.js +6 -0
- package/dist/darwin/cpu-current-speed.d.ts +2 -0
- package/dist/darwin/cpu-current-speed.js +30 -0
- package/dist/darwin/cpu-temperature.js +7 -13
- package/dist/darwin/disk-speed.d.ts +2 -0
- package/dist/darwin/disk-speed.js +18 -0
- package/dist/darwin/disks-io.js +3 -1
- package/dist/darwin/fans.js +11 -13
- package/dist/darwin/gpu.d.ts +1 -1
- package/dist/darwin/gpu.js +4 -4
- package/dist/darwin/index.d.ts +2 -0
- package/dist/darwin/index.js +6 -2
- package/dist/darwin/network-interfaces.js +14 -4
- package/dist/darwin/network-routes.d.ts +3 -0
- package/dist/darwin/network-routes.js +74 -0
- package/dist/disk-speed.d.ts +1 -0
- package/dist/disk-speed.js +17 -0
- package/dist/get.js +5 -5
- package/dist/index.d.ts +11 -8
- package/dist/index.js +28 -21
- package/dist/linux/block-devices.d.ts +1 -1
- package/dist/linux/block-devices.js +21 -5
- package/dist/linux/cpu-topology.d.ts +2 -0
- package/dist/linux/cpu-topology.js +15 -0
- package/dist/linux/disk-speed.d.ts +2 -0
- package/dist/linux/disk-speed.js +16 -0
- package/dist/linux/disks-io.d.ts +1 -1
- package/dist/linux/disks-io.js +18 -7
- package/dist/linux/index.d.ts +2 -0
- package/dist/linux/index.js +6 -2
- package/dist/linux/mem.js +20 -1
- package/dist/linux/network-interfaces.js +18 -7
- package/dist/linux/network-routes.d.ts +4 -0
- package/dist/linux/network-routes.js +69 -0
- package/dist/linux/os-info.js +32 -4
- package/dist/linux/pci.d.ts +1 -1
- package/dist/linux/pci.js +4 -3
- package/dist/network-routes.d.ts +1 -0
- package/dist/network-routes.js +17 -0
- package/dist/powershell.d.ts +2 -0
- package/dist/powershell.js +15 -0
- package/dist/windows/block-devices.js +6 -1
- package/dist/windows/cpu-topology.d.ts +3 -0
- package/dist/windows/cpu-topology.js +90 -0
- package/dist/windows/disk-speed.d.ts +6 -0
- package/dist/windows/disk-speed.js +73 -0
- package/dist/windows/disks-io.js +3 -1
- package/dist/windows/index.d.ts +2 -0
- package/dist/windows/index.js +6 -2
- package/dist/windows/network-interfaces.js +6 -3
- package/dist/windows/network-routes.d.ts +3 -0
- package/dist/windows/network-routes.js +41 -0
- package/package.json +1 -1
|
@@ -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,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,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;
|
package/dist/windows/disks-io.js
CHANGED
|
@@ -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
|
};
|
package/dist/windows/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/windows/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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.
|
|
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)
|
|
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
|
-
|
|
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,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.
|
|
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)",
|