systeminformation 6.0.0-beta.14 → 6.0.0-beta.16

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 CHANGED
@@ -314,12 +314,12 @@ Full function reference with examples can be found at [https://systeminformation
314
314
  | | total | X | X | X | X | X | total memory in bytes |
315
315
  | | free | X | X | X | X | X | not used in bytes |
316
316
  | | used | X | X | X | X | X | used (incl. buffers/cache) |
317
- | | active | X | X | X | X | X | used actively (excl. buffers/cache) |
317
+ | | active | X | X | X | X | X | used actively (excl. buffers/cache and ZFS ARC) |
318
318
  | | buffcache | X | X | X | | X | used by buffers+cache |
319
319
  | | buffers | X | | | | | used by buffers |
320
320
  | | cached | X | | | | | used by cache |
321
321
  | | slab | X | | | | | used by slab |
322
- | | available | X | X | X | X | X | potentially available (total - active) |
322
+ | | available | X | X | X | X | X | potentially available (total - active), incl. reclaimable ZFS ARC |
323
323
  | | swaptotal | X | X | X | X | X | |
324
324
  | | swapused | X | X | X | X | X | |
325
325
  | | swapfree | X | X | X | X | X | |
@@ -365,6 +365,8 @@ In v6 the former `graphics()` function was split into `si.gpu()` (graphics contr
365
365
 
366
366
  On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode each mirrored monitor gets its own entry (sharing the resolution and position of the mirrored screen).
367
367
 
368
+ On Linux, `si.gpu()` also covers the integrated GPU of NVIDIA Tegra / Jetson boards. It is a device tree platform device rather than a PCI one, so `model`, `utilizationGpu`, `temperatureGpu` and `clockCore` are read from the Tegra sysfs nodes - neither `tegrastats` nor `jtop` is required. Its memory is shared with the system, so `vram` is `null` and `vramDynamic` is `true`.
369
+
368
370
  | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
369
371
  | ------------- | ---------------------- | ----- | --- | --- | --- | --- | --------------------------------- |
370
372
  | si.gpu() | [{...}] | X | | X | X | | array of graphics controllers |
@@ -374,8 +376,8 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
374
376
  | | [0].deviceId | | | X | | | device ID |
375
377
  | | [0].bus | X | | X | X | | on which bus (e.g. PCIe) |
376
378
  | | [0].busAddress | X | | | X | | PCI bus address, e.g. '01:00.0' |
377
- | | [0].vram | X | | X | X | | VRAM size (in MB) |
378
- | | [0].vramDynamic | X | | X | X | | true if dynamically allocated ram |
379
+ | | [0].vram | X | | X | X | | VRAM size (in MB), `null` if shared |
380
+ | | [0].vramDynamic | X | | X | X | | true if dynamically allocated ram (integrated GPUs) |
379
381
  | | [0].external | | | X | | | is external GPU |
380
382
  | | [0].cores | | | X | | | Apple silicon only |
381
383
  | | [0].metalVersion | | | X | | | Apple Metal Version |
@@ -434,6 +436,7 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
434
436
  | | remoteSession | | | | X | | runs in remote session (win only) |
435
437
  | | installDate | X | | X | X | | OS installation date (Date object or null) |
436
438
  | | displayServer | X | X | X | X | X | display server e.g. wayland, x11, quartz, dwm, surfaceflinger or '' (headless) |
439
+ | | security | X | | X | | | mandatory access control / system integrity (module, enabled, mode, policy) |
437
440
  | si.uuid() | {...} | X | X | X | X | X | object of several UUIDs |
438
441
  | | os | X | X | X | X | | os specific UUID |
439
442
  | | hardware | X | X | X | X | | hardware specific UUID |
@@ -722,9 +725,11 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
722
725
  | | [0].iface | X | X | X | X | | interface |
723
726
  | | [0].operstate | X | X | X | X | | up / down |
724
727
  | | [0].rx_bytes | X | X | X | X | | received bytes overall |
728
+ | | [0].rx_packets | X | X | X | X | | received packets overall |
725
729
  | | [0].rx_dropped | X | X | X | X | | received dropped overall |
726
730
  | | [0].rx_errors | X | X | X | X | | received errors overall |
727
731
  | | [0].tx_bytes | X | X | X | X | | transferred bytes overall |
732
+ | | [0].tx_packets | X | X | X | X | | transferred packets overall |
728
733
  | | [0].tx_dropped | X | X | X | X | | transferred dropped overall |
729
734
  | | [0].tx_errors | X | X | X | X | | transferred errors overall |
730
735
  | | [0].rx_sec | X | X | X | X | | received bytes / second (* see notes) |
package/dist/bsd/mem.js CHANGED
@@ -8,7 +8,7 @@ const mem = async () => {
8
8
  await (0, common_1.nextTick)();
9
9
  const defaults = (0, common_1.cloneObj)(defaults_1.initMemData);
10
10
  try {
11
- const { stdout } = await (0, exec_1.execSave)('/sbin/sysctl -i hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size');
11
+ const { stdout } = await (0, exec_1.execSave)('/sbin/sysctl -i hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size kstat.zfs.misc.arcstats.size kstat.zfs.misc.arcstats.c_min');
12
12
  const lines = stdout.toString().split('\n');
13
13
  const pagesize = parseInt((0, common_1.getValue)(lines, 'vm.stats.vm.v_page_size'), 10);
14
14
  const inactive = parseInt((0, common_1.getValue)(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
@@ -19,13 +19,18 @@ const mem = async () => {
19
19
  if (isNaN(total)) {
20
20
  total = parseInt((0, common_1.getValue)(lines, 'hw.physmem'), 10);
21
21
  }
22
+ const arcSize = parseInt((0, common_1.getValue)(lines, 'kstat.zfs.misc.arcstats.size'), 10) || 0;
23
+ const arcMin = parseInt((0, common_1.getValue)(lines, 'kstat.zfs.misc.arcstats.c_min'), 10) || 0;
24
+ const arc = Math.max(arcSize - arcMin, 0);
25
+ const available = Math.min(total, buffcache + free + arc);
22
26
  return {
23
27
  ...defaults,
24
28
  total,
25
29
  free,
30
+ used: total - free,
26
31
  buffcache,
27
- available: buffcache + free,
28
- active: total - free - buffcache,
32
+ available,
33
+ active: total - available,
29
34
  swaptotal: 0,
30
35
  swapfree: 0,
31
36
  swapused: 0
@@ -1,2 +1,2 @@
1
- import { NetworkStatsData } from '../common/types';
1
+ import type { NetworkStatsData } from '../common/types';
2
2
  export declare const networkStats: (interfaces: string) => Promise<NetworkStatsData[]>;
@@ -1,20 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.networkStats = void 0;
4
- const exec_1 = require("../common/exec");
5
4
  const common_1 = require("../common");
6
- const security_1 = require("../common/security");
7
5
  const defaults_1 = require("../common/defaults");
8
- const darwin_1 = require("../darwin");
6
+ const exec_1 = require("../common/exec");
9
7
  const network_1 = require("../common/network");
8
+ const security_1 = require("../common/security");
9
+ const darwin_1 = require("../darwin");
10
10
  const EXEC_OPTS = { timeout: 5000 };
11
- const _network = {};
11
+ const _network = Object.create(null);
12
12
  const networkStatsSingle = async (iface) => {
13
13
  const defaults = { ...defaults_1.initNetworkSpeed, iface };
14
14
  if (!_network[iface] || (_network[iface] && !_network[iface].ms) || (_network[iface] && _network[iface].ms && Date.now() - _network[iface].ms >= 500)) {
15
15
  let operstate = 'unknown';
16
16
  let rx_bytes = 0;
17
17
  let tx_bytes = 0;
18
+ let rx_packets = 0;
19
+ let tx_packets = 0;
18
20
  let rx_dropped = 0;
19
21
  let rx_errors = 0;
20
22
  let tx_dropped = 0;
@@ -26,6 +28,8 @@ const networkStatsSingle = async (iface) => {
26
28
  const line = lines[i].replace(/ +/g, ' ').split(' ');
27
29
  if (line && line[0] && line[7] && line[10]) {
28
30
  rx_bytes = rx_bytes + (0, common_1.toInt)(line[7]);
31
+ rx_packets = rx_packets + (0, common_1.toInt)(line[4]);
32
+ tx_packets = tx_packets + (0, common_1.toInt)(line[8]);
29
33
  if (line[6].trim() !== '-') {
30
34
  rx_dropped = rx_dropped + (0, common_1.toInt)(line[6]);
31
35
  }
@@ -42,7 +46,7 @@ const networkStatsSingle = async (iface) => {
42
46
  operstate = 'up';
43
47
  }
44
48
  }
45
- return (0, network_1.calcNetworkSpeed)(iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network);
49
+ return (0, network_1.calcNetworkSpeed)({ iface, rx_bytes, tx_bytes, rx_packets, tx_packets, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate }, _network);
46
50
  }
47
51
  return defaults;
48
52
  }
@@ -51,6 +55,8 @@ const networkStatsSingle = async (iface) => {
51
55
  ...defaults,
52
56
  rx_bytes: _network[iface].rx_bytes,
53
57
  tx_bytes: _network[iface].tx_bytes,
58
+ rx_packets: _network[iface].rx_packets,
59
+ tx_packets: _network[iface].tx_packets,
54
60
  rx_sec: _network[iface].rx_sec,
55
61
  tx_sec: _network[iface].tx_sec,
56
62
  rx_dropped: _network[iface].rx_dropped,
@@ -18,6 +18,7 @@ export declare const osInfo: () => Promise<import("../common/types").OsData | {
18
18
  installDate: Date | null;
19
19
  awake: boolean;
20
20
  hwAcceleration: string[];
21
+ security: import("../common/types").OsSecurityData;
21
22
  hypervizor?: boolean;
22
23
  remoteSession?: boolean;
23
24
  hypervisor?: boolean;
@@ -135,7 +135,13 @@ const initOsInfo = async () => {
135
135
  lastUpdate: null,
136
136
  displayServer: '',
137
137
  awake: true,
138
- hwAcceleration: await (0, acceleration_1.hwAcceleration)()
138
+ hwAcceleration: await (0, acceleration_1.hwAcceleration)(),
139
+ security: {
140
+ module: '',
141
+ enabled: false,
142
+ mode: '',
143
+ policy: ''
144
+ }
139
145
  };
140
146
  };
141
147
  exports.initOsInfo = initOsInfo;
@@ -315,9 +321,11 @@ exports.initNetworkSpeed = {
315
321
  iface: '',
316
322
  operstate: '',
317
323
  rx_bytes: 0,
324
+ rx_packets: 0,
318
325
  rx_dropped: 0,
319
326
  rx_errors: 0,
320
327
  tx_bytes: 0,
328
+ tx_packets: 0,
321
329
  tx_dropped: 0,
322
330
  tx_errors: 0,
323
331
  rx_sec: null,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.execSave = exports.timeout = exports.execSecure = exports.shareInflight = exports.execFile = exports.exec = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const node_util_1 = require("node:util");
6
+ const const_1 = require("./const");
6
7
  exports.exec = (0, node_util_1.promisify)(node_child_process_1.exec);
7
8
  exports.execFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
8
9
  const _inflight = new Map();
@@ -17,35 +18,50 @@ const shareInflight = (key, fn) => {
17
18
  exports.shareInflight = shareInflight;
18
19
  const execSecure = (cmd, args, options) => {
19
20
  let result = '';
20
- options = options || {};
21
+ const { timeout: timeoutMs, ...spawnOptions } = options || {};
21
22
  return new Promise((resolve) => {
22
23
  process.nextTick(() => {
23
- try {
24
- const child = (0, node_child_process_1.spawn)(cmd, args, options);
25
- if (child && !child.pid) {
26
- child.on('error', () => {
27
- resolve(result);
28
- });
24
+ let timer = null;
25
+ const done = () => {
26
+ if (timer) {
27
+ clearTimeout(timer);
28
+ timer = null;
29
29
  }
30
+ resolve(result);
31
+ };
32
+ try {
33
+ const child = (0, node_child_process_1.spawn)(cmd, args, { stdio: ['pipe', 'pipe', 'ignore'], ...spawnOptions });
30
34
  if (child?.pid) {
35
+ if (timeoutMs) {
36
+ timer = setTimeout(() => {
37
+ child.kill('SIGKILL');
38
+ child.stdout?.destroy();
39
+ child.stderr?.destroy();
40
+ child.unref();
41
+ done();
42
+ }, timeoutMs);
43
+ }
31
44
  child.stdout.on('data', (data) => {
32
- result += data.toString();
45
+ if (result.length < const_1.MAX_BUFFER_SIZE) {
46
+ result = (result + data.toString()).substring(0, const_1.MAX_BUFFER_SIZE);
47
+ }
33
48
  });
34
49
  child.on('close', () => {
35
50
  child.kill();
36
- resolve(result);
51
+ done();
37
52
  });
38
53
  child.on('error', () => {
39
54
  child.kill();
40
- resolve(result);
55
+ done();
41
56
  });
42
57
  }
43
58
  else {
44
- resolve(result);
59
+ child?.on('error', () => done());
60
+ done();
45
61
  }
46
62
  }
47
63
  catch {
48
- resolve(result);
64
+ done();
49
65
  }
50
66
  });
51
67
  });
@@ -383,9 +383,9 @@ const btrfsUsableSize = (profile, sizes) => {
383
383
  case 'raid1c4':
384
384
  return Math.floor(sum / 4);
385
385
  case 'raid5':
386
- return sum - (largest[0] || 0);
386
+ return sizes.length > 1 ? sum - (largest[0] || 0) : sum;
387
387
  case 'raid6':
388
- return sum - (largest[0] || 0) - (largest[1] || 0);
388
+ return sizes.length > 2 ? sum - (largest[0] || 0) - (largest[1] || 0) : sum;
389
389
  default:
390
390
  return sum;
391
391
  }
@@ -488,7 +488,7 @@ const btrfsPoolsLinux = async (data) => {
488
488
  name: label || fsid,
489
489
  type: profile || 'btrfs',
490
490
  fsType: 'btrfs',
491
- size: (0, exports.btrfsUsableSize)(profile, members.map((element) => element.size)),
491
+ size: members.length === devices.length ? (0, exports.btrfsUsableSize)(profile, members.map((element) => element.size)) : members.reduce((sum, element) => sum + element.size, 0),
492
492
  uuid: fsid,
493
493
  mount: members.find((element) => element.mount)?.mount || '',
494
494
  members: devices
@@ -1,8 +1,21 @@
1
- import type { NetworkStatsData } from './types';
1
+ import type { NetworkInterfacesData, NetworkStatsData } from './types';
2
2
  export declare const wifiDBFromQuality: (quality: string) => number | null;
3
3
  export declare const wifiQualityFromDB: (db: number | string) => number | null;
4
4
  export declare const wifiFrequencyFromChannel: (channel: number) => any;
5
5
  export declare const wifiChannelFromFrequencies: (frequency: number) => number;
6
6
  export declare const getFirstExternalNetworkInterface: (interfaces: any) => string;
7
7
  export declare const testVirtualNic: (iface: string, ifaceName: string, mac: string) => boolean;
8
- export declare const calcNetworkSpeed: (iface: string, rx_bytes: number, tx_bytes: number, rx_dropped: number, rx_errors: number, tx_dropped: number, tx_errors: number, operstate: string, _network: any) => NetworkStatsData;
8
+ export type NetworkCounters = {
9
+ iface: string;
10
+ rx_bytes: number;
11
+ tx_bytes: number;
12
+ rx_packets: number;
13
+ tx_packets: number;
14
+ rx_dropped: number;
15
+ rx_errors: number;
16
+ tx_dropped: number;
17
+ tx_errors: number;
18
+ operstate: string;
19
+ };
20
+ export declare const calcNetworkSpeed: (counters: NetworkCounters, _network: any) => NetworkStatsData;
21
+ export declare const filterDefaultInterface: (interfaces: NetworkInterfacesData[], defaultString: string) => NetworkInterfacesData[];
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calcNetworkSpeed = exports.testVirtualNic = exports.getFirstExternalNetworkInterface = exports.wifiChannelFromFrequencies = exports.wifiFrequencyFromChannel = exports.wifiQualityFromDB = exports.wifiDBFromQuality = void 0;
4
- const defaults_1 = require("./defaults");
3
+ exports.filterDefaultInterface = exports.calcNetworkSpeed = exports.testVirtualNic = exports.getFirstExternalNetworkInterface = exports.wifiChannelFromFrequencies = exports.wifiFrequencyFromChannel = exports.wifiQualityFromDB = exports.wifiDBFromQuality = void 0;
5
4
  const index_1 = require("./index");
6
5
  const mappings_1 = require("./mappings");
7
6
  const wifiDBFromQuality = (quality) => {
@@ -104,8 +103,8 @@ const testVirtualNic = (iface, ifaceName, mac) => {
104
103
  }
105
104
  };
106
105
  exports.testVirtualNic = testVirtualNic;
107
- const calcNetworkSpeed = (iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network) => {
108
- const result = (0, index_1.cloneObj)(defaults_1.initNetworkSpeed);
106
+ const calcNetworkSpeed = (counters, _network) => {
107
+ const { iface, rx_bytes, tx_bytes, rx_packets, tx_packets, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate } = counters;
109
108
  let rx_sec = null;
110
109
  let tx_sec = null;
111
110
  let rx_bytes_intervall = 0;
@@ -117,41 +116,36 @@ const calcNetworkSpeed = (iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_d
117
116
  tx_bytes_intervall = tx_bytes - _network[iface].tx_bytes;
118
117
  rx_sec = rx_bytes_intervall >= 0 ? rx_bytes_intervall / (ms / 1000) : 0;
119
118
  tx_sec = tx_bytes_intervall >= 0 ? tx_bytes_intervall / (ms / 1000) : 0;
120
- _network[iface].rx_bytes = rx_bytes;
121
- _network[iface].tx_bytes = tx_bytes;
122
119
  _network[iface].rx_sec = rx_sec;
123
120
  _network[iface].tx_sec = tx_sec;
124
- _network[iface].rx_dropped = rx_dropped;
125
- _network[iface].rx_errors = rx_errors;
126
- _network[iface].tx_dropped = tx_dropped;
127
- _network[iface].tx_errors = tx_errors;
128
- _network[iface].ms = Date.now();
129
- _network[iface].last_ms = result.ms;
130
- _network[iface].operstate = operstate;
131
121
  }
132
122
  else {
133
123
  if (!_network[iface]) {
134
124
  _network[iface] = {};
135
125
  }
136
- _network[iface].rx_bytes = rx_bytes;
137
- _network[iface].tx_bytes = tx_bytes;
138
126
  _network[iface].rx_sec = null;
139
127
  _network[iface].tx_sec = null;
140
- _network[iface].rx_dropped = rx_dropped;
141
- _network[iface].rx_errors = rx_errors;
142
- _network[iface].tx_dropped = tx_dropped;
143
- _network[iface].tx_errors = tx_errors;
144
- _network[iface].ms = Date.now();
145
- _network[iface].last_ms = 0;
146
- _network[iface].operstate = operstate;
147
128
  }
129
+ _network[iface].last_ms = ms;
130
+ _network[iface].rx_bytes = rx_bytes;
131
+ _network[iface].tx_bytes = tx_bytes;
132
+ _network[iface].rx_packets = rx_packets;
133
+ _network[iface].tx_packets = tx_packets;
134
+ _network[iface].rx_dropped = rx_dropped;
135
+ _network[iface].rx_errors = rx_errors;
136
+ _network[iface].tx_dropped = tx_dropped;
137
+ _network[iface].tx_errors = tx_errors;
138
+ _network[iface].ms = Date.now();
139
+ _network[iface].operstate = operstate;
148
140
  return {
149
141
  iface,
150
142
  operstate,
151
143
  rx_bytes,
144
+ rx_packets,
152
145
  rx_dropped,
153
146
  rx_errors,
154
147
  tx_bytes,
148
+ tx_packets,
155
149
  tx_dropped,
156
150
  tx_errors,
157
151
  rx_sec,
@@ -160,3 +154,5 @@ const calcNetworkSpeed = (iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_d
160
154
  };
161
155
  };
162
156
  exports.calcNetworkSpeed = calcNetworkSpeed;
157
+ const filterDefaultInterface = (interfaces, defaultString) => defaultString.toLowerCase().indexOf('default') >= 0 ? interfaces.filter((item) => item.default).slice(0, 1) : interfaces.slice();
158
+ exports.filterDefaultInterface = filterDefaultInterface;
@@ -59,7 +59,11 @@ exports.sanitizeShellString = sanitizeShellString;
59
59
  const isSafePathSegment = (segment) => !!segment && segment.indexOf('/') === -1 && segment.indexOf('\0') === -1 && segment !== '.' && segment !== '..';
60
60
  exports.isSafePathSegment = isSafePathSegment;
61
61
  const sanitizeDriveLetter = (str) => {
62
- const match = /^\s*([a-zA-Z]):?[\\/]?\s*$/.exec(String(str || ''));
62
+ const value = String(str || '');
63
+ if (value.length > 2000) {
64
+ return '';
65
+ }
66
+ const match = /^\s*([a-zA-Z]):?[\\/]?\s*$/.exec(value);
63
67
  return match ? `${match[1]}:` : '';
64
68
  };
65
69
  exports.sanitizeDriveLetter = sanitizeDriveLetter;
@@ -156,7 +160,8 @@ const sanitizeUrl = (url) => {
156
160
  }
157
161
  if (urlSanitized && !(0, exports.isPrototypePolluted)()) {
158
162
  Object.setPrototypeOf(urlSanitized, { startsWith: exports.stringStartWith });
159
- if (urlSanitized.startsWith('file:') ||
163
+ if (urlSanitized.startsWith('-') ||
164
+ urlSanitized.startsWith('file:') ||
160
165
  urlSanitized.startsWith('gopher:') ||
161
166
  urlSanitized.startsWith('telnet:') ||
162
167
  urlSanitized.startsWith('mailto:') ||
@@ -215,7 +220,8 @@ const sanitizeInterfacesString = (interfaces) => {
215
220
  startsWith: exports.stringStartWith
216
221
  });
217
222
  interfacesSanitized = interfacesSanitized.trim().replace(/,+/g, '|');
218
- return interfacesSanitized;
223
+ const kept = interfacesSanitized.split('|').filter((part) => part && !/^\s*-/.test(part));
224
+ return kept.length ? kept.join('|') : '-';
219
225
  };
220
226
  exports.sanitizeInterfacesString = sanitizeInterfacesString;
221
227
  const sanitizeString = (str, strict) => {
@@ -464,6 +464,12 @@ export type MemLayoutData = {
464
464
  voltageMin: number | null;
465
465
  voltageMax: number | null;
466
466
  };
467
+ export type OsSecurityData = {
468
+ module: string;
469
+ enabled: boolean;
470
+ mode: string;
471
+ policy: string;
472
+ };
467
473
  export type OsData = {
468
474
  platform: string;
469
475
  distro: string;
@@ -484,6 +490,7 @@ export type OsData = {
484
490
  displayServer: string;
485
491
  awake: boolean;
486
492
  hwAcceleration: string[];
493
+ security: OsSecurityData;
487
494
  hypervizor?: boolean;
488
495
  remoteSession?: boolean;
489
496
  hypervisor?: boolean;
@@ -977,9 +984,11 @@ export type NetworkStatsData = {
977
984
  iface: string;
978
985
  operstate: string;
979
986
  rx_bytes: number;
987
+ rx_packets: number;
980
988
  rx_dropped: number;
981
989
  rx_errors: number;
982
990
  tx_bytes: number;
991
+ tx_packets: number;
983
992
  tx_dropped: number;
984
993
  tx_errors: number;
985
994
  rx_sec: number | null;
@@ -186,7 +186,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
186
186
  await (0, common_1.nextTick)();
187
187
  const interfaces = (0, node_os_1.networkInterfaces)();
188
188
  if (JSON.stringify(interfaces) === JSON.stringify(_interfaces) && !rescan) {
189
- return _networkInterfaces;
189
+ return (0, network_1.filterDefaultInterface)(_networkInterfaces, defaultString);
190
190
  }
191
191
  _interfaces = (0, index_1.cloneObj)(interfaces);
192
192
  let result = [];
@@ -264,10 +264,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
264
264
  });
265
265
  }
266
266
  _networkInterfaces = result;
267
- if (defaultString.toLowerCase().indexOf('default') >= 0) {
268
- result = result.filter((item) => item.default);
269
- return result.length ? [result[0]] : [];
270
- }
267
+ return (0, network_1.filterDefaultInterface)(result, defaultString);
271
268
  }
272
269
  catch { }
273
270
  return result;
@@ -1,2 +1,2 @@
1
- import { NetworkStatsData } from '../common/types';
1
+ import type { NetworkStatsData } from '../common/types';
2
2
  export declare const networkStats: (interfaces: string) => Promise<NetworkStatsData[]>;
@@ -8,7 +8,7 @@ const network_1 = require("../common/network");
8
8
  const security_1 = require("../common/security");
9
9
  const darwin_1 = require("../darwin");
10
10
  const EXEC_OPTS = { timeout: 5000 };
11
- const _network = {};
11
+ const _network = Object.create(null);
12
12
  const networkStatsSingle = async (iface) => {
13
13
  await (0, common_1.nextTick)();
14
14
  const defaults = { ...defaults_1.initNetworkSpeed, iface };
@@ -16,6 +16,8 @@ const networkStatsSingle = async (iface) => {
16
16
  let operstate = 'unknown';
17
17
  let rx_bytes = 0;
18
18
  let tx_bytes = 0;
19
+ let rx_packets = 0;
20
+ let tx_packets = 0;
19
21
  let rx_dropped = 0;
20
22
  let rx_errors = 0;
21
23
  let tx_dropped = 0;
@@ -31,12 +33,14 @@ const networkStatsSingle = async (iface) => {
31
33
  const stats = lines[1].replace(/ +/g, ' ').split(' ');
32
34
  const offset = stats.length > 11 ? 1 : 0;
33
35
  rx_bytes = (0, common_1.toInt)(stats[offset + 5]);
36
+ rx_packets = (0, common_1.toInt)(stats[offset + 3]);
34
37
  rx_dropped = (0, common_1.toInt)(stats[offset + 10]);
35
38
  rx_errors = (0, common_1.toInt)(stats[offset + 4]);
36
39
  tx_bytes = (0, common_1.toInt)(stats[offset + 8]);
40
+ tx_packets = (0, common_1.toInt)(stats[offset + 6]);
37
41
  tx_dropped = (0, common_1.toInt)(stats[offset + 10]);
38
42
  tx_errors = (0, common_1.toInt)(stats[offset + 7]);
39
- return (0, network_1.calcNetworkSpeed)(iface, rx_bytes, tx_bytes, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate, _network);
43
+ return (0, network_1.calcNetworkSpeed)({ iface, rx_bytes, tx_bytes, rx_packets, tx_packets, rx_dropped, rx_errors, tx_dropped, tx_errors, operstate }, _network);
40
44
  }
41
45
  }
42
46
  return defaults;
@@ -46,6 +50,8 @@ const networkStatsSingle = async (iface) => {
46
50
  ...defaults,
47
51
  rx_bytes: _network[iface].rx_bytes,
48
52
  tx_bytes: _network[iface].tx_bytes,
53
+ rx_packets: _network[iface].rx_packets,
54
+ tx_packets: _network[iface].tx_packets,
49
55
  rx_sec: _network[iface].rx_sec,
50
56
  tx_sec: _network[iface].tx_sec,
51
57
  rx_dropped: _network[iface].rx_dropped,
@@ -1,2 +1,4 @@
1
+ import type { OsSecurityData } from '../common/types';
1
2
  export declare const parseLastUpdate: (stdout: string) => Date | null;
3
+ export declare const parseSip: (stdout: string) => OsSecurityData;
2
4
  export declare const osInfo: () => Promise<import("../common/types").OsData>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.osInfo = exports.parseLastUpdate = void 0;
3
+ exports.osInfo = exports.parseSip = exports.parseLastUpdate = void 0;
4
4
  const common_1 = require("../common");
5
5
  const codepage_1 = require("../common/codepage");
6
6
  const defaults_1 = require("../common/defaults");
@@ -110,6 +110,27 @@ const getCodename = (release) => {
110
110
  }
111
111
  return codename;
112
112
  };
113
+ const parseSip = (stdout) => {
114
+ const status = (stdout.toString().split(':')[1] || '').trim().toLowerCase();
115
+ if (!status) {
116
+ return { module: '', enabled: false, mode: '', policy: '' };
117
+ }
118
+ if (status.includes('custom')) {
119
+ return { module: 'sip', enabled: false, mode: 'custom', policy: '' };
120
+ }
121
+ const enabled = status.startsWith('enabled');
122
+ return {
123
+ module: 'sip',
124
+ enabled,
125
+ mode: enabled ? 'enforcing' : status.startsWith('disabled') ? 'disabled' : 'custom',
126
+ policy: ''
127
+ };
128
+ };
129
+ exports.parseSip = parseSip;
130
+ const getSecurity = async () => {
131
+ const { stdout } = await (0, exec_1.execSave)('csrutil status');
132
+ return (0, exports.parseSip)(stdout);
133
+ };
113
134
  const osInfo = async () => {
114
135
  await (0, common_1.nextTick)();
115
136
  const defaults = await (0, defaults_1.initOsInfo)();
@@ -131,7 +152,8 @@ const osInfo = async () => {
131
152
  installDate: await getInstallDate(),
132
153
  lastUpdate: await getLastUpdate(),
133
154
  displayServer: await getDisplayServer(),
134
- awake: await getAwake()
155
+ awake: await getAwake(),
156
+ security: await getSecurity()
135
157
  };
136
158
  }
137
159
  catch { }
@@ -7,7 +7,7 @@ const exec_1 = require("../common/exec");
7
7
  const users = async () => {
8
8
  await (0, common_1.nextTick)();
9
9
  let stdout = '';
10
- ({ stdout } = await (0, exec_1.execSave)('export LC_ALL=C; who; echo "---"; w -ih; unset LC_ALL'));
10
+ ({ stdout } = await (0, exec_1.execSave)('export LC_ALL=C.UTF-8; who; echo "---"; w -ih; unset LC_ALL'));
11
11
  return (0, darwin_1.parseUsersDarwin)(stdout);
12
12
  };
13
13
  exports.users = users;
@@ -43,7 +43,7 @@ const cpuTemperature = async () => {
43
43
  if (line.startsWith('pch') && temp) {
44
44
  result.chipset = Math.round(Number.parseInt(temp, 10) / 100) / 10;
45
45
  }
46
- if (cpuThermal === null && line.indexOf('cpu') !== -1 && temp) {
46
+ if (cpuThermal === null && line.toLowerCase().indexOf('cpu') !== -1 && temp) {
47
47
  cpuThermal = Math.round(parseInt(temp, 10) / 100) / 10;
48
48
  }
49
49
  }
@@ -16,7 +16,7 @@ const diskLayout = async () => {
16
16
  let cmd = '';
17
17
  let cmdFullSmart = '';
18
18
  try {
19
- ({ stdout } = await (0, exec_1.exec)('export LC_ALL=C; lsblk -ablJO 2>/dev/null; unset LC_ALL', const_1.execOptsLinux));
19
+ ({ stdout } = await (0, exec_1.exec)('export LC_ALL=C.UTF-8; lsblk -ablJO 2>/dev/null; unset LC_ALL', const_1.execOptsLinux));
20
20
  const out = stdout.trim();
21
21
  let devices = [];
22
22
  try {
@@ -37,7 +37,7 @@ const diskLayout = async () => {
37
37
  }
38
38
  catch (e) {
39
39
  try {
40
- ({ stdout } = await (0, exec_1.exec)('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL', const_1.execOptsLinux));
40
+ ({ stdout } = await (0, exec_1.exec)('export LC_ALL=C.UTF-8; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL', const_1.execOptsLinux));
41
41
  const lines = (0, filesys_1.blkStdoutToObject)(stdout).split('\n');
42
42
  const data = (0, filesys_1.parseLinuxBlk)(lines);
43
43
  devices = data.filter((item) => {
@@ -1,2 +1,2 @@
1
- import { FsSizeData } from '../common/types';
1
+ import type { FsSizeData } from '../common/types';
2
2
  export declare const fsSize: (drives: string[]) => Promise<FsSizeData[]>;
@@ -9,7 +9,7 @@ const files_1 = require("../common/files");
9
9
  const filesys_1 = require("../common/filesys");
10
10
  let macOsDisks = [];
11
11
  let macOsFsTypes = new Map();
12
- let osMounts = {};
12
+ let osMounts = Object.create(null);
13
13
  const macOsFsType = (fs) => {
14
14
  const type = macOsFsTypes.get(fs);
15
15
  if (!type) {
@@ -220,7 +220,7 @@ const fsSize = async (drives) => {
220
220
  let lines = [];
221
221
  macOsDisks = [];
222
222
  macOsFsTypes = new Map();
223
- osMounts = {};
223
+ osMounts = Object.create(null);
224
224
  if (const_1.DARWIN) {
225
225
  cmd = 'df -kP';
226
226
  try {
@@ -257,7 +257,7 @@ const fsSize = async (drives) => {
257
257
  if (linuxData) {
258
258
  return await applyZfsUsage(linuxData);
259
259
  }
260
- cmd = 'export LC_ALL=C; df -kPTx squashfs; unset LC_ALL';
260
+ cmd = 'export LC_ALL=C.UTF-8; df -kPTx squashfs; unset LC_ALL';
261
261
  }
262
262
  if (const_1.FREEBSD || const_1.NETBSD || const_1.OPENBSD) {
263
263
  try {