systeminformation 5.28.9 → 5.29.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/LICENSE +1 -1
- package/README.md +3 -2
- package/lib/audio.js +1 -1
- package/lib/battery.js +1 -1
- package/lib/bluetooth.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cpu.js +1 -1
- package/lib/docker.js +138 -101
- package/lib/dockerSocket.js +9 -14
- package/lib/filesystem.js +1 -1
- package/lib/graphics.js +2 -2
- package/lib/index.js +1 -1
- package/lib/internet.js +67 -27
- package/lib/memory.js +249 -202
- package/lib/network.js +1 -1
- package/lib/osinfo.js +110 -77
- package/lib/printer.js +10 -11
- package/lib/processes.js +1 -1
- package/lib/system.js +2 -2
- package/lib/usb.js +79 -45
- package/lib/users.js +67 -43
- package/lib/util.js +1 -1
- package/lib/virtualbox.js +9 -6
- package/lib/wifi.js +1 -1
- package/package.json +1 -1
package/lib/printer.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -18,13 +18,13 @@ const util = require('./util');
|
|
|
18
18
|
|
|
19
19
|
let _platform = process.platform;
|
|
20
20
|
|
|
21
|
-
const _linux =
|
|
22
|
-
const _darwin =
|
|
23
|
-
const _windows =
|
|
24
|
-
const _freebsd =
|
|
25
|
-
const _openbsd =
|
|
26
|
-
const _netbsd =
|
|
27
|
-
const _sunos =
|
|
21
|
+
const _linux = _platform === 'linux' || _platform === 'android';
|
|
22
|
+
const _darwin = _platform === 'darwin';
|
|
23
|
+
const _windows = _platform === 'win32';
|
|
24
|
+
const _freebsd = _platform === 'freebsd';
|
|
25
|
+
const _openbsd = _platform === 'openbsd';
|
|
26
|
+
const _netbsd = _platform === 'netbsd';
|
|
27
|
+
const _sunos = _platform === 'sunos';
|
|
28
28
|
|
|
29
29
|
const winPrinterStatus = {
|
|
30
30
|
1: 'Other',
|
|
@@ -33,7 +33,7 @@ const winPrinterStatus = {
|
|
|
33
33
|
4: 'Printing',
|
|
34
34
|
5: 'Warmup',
|
|
35
35
|
6: 'Stopped Printing',
|
|
36
|
-
7: 'Offline'
|
|
36
|
+
7: 'Offline'
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
function parseLinuxCupsHeader(lines) {
|
|
@@ -70,7 +70,7 @@ function parseLinuxLpstatPrinter(lines, id) {
|
|
|
70
70
|
result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : '';
|
|
71
71
|
result.uri = null;
|
|
72
72
|
result.uuid = null;
|
|
73
|
-
result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' :
|
|
73
|
+
result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown') : null;
|
|
74
74
|
result.local = util.getValue(lines, 'Location', ':', true).toLowerCase().startsWith('local');
|
|
75
75
|
result.default = null;
|
|
76
76
|
result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes');
|
|
@@ -112,7 +112,6 @@ function parseWindowsPrinters(lines, id) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function printer(callback) {
|
|
115
|
-
|
|
116
115
|
return new Promise((resolve) => {
|
|
117
116
|
process.nextTick(() => {
|
|
118
117
|
let result = [];
|
package/lib/processes.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
package/lib/system.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -250,7 +250,7 @@ function system(callback) {
|
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
if (_darwin) {
|
|
253
|
-
exec('ioreg -c IOPlatformExpertDevice -d 2',
|
|
253
|
+
exec('ioreg -c IOPlatformExpertDevice -d 2', (error, stdout) => {
|
|
254
254
|
if (!error) {
|
|
255
255
|
const lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
|
|
256
256
|
|
package/lib/usb.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -18,26 +18,36 @@ const util = require('./util');
|
|
|
18
18
|
|
|
19
19
|
let _platform = process.platform;
|
|
20
20
|
|
|
21
|
-
const _linux =
|
|
22
|
-
const _darwin =
|
|
23
|
-
const _windows =
|
|
24
|
-
const _freebsd =
|
|
25
|
-
const _openbsd =
|
|
26
|
-
const _netbsd =
|
|
27
|
-
const _sunos =
|
|
21
|
+
const _linux = _platform === 'linux' || _platform === 'android';
|
|
22
|
+
const _darwin = _platform === 'darwin';
|
|
23
|
+
const _windows = _platform === 'win32';
|
|
24
|
+
const _freebsd = _platform === 'freebsd';
|
|
25
|
+
const _openbsd = _platform === 'openbsd';
|
|
26
|
+
const _netbsd = _platform === 'netbsd';
|
|
27
|
+
const _sunos = _platform === 'sunos';
|
|
28
28
|
|
|
29
29
|
function getLinuxUsbType(type, name) {
|
|
30
30
|
let result = type;
|
|
31
31
|
const str = (name + ' ' + type).toLowerCase();
|
|
32
|
-
if (str.indexOf('camera') >= 0) {
|
|
33
|
-
|
|
34
|
-
else if (str.indexOf('
|
|
35
|
-
|
|
36
|
-
else if (str.indexOf('
|
|
37
|
-
|
|
38
|
-
else if (str.indexOf('
|
|
39
|
-
|
|
40
|
-
else if (str.indexOf('
|
|
32
|
+
if (str.indexOf('camera') >= 0) {
|
|
33
|
+
result = 'Camera';
|
|
34
|
+
} else if (str.indexOf('hub') >= 0) {
|
|
35
|
+
result = 'Hub';
|
|
36
|
+
} else if (str.indexOf('keybrd') >= 0) {
|
|
37
|
+
result = 'Keyboard';
|
|
38
|
+
} else if (str.indexOf('keyboard') >= 0) {
|
|
39
|
+
result = 'Keyboard';
|
|
40
|
+
} else if (str.indexOf('mouse') >= 0) {
|
|
41
|
+
result = 'Mouse';
|
|
42
|
+
} else if (str.indexOf('stora') >= 0) {
|
|
43
|
+
result = 'Storage';
|
|
44
|
+
} else if (str.indexOf('microp') >= 0) {
|
|
45
|
+
result = 'Microphone';
|
|
46
|
+
} else if (str.indexOf('headset') >= 0) {
|
|
47
|
+
result = 'Audio';
|
|
48
|
+
} else if (str.indexOf('audio') >= 0) {
|
|
49
|
+
result = 'Audio';
|
|
50
|
+
}
|
|
41
51
|
|
|
42
52
|
return result;
|
|
43
53
|
}
|
|
@@ -96,21 +106,37 @@ function parseLinuxUsb(usb) {
|
|
|
96
106
|
|
|
97
107
|
function getDarwinUsbType(name) {
|
|
98
108
|
let result = '';
|
|
99
|
-
if (name.indexOf('camera') >= 0) {
|
|
100
|
-
|
|
101
|
-
else if (name.indexOf('
|
|
102
|
-
|
|
103
|
-
else if (name.indexOf('
|
|
104
|
-
|
|
105
|
-
else if (name.indexOf('
|
|
106
|
-
|
|
107
|
-
else if (name.indexOf('
|
|
108
|
-
|
|
109
|
-
else if (name.indexOf('
|
|
110
|
-
|
|
111
|
-
else if (name.indexOf('
|
|
112
|
-
|
|
113
|
-
else if (name.indexOf('
|
|
109
|
+
if (name.indexOf('camera') >= 0) {
|
|
110
|
+
result = 'Camera';
|
|
111
|
+
} else if (name.indexOf('touch bar') >= 0) {
|
|
112
|
+
result = 'Touch Bar';
|
|
113
|
+
} else if (name.indexOf('controller') >= 0) {
|
|
114
|
+
result = 'Controller';
|
|
115
|
+
} else if (name.indexOf('headset') >= 0) {
|
|
116
|
+
result = 'Audio';
|
|
117
|
+
} else if (name.indexOf('keyboard') >= 0) {
|
|
118
|
+
result = 'Keyboard';
|
|
119
|
+
} else if (name.indexOf('trackpad') >= 0) {
|
|
120
|
+
result = 'Trackpad';
|
|
121
|
+
} else if (name.indexOf('sensor') >= 0) {
|
|
122
|
+
result = 'Sensor';
|
|
123
|
+
} else if (name.indexOf('bthusb') >= 0) {
|
|
124
|
+
result = 'Bluetooth';
|
|
125
|
+
} else if (name.indexOf('bth') >= 0) {
|
|
126
|
+
result = 'Bluetooth';
|
|
127
|
+
} else if (name.indexOf('rfcomm') >= 0) {
|
|
128
|
+
result = 'Bluetooth';
|
|
129
|
+
} else if (name.indexOf('usbhub') >= 0) {
|
|
130
|
+
result = 'Hub';
|
|
131
|
+
} else if (name.indexOf(' hub') >= 0) {
|
|
132
|
+
result = 'Hub';
|
|
133
|
+
} else if (name.indexOf('mouse') >= 0) {
|
|
134
|
+
result = 'Mouse';
|
|
135
|
+
} else if (name.indexOf('microp') >= 0) {
|
|
136
|
+
result = 'Microphone';
|
|
137
|
+
} else if (name.indexOf('removable') >= 0) {
|
|
138
|
+
result = 'Storage';
|
|
139
|
+
}
|
|
114
140
|
return result;
|
|
115
141
|
}
|
|
116
142
|
|
|
@@ -174,15 +200,25 @@ function parseDarwinUsb(usb, id) {
|
|
|
174
200
|
|
|
175
201
|
function getWindowsUsbTypeCreation(creationclass, name) {
|
|
176
202
|
let result = '';
|
|
177
|
-
if (name.indexOf('storage') >= 0) {
|
|
178
|
-
|
|
179
|
-
else if (
|
|
180
|
-
|
|
181
|
-
else if (creationclass.indexOf('
|
|
182
|
-
|
|
183
|
-
else if (creationclass.indexOf('
|
|
184
|
-
|
|
185
|
-
else if (creationclass.indexOf('
|
|
203
|
+
if (name.indexOf('storage') >= 0) {
|
|
204
|
+
result = 'Storage';
|
|
205
|
+
} else if (name.indexOf('speicher') >= 0) {
|
|
206
|
+
result = 'Storage';
|
|
207
|
+
} else if (creationclass.indexOf('usbhub') >= 0) {
|
|
208
|
+
result = 'Hub';
|
|
209
|
+
} else if (creationclass.indexOf('storage') >= 0) {
|
|
210
|
+
result = 'Storage';
|
|
211
|
+
} else if (creationclass.indexOf('usbcontroller') >= 0) {
|
|
212
|
+
result = 'Controller';
|
|
213
|
+
} else if (creationclass.indexOf('keyboard') >= 0) {
|
|
214
|
+
result = 'Keyboard';
|
|
215
|
+
} else if (creationclass.indexOf('pointing') >= 0) {
|
|
216
|
+
result = 'Mouse';
|
|
217
|
+
} else if (creationclass.indexOf('microp') >= 0) {
|
|
218
|
+
result = 'Microphone';
|
|
219
|
+
} else if (creationclass.indexOf('disk') >= 0) {
|
|
220
|
+
result = 'Storage';
|
|
221
|
+
}
|
|
186
222
|
return result;
|
|
187
223
|
}
|
|
188
224
|
|
|
@@ -209,7 +245,6 @@ function parseWindowsUsb(lines, id) {
|
|
|
209
245
|
}
|
|
210
246
|
|
|
211
247
|
function usb(callback) {
|
|
212
|
-
|
|
213
248
|
return new Promise((resolve) => {
|
|
214
249
|
process.nextTick(() => {
|
|
215
250
|
let result = [];
|
|
@@ -233,7 +268,7 @@ function usb(callback) {
|
|
|
233
268
|
let cmd = 'ioreg -p IOUSB -c AppleUSBRootHubDevice -w0 -l';
|
|
234
269
|
exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) {
|
|
235
270
|
if (!error) {
|
|
236
|
-
const parts =
|
|
271
|
+
const parts = stdout.toString().split(' +-o ');
|
|
237
272
|
for (let i = 1; i < parts.length; i++) {
|
|
238
273
|
const usb = parseDarwinUsb(parts[i]);
|
|
239
274
|
if (usb) {
|
|
@@ -257,7 +292,7 @@ function usb(callback) {
|
|
|
257
292
|
const parts = stdout.toString().split(/\n\s*\n/);
|
|
258
293
|
for (let i = 0; i < parts.length; i++) {
|
|
259
294
|
const usb = parseWindowsUsb(parts[i].split('\n'), i);
|
|
260
|
-
if (usb && result.filter(x => x.deviceId === usb.deviceId).length === 0) {
|
|
295
|
+
if (usb && result.filter((x) => x.deviceId === usb.deviceId).length === 0) {
|
|
261
296
|
result.push(usb);
|
|
262
297
|
}
|
|
263
298
|
}
|
|
@@ -276,4 +311,3 @@ function usb(callback) {
|
|
|
276
311
|
}
|
|
277
312
|
|
|
278
313
|
exports.usb = usb;
|
|
279
|
-
|
package/lib/users.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -18,13 +18,13 @@ const util = require('./util');
|
|
|
18
18
|
|
|
19
19
|
let _platform = process.platform;
|
|
20
20
|
|
|
21
|
-
const _linux =
|
|
22
|
-
const _darwin =
|
|
23
|
-
const _windows =
|
|
24
|
-
const _freebsd =
|
|
25
|
-
const _openbsd =
|
|
26
|
-
const _netbsd =
|
|
27
|
-
const _sunos =
|
|
21
|
+
const _linux = _platform === 'linux' || _platform === 'android';
|
|
22
|
+
const _darwin = _platform === 'darwin';
|
|
23
|
+
const _windows = _platform === 'win32';
|
|
24
|
+
const _freebsd = _platform === 'freebsd';
|
|
25
|
+
const _openbsd = _platform === 'openbsd';
|
|
26
|
+
const _netbsd = _platform === 'netbsd';
|
|
27
|
+
const _sunos = _platform === 'sunos';
|
|
28
28
|
|
|
29
29
|
function parseUsersLinux(lines, phase) {
|
|
30
30
|
let result = [];
|
|
@@ -49,11 +49,12 @@ function parseUsersLinux(lines, phase) {
|
|
|
49
49
|
tty: l[1],
|
|
50
50
|
date: l[2],
|
|
51
51
|
time: l[3],
|
|
52
|
-
ip:
|
|
52
|
+
ip: l && l.length > 4 ? l[4].replace(/\(/g, '').replace(/\)/g, '') : ''
|
|
53
53
|
});
|
|
54
54
|
} else {
|
|
55
55
|
// w part
|
|
56
|
-
if (w_first) {
|
|
56
|
+
if (w_first) {
|
|
57
|
+
// header
|
|
57
58
|
w_header = l;
|
|
58
59
|
w_header.forEach(function (item) {
|
|
59
60
|
w_pos.push(line.indexOf(item));
|
|
@@ -63,11 +64,15 @@ function parseUsersLinux(lines, phase) {
|
|
|
63
64
|
// split by w_pos
|
|
64
65
|
result_w.user = line.substring(w_pos[0], w_pos[1] - 1).trim();
|
|
65
66
|
result_w.tty = line.substring(w_pos[1], w_pos[2] - 1).trim();
|
|
66
|
-
result_w.ip = line
|
|
67
|
+
result_w.ip = line
|
|
68
|
+
.substring(w_pos[2], w_pos[3] - 1)
|
|
69
|
+
.replace(/\(/g, '')
|
|
70
|
+
.replace(/\)/g, '')
|
|
71
|
+
.trim();
|
|
67
72
|
result_w.command = line.substring(w_pos[7], 1000).trim();
|
|
68
73
|
// find corresponding 'who' line
|
|
69
74
|
who_line = result_who.filter(function (obj) {
|
|
70
|
-
return
|
|
75
|
+
return obj.user.substring(0, 8).trim() === result_w.user && obj.tty === result_w.tty;
|
|
71
76
|
});
|
|
72
77
|
if (who_line.length === 1) {
|
|
73
78
|
result.push({
|
|
@@ -105,10 +110,10 @@ function parseUsersDarwin(lines) {
|
|
|
105
110
|
|
|
106
111
|
// who part
|
|
107
112
|
if (is_whopart) {
|
|
108
|
-
let dt =
|
|
113
|
+
let dt = '' + new Date().getFullYear() + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
|
|
109
114
|
try {
|
|
110
|
-
if (new Date(dt) > new Date) {
|
|
111
|
-
dt =
|
|
115
|
+
if (new Date(dt) > new Date()) {
|
|
116
|
+
dt = '' + (new Date().getFullYear() - 1) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
|
|
112
117
|
}
|
|
113
118
|
} catch {
|
|
114
119
|
util.noop();
|
|
@@ -117,18 +122,18 @@ function parseUsersDarwin(lines) {
|
|
|
117
122
|
user: l[0],
|
|
118
123
|
tty: l[1],
|
|
119
124
|
date: dt,
|
|
120
|
-
time: l[4]
|
|
125
|
+
time: l[4]
|
|
121
126
|
});
|
|
122
127
|
} else {
|
|
123
128
|
// w part
|
|
124
129
|
// split by w_pos
|
|
125
130
|
result_w.user = l[0];
|
|
126
131
|
result_w.tty = l[1];
|
|
127
|
-
result_w.ip =
|
|
132
|
+
result_w.ip = l[2] !== '-' ? l[2] : '';
|
|
128
133
|
result_w.command = l.slice(5, 1000).join(' ');
|
|
129
134
|
// find corresponding 'who' line
|
|
130
135
|
who_line = result_who.filter(function (obj) {
|
|
131
|
-
return
|
|
136
|
+
return obj.user.substring(0, 10) === result_w.user.substring(0, 10) && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty);
|
|
132
137
|
});
|
|
133
138
|
if (who_line.length === 1) {
|
|
134
139
|
result.push({
|
|
@@ -147,7 +152,6 @@ function parseUsersDarwin(lines) {
|
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
function users(callback) {
|
|
150
|
-
|
|
151
155
|
return new Promise((resolve) => {
|
|
152
156
|
process.nextTick(() => {
|
|
153
157
|
let result = [];
|
|
@@ -166,15 +170,21 @@ function users(callback) {
|
|
|
166
170
|
lines = stdout.toString().split('\n');
|
|
167
171
|
result = parseUsersLinux(lines, 2);
|
|
168
172
|
}
|
|
169
|
-
if (callback) {
|
|
173
|
+
if (callback) {
|
|
174
|
+
callback(result);
|
|
175
|
+
}
|
|
170
176
|
resolve(result);
|
|
171
177
|
});
|
|
172
178
|
} else {
|
|
173
|
-
if (callback) {
|
|
179
|
+
if (callback) {
|
|
180
|
+
callback(result);
|
|
181
|
+
}
|
|
174
182
|
resolve(result);
|
|
175
183
|
}
|
|
176
184
|
} else {
|
|
177
|
-
if (callback) {
|
|
185
|
+
if (callback) {
|
|
186
|
+
callback(result);
|
|
187
|
+
}
|
|
178
188
|
resolve(result);
|
|
179
189
|
}
|
|
180
190
|
});
|
|
@@ -186,7 +196,9 @@ function users(callback) {
|
|
|
186
196
|
let lines = stdout.toString().split('\n');
|
|
187
197
|
result = parseUsersDarwin(lines);
|
|
188
198
|
}
|
|
189
|
-
if (callback) {
|
|
199
|
+
if (callback) {
|
|
200
|
+
callback(result);
|
|
201
|
+
}
|
|
190
202
|
resolve(result);
|
|
191
203
|
});
|
|
192
204
|
}
|
|
@@ -197,7 +209,9 @@ function users(callback) {
|
|
|
197
209
|
let lines = stdout.toString().split('\n');
|
|
198
210
|
result = parseUsersDarwin(lines);
|
|
199
211
|
}
|
|
200
|
-
if (callback) {
|
|
212
|
+
if (callback) {
|
|
213
|
+
callback(result);
|
|
214
|
+
}
|
|
201
215
|
resolve(result);
|
|
202
216
|
});
|
|
203
217
|
}
|
|
@@ -209,15 +223,18 @@ function users(callback) {
|
|
|
209
223
|
let lines = stdout.toString().split('\n');
|
|
210
224
|
result = parseUsersDarwin(lines);
|
|
211
225
|
}
|
|
212
|
-
if (callback) {
|
|
226
|
+
if (callback) {
|
|
227
|
+
callback(result);
|
|
228
|
+
}
|
|
213
229
|
resolve(result);
|
|
214
230
|
});
|
|
215
231
|
}
|
|
216
232
|
if (_windows) {
|
|
217
233
|
try {
|
|
218
|
-
let cmd = 'Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl' +
|
|
219
|
-
cmd += 'Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ' +
|
|
220
|
-
cmd +=
|
|
234
|
+
let cmd = 'Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl' + "; echo '#-#-#-#';";
|
|
235
|
+
cmd += 'Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ' + "; echo '#-#-#-#';";
|
|
236
|
+
cmd +=
|
|
237
|
+
"$process = (Get-CimInstance Win32_Process -Filter \"name = 'explorer.exe'\"); Invoke-CimMethod -InputObject $process[0] -MethodName GetOwner | select user, domain | fl; get-process -name explorer | select-object sessionid | fl; echo '#-#-#-#';";
|
|
221
238
|
cmd += 'query user';
|
|
222
239
|
util.powerShell(cmd).then((data) => {
|
|
223
240
|
if (data) {
|
|
@@ -231,7 +248,7 @@ function users(callback) {
|
|
|
231
248
|
loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : '';
|
|
232
249
|
}
|
|
233
250
|
}
|
|
234
|
-
users.forEach(user => {
|
|
251
|
+
users.forEach((user) => {
|
|
235
252
|
let dateTime = '';
|
|
236
253
|
for (let id in loggedons) {
|
|
237
254
|
if ({}.hasOwnProperty.call(loggedons, id)) {
|
|
@@ -251,12 +268,15 @@ function users(callback) {
|
|
|
251
268
|
});
|
|
252
269
|
});
|
|
253
270
|
}
|
|
254
|
-
if (callback) {
|
|
271
|
+
if (callback) {
|
|
272
|
+
callback(result);
|
|
273
|
+
}
|
|
255
274
|
resolve(result);
|
|
256
|
-
|
|
257
275
|
});
|
|
258
276
|
} catch (e) {
|
|
259
|
-
if (callback) {
|
|
277
|
+
if (callback) {
|
|
278
|
+
callback(result);
|
|
279
|
+
}
|
|
260
280
|
resolve(result);
|
|
261
281
|
}
|
|
262
282
|
}
|
|
@@ -266,7 +286,7 @@ function users(callback) {
|
|
|
266
286
|
|
|
267
287
|
function parseWinSessions(sessionParts) {
|
|
268
288
|
const sessions = {};
|
|
269
|
-
sessionParts.forEach(session => {
|
|
289
|
+
sessionParts.forEach((session) => {
|
|
270
290
|
const lines = session.split('\r\n');
|
|
271
291
|
const id = util.getValue(lines, 'LogonId');
|
|
272
292
|
const starttime = util.getValue(lines, 'starttime');
|
|
@@ -282,19 +302,23 @@ function fuzzyMatch(name1, name2) {
|
|
|
282
302
|
name2 = name2.toLowerCase();
|
|
283
303
|
let eq = 0;
|
|
284
304
|
let len = name1.length;
|
|
285
|
-
if (name2.length > len) {
|
|
305
|
+
if (name2.length > len) {
|
|
306
|
+
len = name2.length;
|
|
307
|
+
}
|
|
286
308
|
|
|
287
309
|
for (let i = 0; i < len; i++) {
|
|
288
310
|
const c1 = name1[i] || '';
|
|
289
311
|
const c2 = name2[i] || '';
|
|
290
|
-
if (c1 === c2) {
|
|
312
|
+
if (c1 === c2) {
|
|
313
|
+
eq++;
|
|
314
|
+
}
|
|
291
315
|
}
|
|
292
|
-
return
|
|
316
|
+
return len > 10 ? eq / len > 0.9 : len > 0 ? eq / len > 0.8 : false;
|
|
293
317
|
}
|
|
294
318
|
|
|
295
319
|
function parseWinUsers(userParts, userQuery) {
|
|
296
320
|
const users = [];
|
|
297
|
-
userParts.forEach(user => {
|
|
321
|
+
userParts.forEach((user) => {
|
|
298
322
|
const lines = user.split('\r\n');
|
|
299
323
|
|
|
300
324
|
const domain = util.getValue(lines, 'domain', ':', true);
|
|
@@ -302,7 +326,7 @@ function parseWinUsers(userParts, userQuery) {
|
|
|
302
326
|
const sessionid = util.getValue(lines, 'sessionid', ':', true);
|
|
303
327
|
|
|
304
328
|
if (username) {
|
|
305
|
-
const quser = userQuery.filter(item => fuzzyMatch(item.user, username));
|
|
329
|
+
const quser = userQuery.filter((item) => fuzzyMatch(item.user, username));
|
|
306
330
|
users.push({
|
|
307
331
|
domain,
|
|
308
332
|
user: username,
|
|
@@ -315,7 +339,7 @@ function parseWinUsers(userParts, userQuery) {
|
|
|
315
339
|
|
|
316
340
|
function parseWinLoggedOn(loggedonParts) {
|
|
317
341
|
const loggedons = {};
|
|
318
|
-
loggedonParts.forEach(loggedon => {
|
|
342
|
+
loggedonParts.forEach((loggedon) => {
|
|
319
343
|
const lines = loggedon.split('\r\n');
|
|
320
344
|
|
|
321
345
|
const antecendent = util.getValue(lines, 'antecedent', ':', true);
|
|
@@ -336,16 +360,16 @@ function parseWinLoggedOn(loggedonParts) {
|
|
|
336
360
|
}
|
|
337
361
|
|
|
338
362
|
function parseWinUsersQuery(lines) {
|
|
339
|
-
lines = lines.filter(item => item);
|
|
363
|
+
lines = lines.filter((item) => item);
|
|
340
364
|
let result = [];
|
|
341
365
|
const header = lines[0];
|
|
342
366
|
const headerDelimiter = [];
|
|
343
367
|
if (header) {
|
|
344
|
-
const start =
|
|
368
|
+
const start = header[0] === ' ' ? 1 : 0;
|
|
345
369
|
headerDelimiter.push(start - 1);
|
|
346
370
|
let nextSpace = 0;
|
|
347
371
|
for (let i = start + 1; i < header.length; i++) {
|
|
348
|
-
if (header[i] === ' ' && (
|
|
372
|
+
if (header[i] === ' ' && (header[i - 1] === ' ' || header[i - 1] === '.')) {
|
|
349
373
|
nextSpace = i;
|
|
350
374
|
} else {
|
|
351
375
|
if (nextSpace) {
|
|
@@ -360,7 +384,7 @@ function parseWinUsersQuery(lines) {
|
|
|
360
384
|
const tty = lines[i].substring(headerDelimiter[1] + 1, headerDelimiter[2] - 2).trim() || '';
|
|
361
385
|
result.push({
|
|
362
386
|
user: user,
|
|
363
|
-
tty: tty
|
|
387
|
+
tty: tty
|
|
364
388
|
});
|
|
365
389
|
}
|
|
366
390
|
}
|
package/lib/util.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
package/lib/virtualbox.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
|
@@ -18,7 +18,6 @@ const exec = require('child_process').exec;
|
|
|
18
18
|
const util = require('./util');
|
|
19
19
|
|
|
20
20
|
function vboxInfo(callback) {
|
|
21
|
-
|
|
22
21
|
// fallback - if only callback is given
|
|
23
22
|
let result = [];
|
|
24
23
|
return new Promise((resolve) => {
|
|
@@ -27,7 +26,7 @@ function vboxInfo(callback) {
|
|
|
27
26
|
exec(util.getVboxmanage() + ' list vms --long', function (error, stdout) {
|
|
28
27
|
let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:');
|
|
29
28
|
parts.shift();
|
|
30
|
-
parts.forEach(part => {
|
|
29
|
+
parts.forEach((part) => {
|
|
31
30
|
const lines = ('Name:' + part).split(os.EOL);
|
|
32
31
|
const state = util.getValue(lines, 'State');
|
|
33
32
|
const running = state.startsWith('running');
|
|
@@ -89,15 +88,19 @@ function vboxInfo(callback) {
|
|
|
89
88
|
bootDevice3: util.getValue(lines, 'Boot Device 3'),
|
|
90
89
|
bootDevice4: util.getValue(lines, 'Boot Device 4'),
|
|
91
90
|
timeOffset: util.getValue(lines, 'Time offset'),
|
|
92
|
-
rtc: util.getValue(lines, 'RTC')
|
|
91
|
+
rtc: util.getValue(lines, 'RTC')
|
|
93
92
|
});
|
|
94
93
|
});
|
|
95
94
|
|
|
96
|
-
if (callback) {
|
|
95
|
+
if (callback) {
|
|
96
|
+
callback(result);
|
|
97
|
+
}
|
|
97
98
|
resolve(result);
|
|
98
99
|
});
|
|
99
100
|
} catch (e) {
|
|
100
|
-
if (callback) {
|
|
101
|
+
if (callback) {
|
|
102
|
+
callback(result);
|
|
103
|
+
}
|
|
101
104
|
resolve(result);
|
|
102
105
|
}
|
|
103
106
|
});
|
package/lib/wifi.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// ----------------------------------------------------------------------------------
|
|
6
6
|
// Description: System Information - library
|
|
7
7
|
// for Node.js
|
|
8
|
-
// Copyright: (c) 2014 -
|
|
8
|
+
// Copyright: (c) 2014 - 2026
|
|
9
9
|
// Author: Sebastian Hildebrandt
|
|
10
10
|
// ----------------------------------------------------------------------------------
|
|
11
11
|
// License: MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.29.0",
|
|
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)",
|