systeminformation 5.28.0 → 5.28.2
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 +16 -10
- package/lib/graphics.js +1 -1
- package/lib/index.js +35 -30
- package/lib/network.js +142 -81
- package/lib/osinfo.js +128 -144
- package/lib/processes.js +445 -325
- package/lib/util.js +4 -4
- package/package.json +1 -1
package/lib/osinfo.js
CHANGED
|
@@ -21,13 +21,13 @@ const execSync = require('child_process').execSync;
|
|
|
21
21
|
|
|
22
22
|
let _platform = process.platform;
|
|
23
23
|
|
|
24
|
-
const _linux =
|
|
25
|
-
const _darwin =
|
|
26
|
-
const _windows =
|
|
27
|
-
const _freebsd =
|
|
28
|
-
const _openbsd =
|
|
29
|
-
const _netbsd =
|
|
30
|
-
const _sunos =
|
|
24
|
+
const _linux = _platform === 'linux' || _platform === 'android';
|
|
25
|
+
const _darwin = _platform === 'darwin';
|
|
26
|
+
const _windows = _platform === 'win32';
|
|
27
|
+
const _freebsd = _platform === 'freebsd';
|
|
28
|
+
const _openbsd = _platform === 'openbsd';
|
|
29
|
+
const _netbsd = _platform === 'netbsd';
|
|
30
|
+
const _sunos = _platform === 'sunos';
|
|
31
31
|
|
|
32
32
|
// --------------------------
|
|
33
33
|
// Get current time and OS uptime
|
|
@@ -38,12 +38,12 @@ function time() {
|
|
|
38
38
|
try {
|
|
39
39
|
timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
40
40
|
} catch {
|
|
41
|
-
timezoneName =
|
|
41
|
+
timezoneName = t.length >= 7 ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : '';
|
|
42
42
|
}
|
|
43
43
|
const result = {
|
|
44
44
|
current: Date.now(),
|
|
45
45
|
uptime: os.uptime(),
|
|
46
|
-
timezone:
|
|
46
|
+
timezone: t.length >= 7 ? t[5] : '',
|
|
47
47
|
timezoneName
|
|
48
48
|
};
|
|
49
49
|
if (_darwin || _linux) {
|
|
@@ -61,7 +61,7 @@ function time() {
|
|
|
61
61
|
current: Date.now(),
|
|
62
62
|
uptime: os.uptime(),
|
|
63
63
|
timezone: lines[1] ? timezone + lines[1] : timezone,
|
|
64
|
-
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ?
|
|
64
|
+
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? lines[2].split('/zoneinfo/')[1] || '' : ''
|
|
65
65
|
};
|
|
66
66
|
} catch (e) {
|
|
67
67
|
util.noop();
|
|
@@ -81,116 +81,79 @@ function getLogoFile(distro) {
|
|
|
81
81
|
let result = _platform;
|
|
82
82
|
if (_windows) {
|
|
83
83
|
result = 'windows';
|
|
84
|
-
}
|
|
85
|
-
else if (distro.indexOf('mac os') !== -1 || distro.indexOf('macos') !== -1) {
|
|
84
|
+
} else if (distro.indexOf('mac os') !== -1 || distro.indexOf('macos') !== -1) {
|
|
86
85
|
result = 'apple';
|
|
87
|
-
}
|
|
88
|
-
else if (distro.indexOf('arch') !== -1) {
|
|
86
|
+
} else if (distro.indexOf('arch') !== -1) {
|
|
89
87
|
result = 'arch';
|
|
90
|
-
}
|
|
91
|
-
else if (distro.indexOf('cachy') !== -1) {
|
|
88
|
+
} else if (distro.indexOf('cachy') !== -1) {
|
|
92
89
|
result = 'cachy';
|
|
93
|
-
}
|
|
94
|
-
else if (distro.indexOf('centos') !== -1) {
|
|
90
|
+
} else if (distro.indexOf('centos') !== -1) {
|
|
95
91
|
result = 'centos';
|
|
96
|
-
}
|
|
97
|
-
else if (distro.indexOf('coreos') !== -1) {
|
|
92
|
+
} else if (distro.indexOf('coreos') !== -1) {
|
|
98
93
|
result = 'coreos';
|
|
99
|
-
}
|
|
100
|
-
else if (distro.indexOf('debian') !== -1) {
|
|
94
|
+
} else if (distro.indexOf('debian') !== -1) {
|
|
101
95
|
result = 'debian';
|
|
102
|
-
}
|
|
103
|
-
else if (distro.indexOf('deepin') !== -1) {
|
|
96
|
+
} else if (distro.indexOf('deepin') !== -1) {
|
|
104
97
|
result = 'deepin';
|
|
105
|
-
}
|
|
106
|
-
else if (distro.indexOf('elementary') !== -1) {
|
|
98
|
+
} else if (distro.indexOf('elementary') !== -1) {
|
|
107
99
|
result = 'elementary';
|
|
108
|
-
}
|
|
109
|
-
else if (distro.indexOf('endeavour') !== -1) {
|
|
100
|
+
} else if (distro.indexOf('endeavour') !== -1) {
|
|
110
101
|
result = 'endeavour';
|
|
111
|
-
}
|
|
112
|
-
else if (distro.indexOf('fedora') !== -1) {
|
|
102
|
+
} else if (distro.indexOf('fedora') !== -1) {
|
|
113
103
|
result = 'fedora';
|
|
114
|
-
}
|
|
115
|
-
else if (distro.indexOf('gentoo') !== -1) {
|
|
104
|
+
} else if (distro.indexOf('gentoo') !== -1) {
|
|
116
105
|
result = 'gentoo';
|
|
117
|
-
}
|
|
118
|
-
else if (distro.indexOf('mageia') !== -1) {
|
|
106
|
+
} else if (distro.indexOf('mageia') !== -1) {
|
|
119
107
|
result = 'mageia';
|
|
120
|
-
}
|
|
121
|
-
else if (distro.indexOf('mandriva') !== -1) {
|
|
108
|
+
} else if (distro.indexOf('mandriva') !== -1) {
|
|
122
109
|
result = 'mandriva';
|
|
123
|
-
}
|
|
124
|
-
else if (distro.indexOf('manjaro') !== -1) {
|
|
110
|
+
} else if (distro.indexOf('manjaro') !== -1) {
|
|
125
111
|
result = 'manjaro';
|
|
126
|
-
}
|
|
127
|
-
else if (distro.indexOf('mint') !== -1) {
|
|
112
|
+
} else if (distro.indexOf('mint') !== -1) {
|
|
128
113
|
result = 'mint';
|
|
129
|
-
}
|
|
130
|
-
else if (distro.indexOf('mx') !== -1) {
|
|
114
|
+
} else if (distro.indexOf('mx') !== -1) {
|
|
131
115
|
result = 'mx';
|
|
132
|
-
}
|
|
133
|
-
else if (distro.indexOf('openbsd') !== -1) {
|
|
116
|
+
} else if (distro.indexOf('openbsd') !== -1) {
|
|
134
117
|
result = 'openbsd';
|
|
135
|
-
}
|
|
136
|
-
else if (distro.indexOf('freebsd') !== -1) {
|
|
118
|
+
} else if (distro.indexOf('freebsd') !== -1) {
|
|
137
119
|
result = 'freebsd';
|
|
138
|
-
}
|
|
139
|
-
else if (distro.indexOf('opensuse') !== -1) {
|
|
120
|
+
} else if (distro.indexOf('opensuse') !== -1) {
|
|
140
121
|
result = 'opensuse';
|
|
141
|
-
}
|
|
142
|
-
else if (distro.indexOf('pclinuxos') !== -1) {
|
|
122
|
+
} else if (distro.indexOf('pclinuxos') !== -1) {
|
|
143
123
|
result = 'pclinuxos';
|
|
144
|
-
}
|
|
145
|
-
else if (distro.indexOf('puppy') !== -1) {
|
|
124
|
+
} else if (distro.indexOf('puppy') !== -1) {
|
|
146
125
|
result = 'puppy';
|
|
147
|
-
}
|
|
148
|
-
else if (distro.indexOf('popos') !== -1) {
|
|
126
|
+
} else if (distro.indexOf('popos') !== -1) {
|
|
149
127
|
result = 'popos';
|
|
150
|
-
}
|
|
151
|
-
else if (distro.indexOf('raspbian') !== -1) {
|
|
128
|
+
} else if (distro.indexOf('raspbian') !== -1) {
|
|
152
129
|
result = 'raspbian';
|
|
153
|
-
}
|
|
154
|
-
else if (distro.indexOf('reactos') !== -1) {
|
|
130
|
+
} else if (distro.indexOf('reactos') !== -1) {
|
|
155
131
|
result = 'reactos';
|
|
156
|
-
}
|
|
157
|
-
else if (distro.indexOf('redhat') !== -1) {
|
|
132
|
+
} else if (distro.indexOf('redhat') !== -1) {
|
|
158
133
|
result = 'redhat';
|
|
159
|
-
}
|
|
160
|
-
else if (distro.indexOf('slackware') !== -1) {
|
|
134
|
+
} else if (distro.indexOf('slackware') !== -1) {
|
|
161
135
|
result = 'slackware';
|
|
162
|
-
}
|
|
163
|
-
else if (distro.indexOf('sugar') !== -1) {
|
|
136
|
+
} else if (distro.indexOf('sugar') !== -1) {
|
|
164
137
|
result = 'sugar';
|
|
165
|
-
}
|
|
166
|
-
else if (distro.indexOf('steam') !== -1) {
|
|
138
|
+
} else if (distro.indexOf('steam') !== -1) {
|
|
167
139
|
result = 'steam';
|
|
168
|
-
}
|
|
169
|
-
else if (distro.indexOf('suse') !== -1) {
|
|
140
|
+
} else if (distro.indexOf('suse') !== -1) {
|
|
170
141
|
result = 'suse';
|
|
171
|
-
}
|
|
172
|
-
else if (distro.indexOf('mate') !== -1) {
|
|
142
|
+
} else if (distro.indexOf('mate') !== -1) {
|
|
173
143
|
result = 'ubuntu-mate';
|
|
174
|
-
}
|
|
175
|
-
else if (distro.indexOf('lubuntu') !== -1) {
|
|
144
|
+
} else if (distro.indexOf('lubuntu') !== -1) {
|
|
176
145
|
result = 'lubuntu';
|
|
177
|
-
}
|
|
178
|
-
else if (distro.indexOf('xubuntu') !== -1) {
|
|
146
|
+
} else if (distro.indexOf('xubuntu') !== -1) {
|
|
179
147
|
result = 'xubuntu';
|
|
180
|
-
}
|
|
181
|
-
else if (distro.indexOf('ubuntu') !== -1) {
|
|
148
|
+
} else if (distro.indexOf('ubuntu') !== -1) {
|
|
182
149
|
result = 'ubuntu';
|
|
183
|
-
}
|
|
184
|
-
else if (distro.indexOf('solaris') !== -1) {
|
|
150
|
+
} else if (distro.indexOf('solaris') !== -1) {
|
|
185
151
|
result = 'solaris';
|
|
186
|
-
}
|
|
187
|
-
else if (distro.indexOf('tails') !== -1) {
|
|
152
|
+
} else if (distro.indexOf('tails') !== -1) {
|
|
188
153
|
result = 'tails';
|
|
189
|
-
}
|
|
190
|
-
else if (distro.indexOf('feren') !== -1) {
|
|
154
|
+
} else if (distro.indexOf('feren') !== -1) {
|
|
191
155
|
result = 'ferenos';
|
|
192
|
-
}
|
|
193
|
-
else if (distro.indexOf('robolinux') !== -1) {
|
|
156
|
+
} else if (distro.indexOf('robolinux') !== -1) {
|
|
194
157
|
result = 'robolinux';
|
|
195
158
|
} else if (_linux && distro) {
|
|
196
159
|
result = distro.toLowerCase().trim().replace(/\s+/g, '-');
|
|
@@ -234,12 +197,10 @@ function getFQDN() {
|
|
|
234
197
|
// OS Information
|
|
235
198
|
|
|
236
199
|
function osInfo(callback) {
|
|
237
|
-
|
|
238
200
|
return new Promise((resolve) => {
|
|
239
201
|
process.nextTick(() => {
|
|
240
202
|
let result = {
|
|
241
|
-
|
|
242
|
-
platform: (_platform === 'win32' ? 'Windows' : _platform),
|
|
203
|
+
platform: _platform === 'win32' ? 'Windows' : _platform,
|
|
243
204
|
distro: 'unknown',
|
|
244
205
|
release: 'unknown',
|
|
245
206
|
codename: '',
|
|
@@ -256,7 +217,6 @@ function osInfo(callback) {
|
|
|
256
217
|
};
|
|
257
218
|
|
|
258
219
|
if (_linux) {
|
|
259
|
-
|
|
260
220
|
exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) {
|
|
261
221
|
/**
|
|
262
222
|
* @namespace
|
|
@@ -289,7 +249,7 @@ function osInfo(callback) {
|
|
|
289
249
|
result.codename = codename;
|
|
290
250
|
result.codepage = util.getCodepage();
|
|
291
251
|
result.build = (release.BUILD_ID || '').replace(/"/g, '').trim();
|
|
292
|
-
isUefiLinux().then(uefi => {
|
|
252
|
+
isUefiLinux().then((uefi) => {
|
|
293
253
|
result.uefi = uefi;
|
|
294
254
|
uuid().then((data) => {
|
|
295
255
|
result.serial = data.os;
|
|
@@ -302,7 +262,6 @@ function osInfo(callback) {
|
|
|
302
262
|
});
|
|
303
263
|
}
|
|
304
264
|
if (_freebsd || _openbsd || _netbsd) {
|
|
305
|
-
|
|
306
265
|
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', function (error, stdout) {
|
|
307
266
|
let lines = stdout.toString().split('\n');
|
|
308
267
|
const distro = util.getValue(lines, 'kern.ostype');
|
|
@@ -311,7 +270,7 @@ function osInfo(callback) {
|
|
|
311
270
|
const serial = util.getValue(lines, 'kern.uuid');
|
|
312
271
|
const bootmethod = util.getValue(lines, 'machdep.bootmethod');
|
|
313
272
|
const uefiConf = stdout.toString().indexOf('<type>efi</type>') >= 0;
|
|
314
|
-
const uefi = bootmethod ? bootmethod.toLowerCase().indexOf('uefi') >= 0 :
|
|
273
|
+
const uefi = bootmethod ? bootmethod.toLowerCase().indexOf('uefi') >= 0 : uefiConf ? uefiConf : null;
|
|
315
274
|
result.distro = distro || result.distro;
|
|
316
275
|
result.logofile = logofile || result.logofile;
|
|
317
276
|
result.release = release || result.release;
|
|
@@ -334,25 +293,24 @@ function osInfo(callback) {
|
|
|
334
293
|
result.build = util.getValue(lines, 'BuildVersion');
|
|
335
294
|
result.logofile = getLogoFile(result.distro);
|
|
336
295
|
result.codename = 'macOS';
|
|
337
|
-
result.codename =
|
|
338
|
-
result.codename =
|
|
339
|
-
result.codename =
|
|
340
|
-
result.codename =
|
|
341
|
-
result.codename =
|
|
342
|
-
result.codename =
|
|
343
|
-
result.codename =
|
|
344
|
-
result.codename =
|
|
345
|
-
result.codename =
|
|
346
|
-
result.codename =
|
|
347
|
-
result.codename =
|
|
348
|
-
result.codename =
|
|
349
|
-
result.codename =
|
|
350
|
-
result.codename =
|
|
351
|
-
result.codename =
|
|
352
|
-
result.codename =
|
|
353
|
-
result.codename =
|
|
354
|
-
result.codename =
|
|
355
|
-
result.codename = (result.release.startsWith('26.') ? 'Tahoe' : result.codename);
|
|
296
|
+
result.codename = result.release.indexOf('10.4') > -1 ? 'OS X Tiger' : result.codename;
|
|
297
|
+
result.codename = result.release.indexOf('10.5') > -1 ? 'OS X Leopard' : result.codename;
|
|
298
|
+
result.codename = result.release.indexOf('10.6') > -1 ? 'OS X Snow Leopard' : result.codename;
|
|
299
|
+
result.codename = result.release.indexOf('10.7') > -1 ? 'OS X Lion' : result.codename;
|
|
300
|
+
result.codename = result.release.indexOf('10.8') > -1 ? 'OS X Mountain Lion' : result.codename;
|
|
301
|
+
result.codename = result.release.indexOf('10.9') > -1 ? 'OS X Mavericks' : result.codename;
|
|
302
|
+
result.codename = result.release.indexOf('10.10') > -1 ? 'OS X Yosemite' : result.codename;
|
|
303
|
+
result.codename = result.release.indexOf('10.11') > -1 ? 'OS X El Capitan' : result.codename;
|
|
304
|
+
result.codename = result.release.indexOf('10.12') > -1 ? 'Sierra' : result.codename;
|
|
305
|
+
result.codename = result.release.indexOf('10.13') > -1 ? 'High Sierra' : result.codename;
|
|
306
|
+
result.codename = result.release.indexOf('10.14') > -1 ? 'Mojave' : result.codename;
|
|
307
|
+
result.codename = result.release.indexOf('10.15') > -1 ? 'Catalina' : result.codename;
|
|
308
|
+
result.codename = result.release.startsWith('11.') ? 'Big Sur' : result.codename;
|
|
309
|
+
result.codename = result.release.startsWith('12.') ? 'Monterey' : result.codename;
|
|
310
|
+
result.codename = result.release.startsWith('13.') ? 'Ventura' : result.codename;
|
|
311
|
+
result.codename = result.release.startsWith('14.') ? 'Sonoma' : result.codename;
|
|
312
|
+
result.codename = result.release.startsWith('15.') ? 'Sequoia' : result.codename;
|
|
313
|
+
result.codename = result.release.startsWith('26.') ? 'Tahoe' : result.codename;
|
|
356
314
|
result.uefi = true;
|
|
357
315
|
result.codepage = util.getCodepage();
|
|
358
316
|
if (callback) {
|
|
@@ -367,7 +325,9 @@ function osInfo(callback) {
|
|
|
367
325
|
let lines = stdout.toString().split('\n');
|
|
368
326
|
result.distro = lines[0];
|
|
369
327
|
result.logofile = getLogoFile(result.distro);
|
|
370
|
-
if (callback) {
|
|
328
|
+
if (callback) {
|
|
329
|
+
callback(result);
|
|
330
|
+
}
|
|
371
331
|
resolve(result);
|
|
372
332
|
});
|
|
373
333
|
}
|
|
@@ -379,9 +339,7 @@ function osInfo(callback) {
|
|
|
379
339
|
workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
|
|
380
340
|
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
|
381
341
|
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
|
|
382
|
-
util.promiseAll(
|
|
383
|
-
workload
|
|
384
|
-
).then((data) => {
|
|
342
|
+
util.promiseAll(workload).then((data) => {
|
|
385
343
|
let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
|
|
386
344
|
result.distro = util.getValue(lines, 'Caption', ':').trim();
|
|
387
345
|
result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
|
|
@@ -391,8 +349,8 @@ function osInfo(callback) {
|
|
|
391
349
|
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
|
|
392
350
|
result.hypervisor = hyperv.indexOf('true') !== -1;
|
|
393
351
|
const term = data.results[2] ? data.results[2].toString() : '';
|
|
394
|
-
result.remoteSession =
|
|
395
|
-
isUefiWindows().then(uefi => {
|
|
352
|
+
result.remoteSession = term.toString().toLowerCase().indexOf('true') >= 0;
|
|
353
|
+
isUefiWindows().then((uefi) => {
|
|
396
354
|
result.uefi = uefi;
|
|
397
355
|
if (callback) {
|
|
398
356
|
callback(result);
|
|
@@ -401,7 +359,9 @@ function osInfo(callback) {
|
|
|
401
359
|
});
|
|
402
360
|
});
|
|
403
361
|
} catch (e) {
|
|
404
|
-
if (callback) {
|
|
362
|
+
if (callback) {
|
|
363
|
+
callback(result);
|
|
364
|
+
}
|
|
405
365
|
resolve(result);
|
|
406
366
|
}
|
|
407
367
|
}
|
|
@@ -513,7 +473,7 @@ function versions(apps, callback) {
|
|
|
513
473
|
versions: {},
|
|
514
474
|
counter: 0
|
|
515
475
|
};
|
|
516
|
-
apps.forEach(el => {
|
|
476
|
+
apps.forEach((el) => {
|
|
517
477
|
if (el) {
|
|
518
478
|
for (let key in versionObject) {
|
|
519
479
|
if ({}.hasOwnProperty.call(versionObject, key)) {
|
|
@@ -524,7 +484,9 @@ function versions(apps, callback) {
|
|
|
524
484
|
result.versions.systemOpensslLib = '';
|
|
525
485
|
}
|
|
526
486
|
|
|
527
|
-
if (!result.versions[key]) {
|
|
487
|
+
if (!result.versions[key]) {
|
|
488
|
+
result.counter++;
|
|
489
|
+
}
|
|
528
490
|
}
|
|
529
491
|
}
|
|
530
492
|
}
|
|
@@ -542,7 +504,9 @@ function versions(apps, callback) {
|
|
|
542
504
|
} else {
|
|
543
505
|
apps = apps || '*';
|
|
544
506
|
if (typeof apps !== 'string') {
|
|
545
|
-
if (callback) {
|
|
507
|
+
if (callback) {
|
|
508
|
+
callback({});
|
|
509
|
+
}
|
|
546
510
|
return resolve({});
|
|
547
511
|
}
|
|
548
512
|
}
|
|
@@ -684,7 +648,7 @@ function versions(apps, callback) {
|
|
|
684
648
|
exec('apachectl -v 2>&1', function (error, stdout) {
|
|
685
649
|
if (!error) {
|
|
686
650
|
const apache = (stdout.toString().split('\n')[0] || '').split(':');
|
|
687
|
-
appsObj.versions.apache =
|
|
651
|
+
appsObj.versions.apache = apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : '';
|
|
688
652
|
}
|
|
689
653
|
functionProcessed();
|
|
690
654
|
});
|
|
@@ -854,7 +818,7 @@ function versions(apps, callback) {
|
|
|
854
818
|
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
|
855
819
|
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
|
856
820
|
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
|
857
|
-
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' :
|
|
821
|
+
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1';
|
|
858
822
|
exec(cmd, function (error, stdout) {
|
|
859
823
|
if (!error) {
|
|
860
824
|
const python = stdout.toString().split('\n')[0] || '';
|
|
@@ -868,7 +832,6 @@ function versions(apps, callback) {
|
|
|
868
832
|
} catch (e) {
|
|
869
833
|
functionProcessed();
|
|
870
834
|
}
|
|
871
|
-
|
|
872
835
|
} else {
|
|
873
836
|
exec('python -V 2>&1', function (error, stdout) {
|
|
874
837
|
if (!error) {
|
|
@@ -1080,7 +1043,9 @@ function versions(apps, callback) {
|
|
|
1080
1043
|
exec('node -v', function (error, stdout) {
|
|
1081
1044
|
if (!error) {
|
|
1082
1045
|
let line = stdout.toString().split('\n')[0].trim();
|
|
1083
|
-
if (line.startsWith('v')) {
|
|
1046
|
+
if (line.startsWith('v')) {
|
|
1047
|
+
line = line.slice(1);
|
|
1048
|
+
}
|
|
1084
1049
|
appsObj.versions.node = line;
|
|
1085
1050
|
}
|
|
1086
1051
|
functionProcessed();
|
|
@@ -1088,8 +1053,12 @@ function versions(apps, callback) {
|
|
|
1088
1053
|
}
|
|
1089
1054
|
if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) {
|
|
1090
1055
|
if (_windows) {
|
|
1091
|
-
util.powerShell('$PSVersionTable').then(stdout => {
|
|
1092
|
-
const lines = stdout
|
|
1056
|
+
util.powerShell('$PSVersionTable').then((stdout) => {
|
|
1057
|
+
const lines = stdout
|
|
1058
|
+
.toString()
|
|
1059
|
+
.toLowerCase()
|
|
1060
|
+
.split('\n')
|
|
1061
|
+
.map((line) => line.replace(/ +/g, ' ').replace(/ +/g, ':'));
|
|
1093
1062
|
appsObj.versions.powershell = util.getValue(lines, 'psversion');
|
|
1094
1063
|
functionProcessed();
|
|
1095
1064
|
});
|
|
@@ -1099,23 +1068,31 @@ function versions(apps, callback) {
|
|
|
1099
1068
|
}
|
|
1100
1069
|
if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) {
|
|
1101
1070
|
if (_windows) {
|
|
1102
|
-
util
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1108
|
-
dotnet =
|
|
1071
|
+
util
|
|
1072
|
+
.powerShell(
|
|
1073
|
+
'gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release'
|
|
1074
|
+
)
|
|
1075
|
+
.then((stdout) => {
|
|
1076
|
+
const lines = stdout.toString().split('\r\n');
|
|
1077
|
+
let dotnet = '';
|
|
1078
|
+
lines.forEach((line) => {
|
|
1079
|
+
line = line.replace(/ +/g, ' ');
|
|
1080
|
+
const parts = line.split(' ');
|
|
1081
|
+
dotnet =
|
|
1082
|
+
dotnet ||
|
|
1083
|
+
(parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : '');
|
|
1084
|
+
});
|
|
1085
|
+
appsObj.versions.dotnet = dotnet.trim();
|
|
1086
|
+
functionProcessed();
|
|
1109
1087
|
});
|
|
1110
|
-
appsObj.versions.dotnet = dotnet.trim();
|
|
1111
|
-
functionProcessed();
|
|
1112
|
-
});
|
|
1113
1088
|
} else {
|
|
1114
1089
|
functionProcessed();
|
|
1115
1090
|
}
|
|
1116
1091
|
}
|
|
1117
1092
|
} catch (e) {
|
|
1118
|
-
if (callback) {
|
|
1093
|
+
if (callback) {
|
|
1094
|
+
callback(appsObj.versions);
|
|
1095
|
+
}
|
|
1119
1096
|
resolve(appsObj.versions);
|
|
1120
1097
|
}
|
|
1121
1098
|
});
|
|
@@ -1130,7 +1107,7 @@ function shell(callback) {
|
|
|
1130
1107
|
if (_windows) {
|
|
1131
1108
|
try {
|
|
1132
1109
|
const result = 'CMD';
|
|
1133
|
-
util.powerShell(`Get-CimInstance -className win32_process | where-object {$_.ProcessId -eq ${process.ppid} } | select Name`).then(stdout => {
|
|
1110
|
+
util.powerShell(`Get-CimInstance -className win32_process | where-object {$_.ProcessId -eq ${process.ppid} } | select Name`).then((stdout) => {
|
|
1134
1111
|
let result = 'CMD';
|
|
1135
1112
|
if (stdout) {
|
|
1136
1113
|
if (stdout.toString().toLowerCase().indexOf('powershell') >= 0) {
|
|
@@ -1183,8 +1160,12 @@ function getUniqueMacAdresses() {
|
|
|
1183
1160
|
}
|
|
1184
1161
|
}
|
|
1185
1162
|
macs = macs.sort(function (a, b) {
|
|
1186
|
-
if (a < b) {
|
|
1187
|
-
|
|
1163
|
+
if (a < b) {
|
|
1164
|
+
return -1;
|
|
1165
|
+
}
|
|
1166
|
+
if (a > b) {
|
|
1167
|
+
return 1;
|
|
1168
|
+
}
|
|
1188
1169
|
return 0;
|
|
1189
1170
|
});
|
|
1190
1171
|
} catch (e) {
|
|
@@ -1196,7 +1177,6 @@ function getUniqueMacAdresses() {
|
|
|
1196
1177
|
function uuid(callback) {
|
|
1197
1178
|
return new Promise((resolve) => {
|
|
1198
1179
|
process.nextTick(() => {
|
|
1199
|
-
|
|
1200
1180
|
let result = {
|
|
1201
1181
|
os: '',
|
|
1202
1182
|
hardware: '',
|
|
@@ -1248,8 +1228,12 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
|
1248
1228
|
const lines = stdout.toString().split('\n');
|
|
1249
1229
|
result.hardware = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
|
1250
1230
|
result.os = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
|
1251
|
-
if (result.os.indexOf('unknown') >= 0) {
|
|
1252
|
-
|
|
1231
|
+
if (result.os.indexOf('unknown') >= 0) {
|
|
1232
|
+
result.os = '';
|
|
1233
|
+
}
|
|
1234
|
+
if (result.hardware.indexOf('unknown') >= 0) {
|
|
1235
|
+
result.hardware = '';
|
|
1236
|
+
}
|
|
1253
1237
|
if (callback) {
|
|
1254
1238
|
callback(result);
|
|
1255
1239
|
}
|
|
@@ -1266,7 +1250,7 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
|
1266
1250
|
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
|
1267
1251
|
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
|
|
1268
1252
|
parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
|
|
1269
|
-
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/
|
|
1253
|
+
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/gi, '').toLowerCase() : '';
|
|
1270
1254
|
if (callback) {
|
|
1271
1255
|
callback(result);
|
|
1272
1256
|
}
|