systeminformation 5.30.2 → 5.30.4
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 +0 -22
- package/lib/audio.js +5 -5
- package/lib/bluetooth.js +2 -2
- package/lib/docker.js +17 -17
- package/lib/dockerSocket.js +24 -24
- package/lib/filesystem.js +0 -2
- package/lib/internet.js +9 -9
- package/lib/memory.js +23 -23
- package/lib/network.js +17 -17
- package/lib/printer.js +4 -4
- package/lib/users.js +1 -1
- package/lib/util.js +4 -40
- package/lib/virtualbox.js +4 -4
- package/lib/wifi.js +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,28 +30,6 @@
|
|
|
30
30
|
|
|
31
31
|
## The Systeminformation Project
|
|
32
32
|
|
|
33
|
-
### Merry Christmas and Happy new year
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
.''.
|
|
37
|
-
.''. . *''* :_\/_:
|
|
38
|
-
:_\/_: _\(/_ .:.*_\/_* : /\ :
|
|
39
|
-
.''.: /\ : ./)\ ':'* /\ * : '..'.
|
|
40
|
-
:_\/_:'.:::. ' *''* * '.\'/.' _\(/_
|
|
41
|
-
: /\ : ::::: *_\/_* -= o =- /)\
|
|
42
|
-
'..' ':::' * /\ * .'/.\'. '
|
|
43
|
-
*..* :
|
|
44
|
-
*
|
|
45
|
-
* /.\ * * . *
|
|
46
|
-
. /..'\ . . * .
|
|
47
|
-
*/'.'\* . . . * *
|
|
48
|
-
* /.''.'\ * . . . *
|
|
49
|
-
. */.'.'.\*
|
|
50
|
-
.........".""""/'.''.'.\""."."........".".".......................
|
|
51
|
-
^^^[_]^^^*
|
|
52
|
-
```
|
|
53
|
-
I wish you all a Merry Christmas and a peaceful New Year 2026.
|
|
54
|
-
|
|
55
33
|
This is amazing. Started as a small project just for myself, it now has > 19,000
|
|
56
34
|
lines of code, > 700 versions published, up to 15 mio downloads per month, > 450
|
|
57
35
|
mio downloads overall. Top 10 NPM ranking for backend packages. Thank you to all
|
package/lib/audio.js
CHANGED
|
@@ -17,7 +17,7 @@ const exec = require('child_process').exec;
|
|
|
17
17
|
const execSync = require('child_process').execSync;
|
|
18
18
|
const util = require('./util');
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const _platform = process.platform;
|
|
21
21
|
|
|
22
22
|
const _linux = _platform === 'linux' || _platform === 'android';
|
|
23
23
|
const _darwin = _platform === 'darwin';
|
|
@@ -83,8 +83,8 @@ function parseAudioType(str, input, output) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function getLinuxAudioPci() {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const cmd = 'lspci -v 2>/dev/null';
|
|
87
|
+
const result = [];
|
|
88
88
|
try {
|
|
89
89
|
const parts = execSync(cmd, util.execOptsLinux).toString().split('\n\n');
|
|
90
90
|
parts.forEach((element) => {
|
|
@@ -97,7 +97,7 @@ function getLinuxAudioPci() {
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
return result;
|
|
100
|
-
} catch
|
|
100
|
+
} catch {
|
|
101
101
|
return result;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -239,7 +239,7 @@ function audio(callback) {
|
|
|
239
239
|
result.push(audio);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
} catch
|
|
242
|
+
} catch {
|
|
243
243
|
util.noop();
|
|
244
244
|
}
|
|
245
245
|
}
|
package/lib/bluetooth.js
CHANGED
|
@@ -20,7 +20,7 @@ const util = require('./util');
|
|
|
20
20
|
const bluetoothVendors = require('./bluetoothVendors');
|
|
21
21
|
const fs = require('fs');
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const _platform = process.platform;
|
|
24
24
|
|
|
25
25
|
const _linux = _platform === 'linux' || _platform === 'android';
|
|
26
26
|
const _darwin = _platform === 'darwin';
|
|
@@ -187,7 +187,7 @@ function bluetoothDevices(callback) {
|
|
|
187
187
|
result[i].connected = true;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
} catch
|
|
190
|
+
} catch {
|
|
191
191
|
util.noop();
|
|
192
192
|
}
|
|
193
193
|
|
package/lib/docker.js
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
const util = require('./util');
|
|
17
17
|
const DockerSocket = require('./dockerSocket');
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const _platform = process.platform;
|
|
20
20
|
const _windows = _platform === 'win32';
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const _docker_container_stats = {};
|
|
23
23
|
let _docker_socket;
|
|
24
24
|
let _docker_last_read = 0;
|
|
25
25
|
|
|
@@ -119,7 +119,7 @@ function dockerImages(all, callback) {
|
|
|
119
119
|
try {
|
|
120
120
|
dockerImages = data;
|
|
121
121
|
if (dockerImages && Object.prototype.toString.call(dockerImages) === '[object Array]' && dockerImages.length > 0) {
|
|
122
|
-
dockerImages.forEach(
|
|
122
|
+
dockerImages.forEach((element) => {
|
|
123
123
|
if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
|
|
124
124
|
element.Name = element.Names[0].replace(/^\/|\/$/g, '');
|
|
125
125
|
}
|
|
@@ -144,7 +144,7 @@ function dockerImages(all, callback) {
|
|
|
144
144
|
}
|
|
145
145
|
resolve(result);
|
|
146
146
|
}
|
|
147
|
-
} catch
|
|
147
|
+
} catch {
|
|
148
148
|
if (callback) {
|
|
149
149
|
callback(result);
|
|
150
150
|
}
|
|
@@ -193,7 +193,7 @@ function dockerImagesInspect(imageID, payload) {
|
|
|
193
193
|
config: data.Config ? data.Config : {},
|
|
194
194
|
rootFS: data.RootFS ? data.RootFS : {}
|
|
195
195
|
});
|
|
196
|
-
} catch
|
|
196
|
+
} catch {
|
|
197
197
|
resolve();
|
|
198
198
|
}
|
|
199
199
|
});
|
|
@@ -208,7 +208,7 @@ exports.dockerImages = dockerImages;
|
|
|
208
208
|
|
|
209
209
|
function dockerContainers(all, callback) {
|
|
210
210
|
function inContainers(containers, id) {
|
|
211
|
-
|
|
211
|
+
const filtered = containers.filter((obj) => {
|
|
212
212
|
/**
|
|
213
213
|
* @namespace
|
|
214
214
|
* @property {string} Id
|
|
@@ -253,7 +253,7 @@ function dockerContainers(all, callback) {
|
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
docker_containers.forEach(
|
|
256
|
+
docker_containers.forEach((element) => {
|
|
257
257
|
if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
|
|
258
258
|
element.Name = element.Names[0].replace(/^\/|\/$/g, '');
|
|
259
259
|
}
|
|
@@ -336,7 +336,7 @@ function dockerContainerInspect(containerID, payload) {
|
|
|
336
336
|
// hostconfig: payload.HostConfig,
|
|
337
337
|
// network: payload.NetworkSettings
|
|
338
338
|
});
|
|
339
|
-
} catch
|
|
339
|
+
} catch {
|
|
340
340
|
resolve();
|
|
341
341
|
}
|
|
342
342
|
});
|
|
@@ -408,7 +408,7 @@ function docker_calcNetworkIO(networks) {
|
|
|
408
408
|
* @property {number} rx_bytes
|
|
409
409
|
* @property {number} tx_bytes
|
|
410
410
|
*/
|
|
411
|
-
|
|
411
|
+
const obj = networks[key];
|
|
412
412
|
rx = +obj.rx_bytes;
|
|
413
413
|
wx = +obj.tx_bytes;
|
|
414
414
|
}
|
|
@@ -434,7 +434,7 @@ function docker_calcBlockIO(blkio_stats) {
|
|
|
434
434
|
Object.prototype.toString.call(blkio_stats.io_service_bytes_recursive) === '[object Array]' &&
|
|
435
435
|
blkio_stats.io_service_bytes_recursive.length > 0
|
|
436
436
|
) {
|
|
437
|
-
blkio_stats.io_service_bytes_recursive.forEach(
|
|
437
|
+
blkio_stats.io_service_bytes_recursive.forEach((element) => {
|
|
438
438
|
/**
|
|
439
439
|
* @namespace
|
|
440
440
|
* @property {string} op
|
|
@@ -552,7 +552,7 @@ function dockerContainerStats(containerIDs, callback) {
|
|
|
552
552
|
|
|
553
553
|
function dockerContainerStatsSingle(containerID) {
|
|
554
554
|
containerID = containerID || '';
|
|
555
|
-
|
|
555
|
+
const result = {
|
|
556
556
|
id: containerID,
|
|
557
557
|
memUsage: 0,
|
|
558
558
|
memLimit: 0,
|
|
@@ -606,13 +606,13 @@ function dockerContainerStatsSingle(containerID) {
|
|
|
606
606
|
result.memoryStats = stats.memory_stats ? stats.memory_stats : {};
|
|
607
607
|
result.networks = stats.networks ? stats.networks : {};
|
|
608
608
|
}
|
|
609
|
-
} catch
|
|
609
|
+
} catch {
|
|
610
610
|
util.noop();
|
|
611
611
|
}
|
|
612
612
|
// }
|
|
613
613
|
resolve(result);
|
|
614
614
|
});
|
|
615
|
-
} catch
|
|
615
|
+
} catch {
|
|
616
616
|
util.noop();
|
|
617
617
|
}
|
|
618
618
|
});
|
|
@@ -688,7 +688,7 @@ function dockerContainerProcesses(containerID, callback) {
|
|
|
688
688
|
});
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
|
-
} catch
|
|
691
|
+
} catch {
|
|
692
692
|
util.noop();
|
|
693
693
|
}
|
|
694
694
|
if (callback) {
|
|
@@ -720,7 +720,7 @@ function dockerVolumes(callback) {
|
|
|
720
720
|
try {
|
|
721
721
|
dockerVolumes = data;
|
|
722
722
|
if (dockerVolumes && dockerVolumes.Volumes && Object.prototype.toString.call(dockerVolumes.Volumes) === '[object Array]' && dockerVolumes.Volumes.length > 0) {
|
|
723
|
-
dockerVolumes.Volumes.forEach(
|
|
723
|
+
dockerVolumes.Volumes.forEach((element) => {
|
|
724
724
|
result.push({
|
|
725
725
|
name: element.Name,
|
|
726
726
|
driver: element.Driver,
|
|
@@ -741,7 +741,7 @@ function dockerVolumes(callback) {
|
|
|
741
741
|
}
|
|
742
742
|
resolve(result);
|
|
743
743
|
}
|
|
744
|
-
} catch
|
|
744
|
+
} catch {
|
|
745
745
|
if (callback) {
|
|
746
746
|
callback(result);
|
|
747
747
|
}
|
|
@@ -760,7 +760,7 @@ function dockerAll(callback) {
|
|
|
760
760
|
dockerContainers(true).then((result) => {
|
|
761
761
|
if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) {
|
|
762
762
|
let l = result.length;
|
|
763
|
-
result.forEach(
|
|
763
|
+
result.forEach((element) => {
|
|
764
764
|
dockerContainerStats(element.id).then((res) => {
|
|
765
765
|
// include stats in array
|
|
766
766
|
element.memUsage = res[0].memUsage;
|
package/lib/dockerSocket.js
CHANGED
|
@@ -38,17 +38,17 @@ class DockerSocket {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
socket.on('end', () => {
|
|
41
|
-
|
|
41
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
42
42
|
alldata = alldata.substring(startbody + 4);
|
|
43
43
|
socket = false;
|
|
44
44
|
try {
|
|
45
45
|
data = JSON.parse(alldata);
|
|
46
46
|
callback(data);
|
|
47
|
-
} catch
|
|
47
|
+
} catch {
|
|
48
48
|
callback({});
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
} catch
|
|
51
|
+
} catch {
|
|
52
52
|
callback({});
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -73,17 +73,17 @@ class DockerSocket {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
socket.on('end', () => {
|
|
76
|
-
|
|
76
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
77
77
|
alldata = alldata.substring(startbody + 4);
|
|
78
78
|
socket = false;
|
|
79
79
|
try {
|
|
80
80
|
data = JSON.parse(alldata);
|
|
81
81
|
callback(data);
|
|
82
|
-
} catch
|
|
82
|
+
} catch {
|
|
83
83
|
callback({});
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
} catch
|
|
86
|
+
} catch {
|
|
87
87
|
callback({});
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -110,17 +110,17 @@ class DockerSocket {
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
socket.on('end', () => {
|
|
113
|
-
|
|
113
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
114
114
|
alldata = alldata.substring(startbody + 4);
|
|
115
115
|
socket = false;
|
|
116
116
|
try {
|
|
117
117
|
data = JSON.parse(alldata);
|
|
118
118
|
callback(data);
|
|
119
|
-
} catch
|
|
119
|
+
} catch {
|
|
120
120
|
callback({});
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
|
-
} catch
|
|
123
|
+
} catch {
|
|
124
124
|
callback({});
|
|
125
125
|
}
|
|
126
126
|
} else {
|
|
@@ -148,17 +148,17 @@ class DockerSocket {
|
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
socket.on('end', () => {
|
|
151
|
-
|
|
151
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
152
152
|
alldata = alldata.substring(startbody + 4);
|
|
153
153
|
socket = false;
|
|
154
154
|
try {
|
|
155
155
|
data = JSON.parse(alldata);
|
|
156
156
|
callback(data);
|
|
157
|
-
} catch
|
|
157
|
+
} catch {
|
|
158
158
|
callback({});
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
-
} catch
|
|
161
|
+
} catch {
|
|
162
162
|
callback({});
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -185,17 +185,17 @@ class DockerSocket {
|
|
|
185
185
|
});
|
|
186
186
|
|
|
187
187
|
socket.on('end', () => {
|
|
188
|
-
|
|
188
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
189
189
|
alldata = alldata.substring(startbody + 4);
|
|
190
190
|
socket = false;
|
|
191
191
|
try {
|
|
192
192
|
data = JSON.parse(alldata);
|
|
193
193
|
callback(data);
|
|
194
|
-
} catch
|
|
194
|
+
} catch {
|
|
195
195
|
callback({});
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
|
-
} catch
|
|
198
|
+
} catch {
|
|
199
199
|
callback({});
|
|
200
200
|
}
|
|
201
201
|
} else {
|
|
@@ -225,17 +225,17 @@ class DockerSocket {
|
|
|
225
225
|
});
|
|
226
226
|
|
|
227
227
|
socket.on('end', () => {
|
|
228
|
-
|
|
228
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
229
229
|
alldata = alldata.substring(startbody + 4);
|
|
230
230
|
socket = false;
|
|
231
231
|
try {
|
|
232
232
|
data = JSON.parse(alldata);
|
|
233
233
|
callback(data);
|
|
234
|
-
} catch
|
|
234
|
+
} catch {
|
|
235
235
|
callback({});
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
|
-
} catch
|
|
238
|
+
} catch {
|
|
239
239
|
callback({});
|
|
240
240
|
}
|
|
241
241
|
} else {
|
|
@@ -265,17 +265,17 @@ class DockerSocket {
|
|
|
265
265
|
});
|
|
266
266
|
|
|
267
267
|
socket.on('end', () => {
|
|
268
|
-
|
|
268
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
269
269
|
alldata = alldata.substring(startbody + 4);
|
|
270
270
|
socket = false;
|
|
271
271
|
try {
|
|
272
272
|
data = JSON.parse(alldata);
|
|
273
273
|
callback(data);
|
|
274
|
-
} catch
|
|
274
|
+
} catch {
|
|
275
275
|
callback({});
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
|
-
} catch
|
|
278
|
+
} catch {
|
|
279
279
|
callback({});
|
|
280
280
|
}
|
|
281
281
|
} else {
|
|
@@ -303,17 +303,17 @@ class DockerSocket {
|
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
socket.on('end', () => {
|
|
306
|
-
|
|
306
|
+
const startbody = alldata.indexOf('\r\n\r\n');
|
|
307
307
|
alldata = alldata.substring(startbody + 4);
|
|
308
308
|
socket = false;
|
|
309
309
|
try {
|
|
310
310
|
data = JSON.parse(alldata);
|
|
311
311
|
callback(data);
|
|
312
|
-
} catch
|
|
312
|
+
} catch {
|
|
313
313
|
callback({});
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
|
-
} catch
|
|
316
|
+
} catch {
|
|
317
317
|
callback({});
|
|
318
318
|
}
|
|
319
319
|
}
|
package/lib/filesystem.js
CHANGED
|
@@ -701,8 +701,6 @@ function blockDevices(callback) {
|
|
|
701
701
|
if (_windows) {
|
|
702
702
|
const drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM'];
|
|
703
703
|
try {
|
|
704
|
-
// util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => {
|
|
705
|
-
// util.powerShell('Get-CimInstance Win32_logicaldisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => {
|
|
706
704
|
const workload = [];
|
|
707
705
|
workload.push(util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl'));
|
|
708
706
|
workload.push(
|
package/lib/internet.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
const util = require('./util');
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const _platform = process.platform;
|
|
19
19
|
|
|
20
20
|
const _linux = _platform === 'linux' || _platform === 'android';
|
|
21
21
|
const _darwin = _platform === 'darwin';
|
|
@@ -50,7 +50,7 @@ function inetChecksite(url, callback) {
|
|
|
50
50
|
if (s[i] !== undefined) {
|
|
51
51
|
try {
|
|
52
52
|
s[i].__proto__.toLowerCase = util.stringToLower;
|
|
53
|
-
} catch
|
|
53
|
+
} catch {
|
|
54
54
|
Object.setPrototypeOf(s[i], util.stringObj);
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -65,7 +65,7 @@ function inetChecksite(url, callback) {
|
|
|
65
65
|
if (urlSanitized && !util.isPrototypePolluted()) {
|
|
66
66
|
try {
|
|
67
67
|
urlSanitized.__proto__.startsWith = util.stringStartWith;
|
|
68
|
-
} catch
|
|
68
|
+
} catch {
|
|
69
69
|
Object.setPrototypeOf(urlSanitized, util.stringObj);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -98,7 +98,7 @@ function inetChecksite(url, callback) {
|
|
|
98
98
|
}
|
|
99
99
|
resolve(result);
|
|
100
100
|
}
|
|
101
|
-
} catch
|
|
101
|
+
} catch {
|
|
102
102
|
if (callback) {
|
|
103
103
|
callback(result);
|
|
104
104
|
}
|
|
@@ -137,7 +137,7 @@ function inetLatency(host, callback) {
|
|
|
137
137
|
if (!(s[i] === undefined)) {
|
|
138
138
|
try {
|
|
139
139
|
s[i].__proto__.toLowerCase = util.stringToLower;
|
|
140
|
-
} catch
|
|
140
|
+
} catch {
|
|
141
141
|
Object.setPrototypeOf(s[i], util.stringObj);
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -149,7 +149,7 @@ function inetLatency(host, callback) {
|
|
|
149
149
|
}
|
|
150
150
|
try {
|
|
151
151
|
hostSanitized.__proto__.startsWith = util.stringStartWith;
|
|
152
|
-
} catch
|
|
152
|
+
} catch {
|
|
153
153
|
Object.setPrototypeOf(hostSanitized, util.stringObj);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -229,9 +229,9 @@ function inetLatency(host, callback) {
|
|
|
229
229
|
const params = [hostSanitized, '-n', '1'];
|
|
230
230
|
util.execSafe('ping', params, util.execOptsWin).then((stdout) => {
|
|
231
231
|
if (stdout) {
|
|
232
|
-
|
|
232
|
+
const lines = stdout.split('\r\n');
|
|
233
233
|
lines.shift();
|
|
234
|
-
lines.forEach(
|
|
234
|
+
lines.forEach((line) => {
|
|
235
235
|
if ((line.toLowerCase().match(/ms/g) || []).length === 3) {
|
|
236
236
|
let l = line.replace(/ +/g, ' ').split(' ');
|
|
237
237
|
if (l.length > 6) {
|
|
@@ -245,7 +245,7 @@ function inetLatency(host, callback) {
|
|
|
245
245
|
}
|
|
246
246
|
resolve(result);
|
|
247
247
|
});
|
|
248
|
-
} catch
|
|
248
|
+
} catch {
|
|
249
249
|
if (callback) {
|
|
250
250
|
callback(result);
|
|
251
251
|
}
|
package/lib/memory.js
CHANGED
|
@@ -161,7 +161,7 @@ function mem(callback) {
|
|
|
161
161
|
|
|
162
162
|
if (_linux) {
|
|
163
163
|
try {
|
|
164
|
-
fs.readFile('/proc/meminfo',
|
|
164
|
+
fs.readFile('/proc/meminfo', (error, stdout) => {
|
|
165
165
|
if (!error) {
|
|
166
166
|
const lines = stdout.toString().split('\n');
|
|
167
167
|
result.total = parseInt(util.getValue(lines, 'memtotal'), 10);
|
|
@@ -199,7 +199,7 @@ function mem(callback) {
|
|
|
199
199
|
}
|
|
200
200
|
resolve(result);
|
|
201
201
|
});
|
|
202
|
-
} catch
|
|
202
|
+
} catch {
|
|
203
203
|
if (callback) {
|
|
204
204
|
callback(result);
|
|
205
205
|
}
|
|
@@ -210,9 +210,9 @@ function mem(callback) {
|
|
|
210
210
|
try {
|
|
211
211
|
exec(
|
|
212
212
|
'/sbin/sysctl 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',
|
|
213
|
-
|
|
213
|
+
(error, stdout) => {
|
|
214
214
|
if (!error) {
|
|
215
|
-
|
|
215
|
+
const lines = stdout.toString().split('\n');
|
|
216
216
|
const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
|
|
217
217
|
const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
|
|
218
218
|
const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
|
|
@@ -236,7 +236,7 @@ function mem(callback) {
|
|
|
236
236
|
resolve(result);
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
|
-
} catch
|
|
239
|
+
} catch {
|
|
240
240
|
if (callback) {
|
|
241
241
|
callback(result);
|
|
242
242
|
}
|
|
@@ -254,11 +254,11 @@ function mem(callback) {
|
|
|
254
254
|
try {
|
|
255
255
|
let sysPpageSize = util.toInt(execSync('sysctl -n vm.pagesize').toString());
|
|
256
256
|
pageSize = sysPpageSize || pageSize;
|
|
257
|
-
} catch
|
|
257
|
+
} catch {
|
|
258
258
|
util.noop();
|
|
259
259
|
}
|
|
260
260
|
try {
|
|
261
|
-
exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive"',
|
|
261
|
+
exec('vm_stat 2>/dev/null | egrep "Pages active|Pages inactive"', (error, stdout) => {
|
|
262
262
|
if (!error) {
|
|
263
263
|
let lines = stdout.toString().split('\n');
|
|
264
264
|
result.active = (parseInt(util.getValue(lines, 'Pages active'), 10) || 0) * pageSize;
|
|
@@ -266,7 +266,7 @@ function mem(callback) {
|
|
|
266
266
|
result.buffcache = result.used - result.active;
|
|
267
267
|
result.available = result.free + result.buffcache;
|
|
268
268
|
}
|
|
269
|
-
exec('sysctl -n vm.swapusage 2>/dev/null',
|
|
269
|
+
exec('sysctl -n vm.swapusage 2>/dev/null', (error, stdout) => {
|
|
270
270
|
if (!error) {
|
|
271
271
|
let lines = stdout.toString().split('\n');
|
|
272
272
|
if (lines.length > 0) {
|
|
@@ -291,7 +291,7 @@ function mem(callback) {
|
|
|
291
291
|
resolve(result);
|
|
292
292
|
});
|
|
293
293
|
});
|
|
294
|
-
} catch
|
|
294
|
+
} catch {
|
|
295
295
|
if (callback) {
|
|
296
296
|
callback(result);
|
|
297
297
|
}
|
|
@@ -308,7 +308,7 @@ function mem(callback) {
|
|
|
308
308
|
.split('\r\n')
|
|
309
309
|
.filter((line) => line.trim() !== '')
|
|
310
310
|
.filter((line, idx) => idx > 0);
|
|
311
|
-
lines.forEach(
|
|
311
|
+
lines.forEach((line) => {
|
|
312
312
|
if (line !== '') {
|
|
313
313
|
line = line.trim().split(/\s\s+/);
|
|
314
314
|
swaptotal = swaptotal + (parseInt(line[0], 10) || 0);
|
|
@@ -325,7 +325,7 @@ function mem(callback) {
|
|
|
325
325
|
}
|
|
326
326
|
resolve(result);
|
|
327
327
|
});
|
|
328
|
-
} catch
|
|
328
|
+
} catch {
|
|
329
329
|
if (callback) {
|
|
330
330
|
callback(result);
|
|
331
331
|
}
|
|
@@ -354,12 +354,12 @@ function memLayout(callback) {
|
|
|
354
354
|
if (_linux || _freebsd || _openbsd || _netbsd) {
|
|
355
355
|
exec(
|
|
356
356
|
'export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL',
|
|
357
|
-
|
|
357
|
+
(error, stdout) => {
|
|
358
358
|
if (!error) {
|
|
359
|
-
|
|
359
|
+
const devices = stdout.toString().split('Memory Device');
|
|
360
360
|
devices.shift();
|
|
361
|
-
devices.forEach(
|
|
362
|
-
|
|
361
|
+
devices.forEach((device) => {
|
|
362
|
+
const lines = device.split('\n');
|
|
363
363
|
const sizeString = util.getValue(lines, 'Size');
|
|
364
364
|
const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
|
|
365
365
|
let bank = util.getValue(lines, 'Bank Locator');
|
|
@@ -457,7 +457,7 @@ function memLayout(callback) {
|
|
|
457
457
|
result[0].voltageMax = voltage;
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
} catch
|
|
460
|
+
} catch {
|
|
461
461
|
util.noop();
|
|
462
462
|
}
|
|
463
463
|
}
|
|
@@ -470,7 +470,7 @@ function memLayout(callback) {
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
if (_darwin) {
|
|
473
|
-
exec('system_profiler SPMemoryDataType',
|
|
473
|
+
exec('system_profiler SPMemoryDataType', (error, stdout) => {
|
|
474
474
|
if (!error) {
|
|
475
475
|
const allLines = stdout.toString().split('\n');
|
|
476
476
|
const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase();
|
|
@@ -481,8 +481,8 @@ function memLayout(callback) {
|
|
|
481
481
|
hasBank = false;
|
|
482
482
|
}
|
|
483
483
|
devices.shift();
|
|
484
|
-
devices.forEach(
|
|
485
|
-
|
|
484
|
+
devices.forEach((device) => {
|
|
485
|
+
const lines = device.split('\n');
|
|
486
486
|
const bank = (hasBank ? 'BANK ' : 'DIMM') + lines[0].trim().split('/')[0];
|
|
487
487
|
const size = parseInt(util.getValue(lines, ' Size'));
|
|
488
488
|
if (size) {
|
|
@@ -567,10 +567,10 @@ function memLayout(callback) {
|
|
|
567
567
|
)
|
|
568
568
|
.then((stdout, error) => {
|
|
569
569
|
if (!error) {
|
|
570
|
-
|
|
570
|
+
const devices = stdout.toString().split(/\n\s*\n/);
|
|
571
571
|
devices.shift();
|
|
572
|
-
devices.forEach(
|
|
573
|
-
|
|
572
|
+
devices.forEach((device) => {
|
|
573
|
+
const lines = device.split('\r\n');
|
|
574
574
|
const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
|
|
575
575
|
const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
|
|
576
576
|
const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
|
|
@@ -599,7 +599,7 @@ function memLayout(callback) {
|
|
|
599
599
|
}
|
|
600
600
|
resolve(result);
|
|
601
601
|
});
|
|
602
|
-
} catch
|
|
602
|
+
} catch {
|
|
603
603
|
if (callback) {
|
|
604
604
|
callback(result);
|
|
605
605
|
}
|
package/lib/network.js
CHANGED
|
@@ -119,7 +119,7 @@ function getDefaultNetworkInterface() {
|
|
|
119
119
|
ifacename = ifacename.split(':')[1].trim();
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
} catch
|
|
122
|
+
} catch {
|
|
123
123
|
util.noop();
|
|
124
124
|
}
|
|
125
125
|
if (ifacename) {
|
|
@@ -143,7 +143,7 @@ function getMacAddresses() {
|
|
|
143
143
|
} else {
|
|
144
144
|
pathToIp = '';
|
|
145
145
|
}
|
|
146
|
-
} catch
|
|
146
|
+
} catch {
|
|
147
147
|
pathToIp = '';
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -172,14 +172,14 @@ function getMacAddresses() {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
} catch
|
|
175
|
+
} catch {
|
|
176
176
|
util.noop();
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
if (_darwin) {
|
|
180
180
|
try {
|
|
181
181
|
const cmd = '/sbin/ifconfig';
|
|
182
|
-
|
|
182
|
+
const res = execSync(cmd);
|
|
183
183
|
const lines = res.toString().split('\n');
|
|
184
184
|
for (let i = 0; i < lines.length; i++) {
|
|
185
185
|
if (lines[i] && lines[i][0] !== '\t' && lines[i].indexOf(':') > 0) {
|
|
@@ -193,7 +193,7 @@ function getMacAddresses() {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
} catch
|
|
196
|
+
} catch {
|
|
197
197
|
util.noop();
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -223,11 +223,11 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
|
|
223
223
|
try {
|
|
224
224
|
if ({}.hasOwnProperty.call(sections, i)) {
|
|
225
225
|
if (sections[i].trim() !== '') {
|
|
226
|
-
|
|
226
|
+
const lines = sections[i].trim().split('\r\n');
|
|
227
227
|
let linesNicConfig = null;
|
|
228
228
|
try {
|
|
229
229
|
linesNicConfig = nconfigsections && nconfigsections[i] ? nconfigsections[i].trim().split('\r\n') : [];
|
|
230
|
-
} catch
|
|
230
|
+
} catch {
|
|
231
231
|
util.noop();
|
|
232
232
|
}
|
|
233
233
|
const netEnabled = util.getValue(lines, 'NetEnabled', ':');
|
|
@@ -252,7 +252,7 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
} catch
|
|
255
|
+
} catch {
|
|
256
256
|
util.noop();
|
|
257
257
|
}
|
|
258
258
|
}
|
|
@@ -271,7 +271,7 @@ function getWindowsNics() {
|
|
|
271
271
|
const nconfigsections = (data[1] || '').split(/\n\s*\n/);
|
|
272
272
|
resolve(parseLinesWindowsNics(nsections, nconfigsections));
|
|
273
273
|
});
|
|
274
|
-
} catch
|
|
274
|
+
} catch {
|
|
275
275
|
resolve([]);
|
|
276
276
|
}
|
|
277
277
|
});
|
|
@@ -319,7 +319,7 @@ function getWindowsDNSsuffixes() {
|
|
|
319
319
|
});
|
|
320
320
|
|
|
321
321
|
return dnsSuffixes;
|
|
322
|
-
} catch
|
|
322
|
+
} catch {
|
|
323
323
|
return {
|
|
324
324
|
primaryDNS: '',
|
|
325
325
|
exitCode: 0,
|
|
@@ -345,7 +345,7 @@ function getWindowsIfaceDNSsuffix(ifaces, ifacename) {
|
|
|
345
345
|
dnsSuffix = '';
|
|
346
346
|
}
|
|
347
347
|
return dnsSuffix;
|
|
348
|
-
} catch
|
|
348
|
+
} catch {
|
|
349
349
|
return 'Unknown';
|
|
350
350
|
}
|
|
351
351
|
}
|
|
@@ -369,7 +369,7 @@ function getWindowsWirelessIfaceSSID(interfaceName) {
|
|
|
369
369
|
const SSID = result.split('\r\n').shift();
|
|
370
370
|
const parseSSID = SSID.split(':').pop().trim();
|
|
371
371
|
return parseSSID;
|
|
372
|
-
} catch
|
|
372
|
+
} catch {
|
|
373
373
|
return 'Unknown';
|
|
374
374
|
}
|
|
375
375
|
}
|
|
@@ -406,7 +406,7 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
|
|
406
406
|
i8021x.protocol = protocol8021x.split(':').pop();
|
|
407
407
|
i8021x.state = 'Enabled';
|
|
408
408
|
}
|
|
409
|
-
} catch
|
|
409
|
+
} catch {
|
|
410
410
|
return i8021x;
|
|
411
411
|
}
|
|
412
412
|
} else if (connectionType === 'wireless') {
|
|
@@ -434,7 +434,7 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
|
|
434
434
|
i8021x.state = i8021xState.split(':').pop();
|
|
435
435
|
i8021x.protocol = i8021xProtocol.split(':').pop();
|
|
436
436
|
}
|
|
437
|
-
} catch
|
|
437
|
+
} catch {
|
|
438
438
|
if (error.status === 1 && error.stdout.includes('AutoConfig')) {
|
|
439
439
|
i8021x.state = 'Disabled';
|
|
440
440
|
i8021x.protocol = 'Not defined';
|
|
@@ -465,9 +465,9 @@ function splitSectionsNics(lines) {
|
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
function parseLinesDarwinNics(sections) {
|
|
468
|
-
|
|
468
|
+
const nics = [];
|
|
469
469
|
sections.forEach((section) => {
|
|
470
|
-
|
|
470
|
+
const nic = {
|
|
471
471
|
iface: '',
|
|
472
472
|
mtu: null,
|
|
473
473
|
mac: '',
|
|
@@ -1477,7 +1477,7 @@ function networkStatsSingle(iface) {
|
|
|
1477
1477
|
result.operstate = (result.operstate || '').toLowerCase();
|
|
1478
1478
|
result.operstate = result.operstate === 'active' ? 'up' : result.operstate === 'inactive' ? 'down' : 'unknown';
|
|
1479
1479
|
cmd = 'netstat -bdI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input]
|
|
1480
|
-
exec(cmd,
|
|
1480
|
+
exec(cmd, (error, stdout) => {
|
|
1481
1481
|
if (!error) {
|
|
1482
1482
|
lines = stdout.toString().split('\n');
|
|
1483
1483
|
// if there is less than 2 lines, no information for this interface was found
|
package/lib/printer.js
CHANGED
|
@@ -117,7 +117,7 @@ function printer(callback) {
|
|
|
117
117
|
let result = [];
|
|
118
118
|
if (_linux || _freebsd || _openbsd || _netbsd) {
|
|
119
119
|
let cmd = 'cat /etc/cups/printers.conf 2>/dev/null';
|
|
120
|
-
exec(cmd,
|
|
120
|
+
exec(cmd, (error, stdout) => {
|
|
121
121
|
// printers.conf
|
|
122
122
|
if (!error) {
|
|
123
123
|
const parts = stdout.toString().split('<Printer ');
|
|
@@ -135,7 +135,7 @@ function printer(callback) {
|
|
|
135
135
|
if (_linux) {
|
|
136
136
|
cmd = 'export LC_ALL=C; lpstat -lp 2>/dev/null; unset LC_ALL';
|
|
137
137
|
// lpstat
|
|
138
|
-
exec(cmd,
|
|
138
|
+
exec(cmd, (error, stdout) => {
|
|
139
139
|
const parts = ('\n' + stdout.toString()).split('\nprinter ');
|
|
140
140
|
for (let i = 1; i < parts.length; i++) {
|
|
141
141
|
const printers = parseLinuxLpstatPrinter(parts[i].split('\n'), i);
|
|
@@ -162,7 +162,7 @@ function printer(callback) {
|
|
|
162
162
|
}
|
|
163
163
|
if (_darwin) {
|
|
164
164
|
let cmd = 'system_profiler SPPrintersDataType -json';
|
|
165
|
-
exec(cmd,
|
|
165
|
+
exec(cmd, (error, stdout) => {
|
|
166
166
|
if (!error) {
|
|
167
167
|
try {
|
|
168
168
|
const outObj = JSON.parse(stdout.toString());
|
|
@@ -172,7 +172,7 @@ function printer(callback) {
|
|
|
172
172
|
result.push(printer);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
} catch
|
|
175
|
+
} catch {
|
|
176
176
|
util.noop();
|
|
177
177
|
}
|
|
178
178
|
}
|
package/lib/users.js
CHANGED
package/lib/util.js
CHANGED
|
@@ -21,7 +21,7 @@ const exec = require('child_process').exec;
|
|
|
21
21
|
const execSync = require('child_process').execSync;
|
|
22
22
|
const util = require('util');
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const _platform = process.platform;
|
|
25
25
|
const _linux = _platform === 'linux' || _platform === 'android';
|
|
26
26
|
const _darwin = _platform === 'darwin';
|
|
27
27
|
const _windows = _platform === 'win32';
|
|
@@ -30,7 +30,6 @@ const _openbsd = _platform === 'openbsd';
|
|
|
30
30
|
const _netbsd = _platform === 'netbsd';
|
|
31
31
|
|
|
32
32
|
let _cores = 0;
|
|
33
|
-
let wmicPath = '';
|
|
34
33
|
let codepage = '';
|
|
35
34
|
let _smartMonToolsInstalled = null;
|
|
36
35
|
let _rpi_cpuinfo = null;
|
|
@@ -40,7 +39,7 @@ const WINDIR = process.env.WINDIR || 'C:\\Windows';
|
|
|
40
39
|
// powerShell
|
|
41
40
|
let _psChild;
|
|
42
41
|
let _psResult = '';
|
|
43
|
-
|
|
42
|
+
const _psCmds = [];
|
|
44
43
|
let _psPersistent = false;
|
|
45
44
|
let _powerShell = '';
|
|
46
45
|
const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ';
|
|
@@ -364,39 +363,6 @@ function getPowershell() {
|
|
|
364
363
|
}
|
|
365
364
|
}
|
|
366
365
|
|
|
367
|
-
function getWmic() {
|
|
368
|
-
if (os.type() === 'Windows_NT' && !wmicPath) {
|
|
369
|
-
wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe';
|
|
370
|
-
if (!fs.existsSync(wmicPath)) {
|
|
371
|
-
try {
|
|
372
|
-
const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n');
|
|
373
|
-
if (wmicPathArray && wmicPathArray.length) {
|
|
374
|
-
wmicPath = wmicPathArray[0];
|
|
375
|
-
} else {
|
|
376
|
-
wmicPath = 'wmic';
|
|
377
|
-
}
|
|
378
|
-
} catch {
|
|
379
|
-
wmicPath = 'wmic';
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return wmicPath;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function wmic(command) {
|
|
387
|
-
return new Promise((resolve) => {
|
|
388
|
-
process.nextTick(() => {
|
|
389
|
-
try {
|
|
390
|
-
powerShell(getWmic() + ' ' + command).then((stdout) => {
|
|
391
|
-
resolve(stdout, '');
|
|
392
|
-
});
|
|
393
|
-
} catch (e) {
|
|
394
|
-
resolve('', e);
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
|
|
400
366
|
function getVboxmanage() {
|
|
401
367
|
return _windows ? `"${process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"` : 'vboxmanage';
|
|
402
368
|
}
|
|
@@ -469,13 +435,13 @@ function powerShellRelease() {
|
|
|
469
435
|
if (_psChild) {
|
|
470
436
|
_psChild.stdin.write('exit' + os.EOL);
|
|
471
437
|
_psChild.stdin.end();
|
|
472
|
-
_psPersistent = false;
|
|
473
438
|
}
|
|
474
439
|
} catch {
|
|
475
440
|
if (_psChild) {
|
|
476
441
|
_psChild.kill();
|
|
477
442
|
}
|
|
478
443
|
}
|
|
444
|
+
_psPersistent = false;
|
|
479
445
|
_psChild = null;
|
|
480
446
|
}
|
|
481
447
|
|
|
@@ -513,7 +479,7 @@ function powerShell(cmd) {
|
|
|
513
479
|
const spanOptions =
|
|
514
480
|
osVersion[0] < 10
|
|
515
481
|
? ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-']
|
|
516
|
-
: ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', cmd];
|
|
482
|
+
: ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', _psToUTF8 + cmd];
|
|
517
483
|
const child = spawn(_powerShell, spanOptions, {
|
|
518
484
|
stdio: 'pipe',
|
|
519
485
|
windowsHide: true,
|
|
@@ -2673,8 +2639,6 @@ exports.decodeEscapeSequence = decodeEscapeSequence;
|
|
|
2673
2639
|
exports.parseDateTime = parseDateTime;
|
|
2674
2640
|
exports.parseHead = parseHead;
|
|
2675
2641
|
exports.findObjectByKey = findObjectByKey;
|
|
2676
|
-
exports.getWmic = getWmic;
|
|
2677
|
-
exports.wmic = wmic;
|
|
2678
2642
|
exports.darwinXcodeExists = darwinXcodeExists;
|
|
2679
2643
|
exports.getVboxmanage = getVboxmanage;
|
|
2680
2644
|
exports.powerShell = powerShell;
|
package/lib/virtualbox.js
CHANGED
|
@@ -23,7 +23,7 @@ function vboxInfo(callback) {
|
|
|
23
23
|
return new Promise((resolve) => {
|
|
24
24
|
process.nextTick(() => {
|
|
25
25
|
try {
|
|
26
|
-
exec(util.getVboxmanage() + ' list vms --long',
|
|
26
|
+
exec(util.getVboxmanage() + ' list vms --long', (error, stdout) => {
|
|
27
27
|
let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:');
|
|
28
28
|
parts.shift();
|
|
29
29
|
parts.forEach((part) => {
|
|
@@ -38,7 +38,7 @@ function vboxInfo(callback) {
|
|
|
38
38
|
const offset = sinceDateObj.getTimezoneOffset();
|
|
39
39
|
runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
|
|
40
40
|
}
|
|
41
|
-
} catch
|
|
41
|
+
} catch {
|
|
42
42
|
util.noop();
|
|
43
43
|
}
|
|
44
44
|
const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : '';
|
|
@@ -49,7 +49,7 @@ function vboxInfo(callback) {
|
|
|
49
49
|
const offset = sinceDateObj.getTimezoneOffset();
|
|
50
50
|
stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60;
|
|
51
51
|
}
|
|
52
|
-
} catch
|
|
52
|
+
} catch {
|
|
53
53
|
util.noop();
|
|
54
54
|
}
|
|
55
55
|
result.push({
|
|
@@ -97,7 +97,7 @@ function vboxInfo(callback) {
|
|
|
97
97
|
}
|
|
98
98
|
resolve(result);
|
|
99
99
|
});
|
|
100
|
-
} catch
|
|
100
|
+
} catch {
|
|
101
101
|
if (callback) {
|
|
102
102
|
callback(result);
|
|
103
103
|
}
|
package/lib/wifi.js
CHANGED
|
@@ -157,7 +157,7 @@ function ifaceListLinux() {
|
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
return result;
|
|
160
|
-
} catch
|
|
160
|
+
} catch {
|
|
161
161
|
try {
|
|
162
162
|
const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null', util.execOptsLinux).toString();
|
|
163
163
|
const parts = all.split('\n\n');
|
|
@@ -179,7 +179,7 @@ function ifaceListLinux() {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
return result;
|
|
182
|
-
} catch
|
|
182
|
+
} catch {
|
|
183
183
|
return [];
|
|
184
184
|
}
|
|
185
185
|
}
|
|
@@ -198,7 +198,7 @@ function nmiDeviceLinux(iface) {
|
|
|
198
198
|
mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(),
|
|
199
199
|
ssid: ssid !== '--' ? ssid : null
|
|
200
200
|
};
|
|
201
|
-
} catch
|
|
201
|
+
} catch {
|
|
202
202
|
return {};
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -216,7 +216,7 @@ function nmiConnectionLinux(ssid) {
|
|
|
216
216
|
security: util.getValue(lines, '802-11-wireless-security.key-mgmt'),
|
|
217
217
|
bssid: bssid !== '--' ? bssid : null
|
|
218
218
|
};
|
|
219
|
-
} catch
|
|
219
|
+
} catch {
|
|
220
220
|
return {};
|
|
221
221
|
}
|
|
222
222
|
}
|
|
@@ -237,7 +237,7 @@ function wpaConnectionLinux(iface) {
|
|
|
237
237
|
channel: wifiChannelFromFrequencs(freq),
|
|
238
238
|
bssid: util.getValue(lines, 'bssid', '=').toLowerCase()
|
|
239
239
|
};
|
|
240
|
-
} catch
|
|
240
|
+
} catch {
|
|
241
241
|
return {};
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -272,7 +272,7 @@ function getWifiNetworkListNmi() {
|
|
|
272
272
|
});
|
|
273
273
|
});
|
|
274
274
|
return result;
|
|
275
|
-
} catch
|
|
275
|
+
} catch {
|
|
276
276
|
return [];
|
|
277
277
|
}
|
|
278
278
|
}
|
|
@@ -363,7 +363,7 @@ function getWifiNetworkListIw(iface) {
|
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
return result;
|
|
366
|
-
} catch
|
|
366
|
+
} catch {
|
|
367
367
|
return -1;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
@@ -404,7 +404,7 @@ function parseWifiDarwin(wifiStr) {
|
|
|
404
404
|
});
|
|
405
405
|
});
|
|
406
406
|
return result;
|
|
407
|
-
} catch
|
|
407
|
+
} catch {
|
|
408
408
|
return result;
|
|
409
409
|
}
|
|
410
410
|
}
|
|
@@ -460,7 +460,7 @@ function wifiNetworks(callback) {
|
|
|
460
460
|
}
|
|
461
461
|
resolve(result);
|
|
462
462
|
}
|
|
463
|
-
} catch
|
|
463
|
+
} catch {
|
|
464
464
|
if (callback) {
|
|
465
465
|
callback(result);
|
|
466
466
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.30.
|
|
3
|
+
"version": "5.30.4",
|
|
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)",
|