systeminformation 5.28.10 → 5.29.1
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 +3 -3
- package/lib/graphics.js +1 -1
- 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/osinfo.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
|
|
@@ -19,7 +19,7 @@ const util = require('./util');
|
|
|
19
19
|
const exec = require('child_process').exec;
|
|
20
20
|
const execSync = require('child_process').execSync;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const _platform = process.platform;
|
|
23
23
|
|
|
24
24
|
const _linux = _platform === 'linux' || _platform === 'android';
|
|
25
25
|
const _darwin = _platform === 'darwin';
|
|
@@ -33,7 +33,7 @@ const _sunos = _platform === 'sunos';
|
|
|
33
33
|
// Get current time and OS uptime
|
|
34
34
|
|
|
35
35
|
function time() {
|
|
36
|
-
|
|
36
|
+
const t = new Date().toString().split(' ');
|
|
37
37
|
let timezoneName = '';
|
|
38
38
|
try {
|
|
39
39
|
timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -63,7 +63,7 @@ function time() {
|
|
|
63
63
|
timezone: lines[1] ? timezone + lines[1] : timezone,
|
|
64
64
|
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? lines[2].split('/zoneinfo/')[1] || '' : ''
|
|
65
65
|
};
|
|
66
|
-
} catch
|
|
66
|
+
} catch {
|
|
67
67
|
util.noop();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -161,6 +161,30 @@ function getLogoFile(distro) {
|
|
|
161
161
|
return result;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
const WINDOWS_RELEASES = [
|
|
165
|
+
[26200, '25H2'],
|
|
166
|
+
[26100, '24H2'],
|
|
167
|
+
[22631, '23H2'],
|
|
168
|
+
[22621, '22H2'],
|
|
169
|
+
[19045, '22H2'],
|
|
170
|
+
[22000, '21H2'],
|
|
171
|
+
[19044, '21H2'],
|
|
172
|
+
[19043, '21H1'],
|
|
173
|
+
[19042, '20H2'],
|
|
174
|
+
[19041, '2004'],
|
|
175
|
+
[18363, '1909'],
|
|
176
|
+
[18362, '1903'],
|
|
177
|
+
[17763, '1809'],
|
|
178
|
+
[17134, '1803']
|
|
179
|
+
];
|
|
180
|
+
|
|
181
|
+
function getWindowsRelease(build) {
|
|
182
|
+
for (const [minBuild, label] of WINDOWS_RELEASES) {
|
|
183
|
+
if (build >= minBuild) return label;
|
|
184
|
+
}
|
|
185
|
+
return '';
|
|
186
|
+
}
|
|
187
|
+
|
|
164
188
|
// --------------------------
|
|
165
189
|
// FQDN
|
|
166
190
|
|
|
@@ -170,7 +194,7 @@ function getFQDN() {
|
|
|
170
194
|
try {
|
|
171
195
|
const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux);
|
|
172
196
|
fqdn = stdout.toString().split(os.EOL)[0];
|
|
173
|
-
} catch
|
|
197
|
+
} catch {
|
|
174
198
|
util.noop();
|
|
175
199
|
}
|
|
176
200
|
}
|
|
@@ -178,7 +202,7 @@ function getFQDN() {
|
|
|
178
202
|
try {
|
|
179
203
|
const stdout = execSync('hostname 2>/dev/null');
|
|
180
204
|
fqdn = stdout.toString().split(os.EOL)[0];
|
|
181
|
-
} catch
|
|
205
|
+
} catch {
|
|
182
206
|
util.noop();
|
|
183
207
|
}
|
|
184
208
|
}
|
|
@@ -186,7 +210,7 @@ function getFQDN() {
|
|
|
186
210
|
try {
|
|
187
211
|
const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin);
|
|
188
212
|
fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0];
|
|
189
|
-
} catch
|
|
213
|
+
} catch {
|
|
190
214
|
util.noop();
|
|
191
215
|
}
|
|
192
216
|
}
|
|
@@ -217,7 +241,7 @@ function osInfo(callback) {
|
|
|
217
241
|
};
|
|
218
242
|
|
|
219
243
|
if (_linux) {
|
|
220
|
-
exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release',
|
|
244
|
+
exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', (error, stdout) => {
|
|
221
245
|
/**
|
|
222
246
|
* @namespace
|
|
223
247
|
* @property {string} DISTRIB_ID
|
|
@@ -228,7 +252,7 @@ function osInfo(callback) {
|
|
|
228
252
|
*/
|
|
229
253
|
let release = {};
|
|
230
254
|
let lines = stdout.toString().split('\n');
|
|
231
|
-
lines.forEach(
|
|
255
|
+
lines.forEach((line) => {
|
|
232
256
|
if (line.indexOf('=') !== -1) {
|
|
233
257
|
release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim();
|
|
234
258
|
}
|
|
@@ -262,7 +286,7 @@ function osInfo(callback) {
|
|
|
262
286
|
});
|
|
263
287
|
}
|
|
264
288
|
if (_freebsd || _openbsd || _netbsd) {
|
|
265
|
-
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml',
|
|
289
|
+
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', (error, stdout) => {
|
|
266
290
|
let lines = stdout.toString().split('\n');
|
|
267
291
|
const distro = util.getValue(lines, 'kern.ostype');
|
|
268
292
|
const logofile = getLogoFile(distro);
|
|
@@ -285,7 +309,7 @@ function osInfo(callback) {
|
|
|
285
309
|
});
|
|
286
310
|
}
|
|
287
311
|
if (_darwin) {
|
|
288
|
-
exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid',
|
|
312
|
+
exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', (error, stdout) => {
|
|
289
313
|
let lines = stdout.toString().split('\n');
|
|
290
314
|
result.serial = util.getValue(lines, 'kern.uuid');
|
|
291
315
|
result.distro = util.getValue(lines, 'ProductName');
|
|
@@ -321,8 +345,8 @@ function osInfo(callback) {
|
|
|
321
345
|
}
|
|
322
346
|
if (_sunos) {
|
|
323
347
|
result.release = result.kernel;
|
|
324
|
-
exec('uname -o',
|
|
325
|
-
|
|
348
|
+
exec('uname -o', (error, stdout) => {
|
|
349
|
+
const lines = stdout.toString().split('\n');
|
|
326
350
|
result.distro = lines[0];
|
|
327
351
|
result.logofile = getLogoFile(result.distro);
|
|
328
352
|
if (callback) {
|
|
@@ -339,8 +363,9 @@ function osInfo(callback) {
|
|
|
339
363
|
workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
|
|
340
364
|
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
|
341
365
|
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
|
|
366
|
+
workload.push(util.powerShell('reg query "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" /v DisplayVersion'));
|
|
342
367
|
util.promiseAll(workload).then((data) => {
|
|
343
|
-
|
|
368
|
+
const lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
|
|
344
369
|
result.distro = util.getValue(lines, 'Caption', ':').trim();
|
|
345
370
|
result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
|
|
346
371
|
result.build = util.getValue(lines, 'BuildNumber', ':').trim();
|
|
@@ -349,6 +374,14 @@ function osInfo(callback) {
|
|
|
349
374
|
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
|
|
350
375
|
result.hypervisor = hyperv.indexOf('true') !== -1;
|
|
351
376
|
const term = data.results[2] ? data.results[2].toString() : '';
|
|
377
|
+
if (data.results[3]) {
|
|
378
|
+
const codenameParts = data.results[3].split('REG_SZ');
|
|
379
|
+
result.codename = codenameParts.length > 1 ? codenameParts[1].trim() : '';
|
|
380
|
+
}
|
|
381
|
+
if (!result.codename) {
|
|
382
|
+
const buildNum = parseInt(result.build, 10);
|
|
383
|
+
result.codename = getWindowsRelease(buildNum);
|
|
384
|
+
}
|
|
352
385
|
result.remoteSession = term.toString().toLowerCase().indexOf('true') >= 0;
|
|
353
386
|
isUefiWindows().then((uefi) => {
|
|
354
387
|
result.uefi = uefi;
|
|
@@ -358,7 +391,7 @@ function osInfo(callback) {
|
|
|
358
391
|
resolve(result);
|
|
359
392
|
});
|
|
360
393
|
});
|
|
361
|
-
} catch
|
|
394
|
+
} catch {
|
|
362
395
|
if (callback) {
|
|
363
396
|
callback(result);
|
|
364
397
|
}
|
|
@@ -374,11 +407,11 @@ exports.osInfo = osInfo;
|
|
|
374
407
|
function isUefiLinux() {
|
|
375
408
|
return new Promise((resolve) => {
|
|
376
409
|
process.nextTick(() => {
|
|
377
|
-
fs.stat('/sys/firmware/efi',
|
|
410
|
+
fs.stat('/sys/firmware/efi', (err) => {
|
|
378
411
|
if (!err) {
|
|
379
412
|
return resolve(true);
|
|
380
413
|
} else {
|
|
381
|
-
exec('dmesg | grep -E "EFI v"',
|
|
414
|
+
exec('dmesg | grep -E "EFI v"', (error, stdout) => {
|
|
382
415
|
if (!error) {
|
|
383
416
|
const lines = stdout.toString().split('\n');
|
|
384
417
|
return resolve(lines.length > 0);
|
|
@@ -395,12 +428,12 @@ function isUefiWindows() {
|
|
|
395
428
|
return new Promise((resolve) => {
|
|
396
429
|
process.nextTick(() => {
|
|
397
430
|
try {
|
|
398
|
-
exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin,
|
|
431
|
+
exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, (error, stdout) => {
|
|
399
432
|
if (!error) {
|
|
400
433
|
const line = stdout.toString().split('\n\r')[0];
|
|
401
434
|
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
|
402
435
|
} else {
|
|
403
|
-
exec('echo %firmware_type%', util.execOptsWin,
|
|
436
|
+
exec('echo %firmware_type%', util.execOptsWin, (error, stdout) => {
|
|
404
437
|
if (!error) {
|
|
405
438
|
const line = stdout.toString() || '';
|
|
406
439
|
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
|
@@ -410,7 +443,7 @@ function isUefiWindows() {
|
|
|
410
443
|
});
|
|
411
444
|
}
|
|
412
445
|
});
|
|
413
|
-
} catch
|
|
446
|
+
} catch {
|
|
414
447
|
return resolve(false);
|
|
415
448
|
}
|
|
416
449
|
});
|
|
@@ -513,8 +546,8 @@ function versions(apps, callback) {
|
|
|
513
546
|
const appsObj = checkVersionParam(apps);
|
|
514
547
|
let totalFunctions = appsObj.counter;
|
|
515
548
|
|
|
516
|
-
let functionProcessed = (
|
|
517
|
-
return
|
|
549
|
+
let functionProcessed = (() => {
|
|
550
|
+
return () => {
|
|
518
551
|
if (--totalFunctions === 0) {
|
|
519
552
|
if (callback) {
|
|
520
553
|
callback(appsObj.versions);
|
|
@@ -528,7 +561,7 @@ function versions(apps, callback) {
|
|
|
528
561
|
try {
|
|
529
562
|
if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) {
|
|
530
563
|
appsObj.versions.openssl = process.versions.openssl;
|
|
531
|
-
exec('openssl version',
|
|
564
|
+
exec('openssl version', (error, stdout) => {
|
|
532
565
|
if (!error) {
|
|
533
566
|
let openssl_string = stdout.toString().split('\n')[0].trim();
|
|
534
567
|
let openssl = openssl_string.split(' ');
|
|
@@ -539,7 +572,7 @@ function versions(apps, callback) {
|
|
|
539
572
|
});
|
|
540
573
|
}
|
|
541
574
|
if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) {
|
|
542
|
-
exec('npm -v',
|
|
575
|
+
exec('npm -v', (error, stdout) => {
|
|
543
576
|
if (!error) {
|
|
544
577
|
appsObj.versions.npm = stdout.toString().split('\n')[0];
|
|
545
578
|
}
|
|
@@ -551,7 +584,7 @@ function versions(apps, callback) {
|
|
|
551
584
|
if (_windows) {
|
|
552
585
|
cmd += '.cmd';
|
|
553
586
|
}
|
|
554
|
-
exec(`${cmd} -v`,
|
|
587
|
+
exec(`${cmd} -v`, (error, stdout) => {
|
|
555
588
|
if (!error) {
|
|
556
589
|
let pm2 = stdout.toString().split('\n')[0].trim();
|
|
557
590
|
if (!pm2.startsWith('[PM2]')) {
|
|
@@ -562,7 +595,7 @@ function versions(apps, callback) {
|
|
|
562
595
|
});
|
|
563
596
|
}
|
|
564
597
|
if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) {
|
|
565
|
-
exec('yarn --version',
|
|
598
|
+
exec('yarn --version', (error, stdout) => {
|
|
566
599
|
if (!error) {
|
|
567
600
|
appsObj.versions.yarn = stdout.toString().split('\n')[0];
|
|
568
601
|
}
|
|
@@ -574,7 +607,7 @@ function versions(apps, callback) {
|
|
|
574
607
|
if (_windows) {
|
|
575
608
|
cmd += '.cmd';
|
|
576
609
|
}
|
|
577
|
-
exec(`${cmd} --version`,
|
|
610
|
+
exec(`${cmd} --version`, (error, stdout) => {
|
|
578
611
|
if (!error) {
|
|
579
612
|
const gulp = stdout.toString().split('\n')[0] || '';
|
|
580
613
|
appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim();
|
|
@@ -584,7 +617,7 @@ function versions(apps, callback) {
|
|
|
584
617
|
}
|
|
585
618
|
if ({}.hasOwnProperty.call(appsObj.versions, 'homebrew')) {
|
|
586
619
|
cmd = 'brew';
|
|
587
|
-
exec(`${cmd} --version`,
|
|
620
|
+
exec(`${cmd} --version`, (error, stdout) => {
|
|
588
621
|
if (!error) {
|
|
589
622
|
const brew = stdout.toString().split('\n')[0] || '';
|
|
590
623
|
appsObj.versions.homebrew = (brew.toLowerCase().split(' ')[1] || '').trim();
|
|
@@ -597,7 +630,7 @@ function versions(apps, callback) {
|
|
|
597
630
|
if (_windows) {
|
|
598
631
|
cmd += '.cmd';
|
|
599
632
|
}
|
|
600
|
-
exec(`${cmd} --version`,
|
|
633
|
+
exec(`${cmd} --version`, (error, stdout) => {
|
|
601
634
|
if (!error) {
|
|
602
635
|
const tsc = stdout.toString().split('\n')[0] || '';
|
|
603
636
|
appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim();
|
|
@@ -610,7 +643,7 @@ function versions(apps, callback) {
|
|
|
610
643
|
if (_windows) {
|
|
611
644
|
cmd += '.cmd';
|
|
612
645
|
}
|
|
613
|
-
exec(`${cmd} --version`,
|
|
646
|
+
exec(`${cmd} --version`, (error, stdout) => {
|
|
614
647
|
if (!error) {
|
|
615
648
|
const grunt = stdout.toString().split('\n')[0] || '';
|
|
616
649
|
appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim();
|
|
@@ -622,7 +655,7 @@ function versions(apps, callback) {
|
|
|
622
655
|
if (_darwin) {
|
|
623
656
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
|
|
624
657
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
625
|
-
exec('git --version',
|
|
658
|
+
exec('git --version', (error, stdout) => {
|
|
626
659
|
if (!error) {
|
|
627
660
|
let git = stdout.toString().split('\n')[0] || '';
|
|
628
661
|
git = (git.toLowerCase().split('version')[1] || '').trim();
|
|
@@ -634,7 +667,7 @@ function versions(apps, callback) {
|
|
|
634
667
|
functionProcessed();
|
|
635
668
|
}
|
|
636
669
|
} else {
|
|
637
|
-
exec('git --version',
|
|
670
|
+
exec('git --version', (error, stdout) => {
|
|
638
671
|
if (!error) {
|
|
639
672
|
let git = stdout.toString().split('\n')[0] || '';
|
|
640
673
|
git = (git.toLowerCase().split('version')[1] || '').trim();
|
|
@@ -645,7 +678,7 @@ function versions(apps, callback) {
|
|
|
645
678
|
}
|
|
646
679
|
}
|
|
647
680
|
if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) {
|
|
648
|
-
exec('apachectl -v 2>&1',
|
|
681
|
+
exec('apachectl -v 2>&1', (error, stdout) => {
|
|
649
682
|
if (!error) {
|
|
650
683
|
const apache = (stdout.toString().split('\n')[0] || '').split(':');
|
|
651
684
|
appsObj.versions.apache = apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : '';
|
|
@@ -654,7 +687,7 @@ function versions(apps, callback) {
|
|
|
654
687
|
});
|
|
655
688
|
}
|
|
656
689
|
if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) {
|
|
657
|
-
exec('nginx -v 2>&1',
|
|
690
|
+
exec('nginx -v 2>&1', (error, stdout) => {
|
|
658
691
|
if (!error) {
|
|
659
692
|
const nginx = stdout.toString().split('\n')[0] || '';
|
|
660
693
|
appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim();
|
|
@@ -663,7 +696,7 @@ function versions(apps, callback) {
|
|
|
663
696
|
});
|
|
664
697
|
}
|
|
665
698
|
if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) {
|
|
666
|
-
exec('mysql -V',
|
|
699
|
+
exec('mysql -V', (error, stdout) => {
|
|
667
700
|
if (!error) {
|
|
668
701
|
let mysql = stdout.toString().split('\n')[0] || '';
|
|
669
702
|
mysql = mysql.toLowerCase();
|
|
@@ -682,7 +715,7 @@ function versions(apps, callback) {
|
|
|
682
715
|
});
|
|
683
716
|
}
|
|
684
717
|
if ({}.hasOwnProperty.call(appsObj.versions, 'php')) {
|
|
685
|
-
exec('php -v',
|
|
718
|
+
exec('php -v', (error, stdout) => {
|
|
686
719
|
if (!error) {
|
|
687
720
|
const php = stdout.toString().split('\n')[0] || '';
|
|
688
721
|
let parts = php.split('(');
|
|
@@ -695,7 +728,7 @@ function versions(apps, callback) {
|
|
|
695
728
|
});
|
|
696
729
|
}
|
|
697
730
|
if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) {
|
|
698
|
-
exec('redis-server --version',
|
|
731
|
+
exec('redis-server --version', (error, stdout) => {
|
|
699
732
|
if (!error) {
|
|
700
733
|
const redis = stdout.toString().split('\n')[0] || '';
|
|
701
734
|
const parts = redis.split(' ');
|
|
@@ -705,7 +738,7 @@ function versions(apps, callback) {
|
|
|
705
738
|
});
|
|
706
739
|
}
|
|
707
740
|
if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) {
|
|
708
|
-
exec('docker --version',
|
|
741
|
+
exec('docker --version', (error, stdout) => {
|
|
709
742
|
if (!error) {
|
|
710
743
|
const docker = stdout.toString().split('\n')[0] || '';
|
|
711
744
|
const parts = docker.split(' ');
|
|
@@ -715,7 +748,7 @@ function versions(apps, callback) {
|
|
|
715
748
|
});
|
|
716
749
|
}
|
|
717
750
|
if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) {
|
|
718
|
-
exec('postconf -d | grep mail_version',
|
|
751
|
+
exec('postconf -d | grep mail_version', (error, stdout) => {
|
|
719
752
|
if (!error) {
|
|
720
753
|
const postfix = stdout.toString().split('\n') || [];
|
|
721
754
|
appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true);
|
|
@@ -724,7 +757,7 @@ function versions(apps, callback) {
|
|
|
724
757
|
});
|
|
725
758
|
}
|
|
726
759
|
if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) {
|
|
727
|
-
exec('mongod --version',
|
|
760
|
+
exec('mongod --version', (error, stdout) => {
|
|
728
761
|
if (!error) {
|
|
729
762
|
const mongodb = stdout.toString().split('\n')[0] || '';
|
|
730
763
|
appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
|
|
@@ -734,11 +767,11 @@ function versions(apps, callback) {
|
|
|
734
767
|
}
|
|
735
768
|
if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) {
|
|
736
769
|
if (_linux) {
|
|
737
|
-
exec('locate bin/postgres',
|
|
770
|
+
exec('locate bin/postgres', (error, stdout) => {
|
|
738
771
|
if (!error) {
|
|
739
772
|
const postgresqlBin = stdout.toString().split('\n').sort();
|
|
740
773
|
if (postgresqlBin.length) {
|
|
741
|
-
exec(postgresqlBin[postgresqlBin.length - 1] + ' -V',
|
|
774
|
+
exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', (error, stdout) => {
|
|
742
775
|
if (!error) {
|
|
743
776
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
744
777
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
@@ -749,7 +782,7 @@ function versions(apps, callback) {
|
|
|
749
782
|
functionProcessed();
|
|
750
783
|
}
|
|
751
784
|
} else {
|
|
752
|
-
exec('psql -V',
|
|
785
|
+
exec('psql -V', (error, stdout) => {
|
|
753
786
|
if (!error) {
|
|
754
787
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
755
788
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
@@ -778,12 +811,12 @@ function versions(apps, callback) {
|
|
|
778
811
|
functionProcessed();
|
|
779
812
|
});
|
|
780
813
|
} else {
|
|
781
|
-
exec('postgres -V',
|
|
814
|
+
exec('postgres -V', (error, stdout) => {
|
|
782
815
|
if (!error) {
|
|
783
816
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
784
817
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
785
818
|
} else {
|
|
786
|
-
exec('pg_config --version',
|
|
819
|
+
exec('pg_config --version', (error, stdout) => {
|
|
787
820
|
if (!error) {
|
|
788
821
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
789
822
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
|
@@ -796,7 +829,7 @@ function versions(apps, callback) {
|
|
|
796
829
|
}
|
|
797
830
|
}
|
|
798
831
|
if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) {
|
|
799
|
-
exec('perl -v',
|
|
832
|
+
exec('perl -v', (error, stdout) => {
|
|
800
833
|
if (!error) {
|
|
801
834
|
const perl = stdout.toString().split('\n') || '';
|
|
802
835
|
while (perl.length > 0 && perl[0].trim() === '') {
|
|
@@ -819,7 +852,7 @@ function versions(apps, callback) {
|
|
|
819
852
|
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
|
820
853
|
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
|
821
854
|
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1';
|
|
822
|
-
exec(cmd,
|
|
855
|
+
exec(cmd, (error, stdout) => {
|
|
823
856
|
if (!error) {
|
|
824
857
|
const python = stdout.toString().split('\n')[0] || '';
|
|
825
858
|
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
|
@@ -829,11 +862,11 @@ function versions(apps, callback) {
|
|
|
829
862
|
} else {
|
|
830
863
|
functionProcessed();
|
|
831
864
|
}
|
|
832
|
-
} catch
|
|
865
|
+
} catch {
|
|
833
866
|
functionProcessed();
|
|
834
867
|
}
|
|
835
868
|
} else {
|
|
836
|
-
exec('python -V 2>&1',
|
|
869
|
+
exec('python -V 2>&1', (error, stdout) => {
|
|
837
870
|
if (!error) {
|
|
838
871
|
const python = stdout.toString().split('\n')[0] || '';
|
|
839
872
|
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
|
@@ -846,7 +879,7 @@ function versions(apps, callback) {
|
|
|
846
879
|
if (_darwin) {
|
|
847
880
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
|
|
848
881
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
849
|
-
exec('python3 -V 2>&1',
|
|
882
|
+
exec('python3 -V 2>&1', (error, stdout) => {
|
|
850
883
|
if (!error) {
|
|
851
884
|
const python = stdout.toString().split('\n')[0] || '';
|
|
852
885
|
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
|
@@ -857,7 +890,7 @@ function versions(apps, callback) {
|
|
|
857
890
|
functionProcessed();
|
|
858
891
|
}
|
|
859
892
|
} else {
|
|
860
|
-
exec('python3 -V 2>&1',
|
|
893
|
+
exec('python3 -V 2>&1', (error, stdout) => {
|
|
861
894
|
if (!error) {
|
|
862
895
|
const python = stdout.toString().split('\n')[0] || '';
|
|
863
896
|
appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
|
|
@@ -870,7 +903,7 @@ function versions(apps, callback) {
|
|
|
870
903
|
if (_darwin) {
|
|
871
904
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
|
|
872
905
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
873
|
-
exec('pip -V 2>&1',
|
|
906
|
+
exec('pip -V 2>&1', (error, stdout) => {
|
|
874
907
|
if (!error) {
|
|
875
908
|
const pip = stdout.toString().split('\n')[0] || '';
|
|
876
909
|
const parts = pip.split(' ');
|
|
@@ -882,7 +915,7 @@ function versions(apps, callback) {
|
|
|
882
915
|
functionProcessed();
|
|
883
916
|
}
|
|
884
917
|
} else {
|
|
885
|
-
exec('pip -V 2>&1',
|
|
918
|
+
exec('pip -V 2>&1', (error, stdout) => {
|
|
886
919
|
if (!error) {
|
|
887
920
|
const pip = stdout.toString().split('\n')[0] || '';
|
|
888
921
|
const parts = pip.split(' ');
|
|
@@ -896,7 +929,7 @@ function versions(apps, callback) {
|
|
|
896
929
|
if (_darwin) {
|
|
897
930
|
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
|
|
898
931
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
899
|
-
exec('pip3 -V 2>&1',
|
|
932
|
+
exec('pip3 -V 2>&1', (error, stdout) => {
|
|
900
933
|
if (!error) {
|
|
901
934
|
const pip = stdout.toString().split('\n')[0] || '';
|
|
902
935
|
const parts = pip.split(' ');
|
|
@@ -908,7 +941,7 @@ function versions(apps, callback) {
|
|
|
908
941
|
functionProcessed();
|
|
909
942
|
}
|
|
910
943
|
} else {
|
|
911
|
-
exec('pip3 -V 2>&1',
|
|
944
|
+
exec('pip3 -V 2>&1', (error, stdout) => {
|
|
912
945
|
if (!error) {
|
|
913
946
|
const pip = stdout.toString().split('\n')[0] || '';
|
|
914
947
|
const parts = pip.split(' ');
|
|
@@ -921,10 +954,10 @@ function versions(apps, callback) {
|
|
|
921
954
|
if ({}.hasOwnProperty.call(appsObj.versions, 'java')) {
|
|
922
955
|
if (_darwin) {
|
|
923
956
|
// check if any JVM is installed but avoid dialog box that Java needs to be installed
|
|
924
|
-
exec('/usr/libexec/java_home -V 2>&1',
|
|
957
|
+
exec('/usr/libexec/java_home -V 2>&1', (error, stdout) => {
|
|
925
958
|
if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) {
|
|
926
959
|
// now this can be done savely
|
|
927
|
-
exec('java -version 2>&1',
|
|
960
|
+
exec('java -version 2>&1', (error, stdout) => {
|
|
928
961
|
if (!error) {
|
|
929
962
|
const java = stdout.toString().split('\n')[0] || '';
|
|
930
963
|
const parts = java.split('"');
|
|
@@ -937,7 +970,7 @@ function versions(apps, callback) {
|
|
|
937
970
|
}
|
|
938
971
|
});
|
|
939
972
|
} else {
|
|
940
|
-
exec('java -version 2>&1',
|
|
973
|
+
exec('java -version 2>&1', (error, stdout) => {
|
|
941
974
|
if (!error) {
|
|
942
975
|
const java = stdout.toString().split('\n')[0] || '';
|
|
943
976
|
const parts = java.split('"');
|
|
@@ -949,14 +982,14 @@ function versions(apps, callback) {
|
|
|
949
982
|
}
|
|
950
983
|
if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) {
|
|
951
984
|
if ((_darwin && util.darwinXcodeExists()) || !_darwin) {
|
|
952
|
-
exec('gcc -dumpversion',
|
|
985
|
+
exec('gcc -dumpversion', (error, stdout) => {
|
|
953
986
|
if (!error) {
|
|
954
987
|
appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || '';
|
|
955
988
|
}
|
|
956
989
|
if (appsObj.versions.gcc.indexOf('.') > -1) {
|
|
957
990
|
functionProcessed();
|
|
958
991
|
} else {
|
|
959
|
-
exec('gcc --version',
|
|
992
|
+
exec('gcc --version', (error, stdout) => {
|
|
960
993
|
if (!error) {
|
|
961
994
|
const gcc = stdout.toString().split('\n')[0].trim();
|
|
962
995
|
if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) {
|
|
@@ -973,7 +1006,7 @@ function versions(apps, callback) {
|
|
|
973
1006
|
}
|
|
974
1007
|
}
|
|
975
1008
|
if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) {
|
|
976
|
-
exec(util.getVboxmanage() + ' -v 2>&1',
|
|
1009
|
+
exec(util.getVboxmanage() + ' -v 2>&1', (error, stdout) => {
|
|
977
1010
|
if (!error) {
|
|
978
1011
|
const vbox = stdout.toString().split('\n')[0] || '';
|
|
979
1012
|
const parts = vbox.split('r');
|
|
@@ -983,7 +1016,7 @@ function versions(apps, callback) {
|
|
|
983
1016
|
});
|
|
984
1017
|
}
|
|
985
1018
|
if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) {
|
|
986
|
-
exec('bash --version',
|
|
1019
|
+
exec('bash --version', (error, stdout) => {
|
|
987
1020
|
if (!error) {
|
|
988
1021
|
const line = stdout.toString().split('\n')[0];
|
|
989
1022
|
const parts = line.split(' version ');
|
|
@@ -995,7 +1028,7 @@ function versions(apps, callback) {
|
|
|
995
1028
|
});
|
|
996
1029
|
}
|
|
997
1030
|
if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) {
|
|
998
|
-
exec('zsh --version',
|
|
1031
|
+
exec('zsh --version', (error, stdout) => {
|
|
999
1032
|
if (!error) {
|
|
1000
1033
|
const line = stdout.toString().split('\n')[0];
|
|
1001
1034
|
const parts = line.split('zsh ');
|
|
@@ -1007,7 +1040,7 @@ function versions(apps, callback) {
|
|
|
1007
1040
|
});
|
|
1008
1041
|
}
|
|
1009
1042
|
if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) {
|
|
1010
|
-
exec('fish --version',
|
|
1043
|
+
exec('fish --version', (error, stdout) => {
|
|
1011
1044
|
if (!error) {
|
|
1012
1045
|
const line = stdout.toString().split('\n')[0];
|
|
1013
1046
|
const parts = line.split(' version ');
|
|
@@ -1019,7 +1052,7 @@ function versions(apps, callback) {
|
|
|
1019
1052
|
});
|
|
1020
1053
|
}
|
|
1021
1054
|
if ({}.hasOwnProperty.call(appsObj.versions, 'bun')) {
|
|
1022
|
-
exec('bun -v',
|
|
1055
|
+
exec('bun -v', (error, stdout) => {
|
|
1023
1056
|
if (!error) {
|
|
1024
1057
|
const line = stdout.toString().split('\n')[0].trim();
|
|
1025
1058
|
appsObj.versions.bun = line;
|
|
@@ -1028,7 +1061,7 @@ function versions(apps, callback) {
|
|
|
1028
1061
|
});
|
|
1029
1062
|
}
|
|
1030
1063
|
if ({}.hasOwnProperty.call(appsObj.versions, 'deno')) {
|
|
1031
|
-
exec('deno -v',
|
|
1064
|
+
exec('deno -v', (error, stdout) => {
|
|
1032
1065
|
if (!error) {
|
|
1033
1066
|
const line = stdout.toString().split('\n')[0].trim();
|
|
1034
1067
|
const parts = line.split(' ');
|
|
@@ -1040,7 +1073,7 @@ function versions(apps, callback) {
|
|
|
1040
1073
|
});
|
|
1041
1074
|
}
|
|
1042
1075
|
if ({}.hasOwnProperty.call(appsObj.versions, 'node')) {
|
|
1043
|
-
exec('node -v',
|
|
1076
|
+
exec('node -v', (error, stdout) => {
|
|
1044
1077
|
if (!error) {
|
|
1045
1078
|
let line = stdout.toString().split('\n')[0].trim();
|
|
1046
1079
|
if (line.startsWith('v')) {
|
|
@@ -1089,7 +1122,7 @@ function versions(apps, callback) {
|
|
|
1089
1122
|
functionProcessed();
|
|
1090
1123
|
}
|
|
1091
1124
|
}
|
|
1092
|
-
} catch
|
|
1125
|
+
} catch {
|
|
1093
1126
|
if (callback) {
|
|
1094
1127
|
callback(appsObj.versions);
|
|
1095
1128
|
}
|
|
@@ -1127,7 +1160,7 @@ function shell(callback) {
|
|
|
1127
1160
|
}
|
|
1128
1161
|
} else {
|
|
1129
1162
|
let result = '';
|
|
1130
|
-
exec('echo $SHELL',
|
|
1163
|
+
exec('echo $SHELL', (error, stdout) => {
|
|
1131
1164
|
if (!error) {
|
|
1132
1165
|
result = stdout.toString().split('\n')[0];
|
|
1133
1166
|
}
|
|
@@ -1149,7 +1182,7 @@ function getUniqueMacAdresses() {
|
|
|
1149
1182
|
const ifaces = os.networkInterfaces();
|
|
1150
1183
|
for (let dev in ifaces) {
|
|
1151
1184
|
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
|
1152
|
-
ifaces[dev].forEach(
|
|
1185
|
+
ifaces[dev].forEach((details) => {
|
|
1153
1186
|
if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
|
|
1154
1187
|
const mac = details.mac.toLowerCase();
|
|
1155
1188
|
if (macs.indexOf(mac) === -1) {
|
|
@@ -1159,7 +1192,7 @@ function getUniqueMacAdresses() {
|
|
|
1159
1192
|
});
|
|
1160
1193
|
}
|
|
1161
1194
|
}
|
|
1162
|
-
macs = macs.sort(
|
|
1195
|
+
macs = macs.sort((a, b) => {
|
|
1163
1196
|
if (a < b) {
|
|
1164
1197
|
return -1;
|
|
1165
1198
|
}
|
|
@@ -1168,7 +1201,7 @@ function getUniqueMacAdresses() {
|
|
|
1168
1201
|
}
|
|
1169
1202
|
return 0;
|
|
1170
1203
|
});
|
|
1171
|
-
} catch
|
|
1204
|
+
} catch {
|
|
1172
1205
|
macs.push('00:00:00:00:00:00');
|
|
1173
1206
|
}
|
|
1174
1207
|
return macs;
|
|
@@ -1185,7 +1218,7 @@ function uuid(callback) {
|
|
|
1185
1218
|
let parts;
|
|
1186
1219
|
|
|
1187
1220
|
if (_darwin) {
|
|
1188
|
-
exec('system_profiler SPHardwareDataType -json',
|
|
1221
|
+
exec('system_profiler SPHardwareDataType -json', (error, stdout) => {
|
|
1189
1222
|
if (!error) {
|
|
1190
1223
|
try {
|
|
1191
1224
|
const jsonObj = JSON.parse(stdout.toString());
|
|
@@ -1194,7 +1227,7 @@ function uuid(callback) {
|
|
|
1194
1227
|
result.os = spHardware.platform_UUID.toLowerCase();
|
|
1195
1228
|
result.hardware = spHardware.serial_number;
|
|
1196
1229
|
}
|
|
1197
|
-
} catch
|
|
1230
|
+
} catch {
|
|
1198
1231
|
util.noop();
|
|
1199
1232
|
}
|
|
1200
1233
|
}
|
|
@@ -1208,7 +1241,7 @@ function uuid(callback) {
|
|
|
1208
1241
|
const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null ||
|
|
1209
1242
|
cat /etc/machine-id 2> /dev/null; echo;
|
|
1210
1243
|
echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
1211
|
-
exec(cmd,
|
|
1244
|
+
exec(cmd, (error, stdout) => {
|
|
1212
1245
|
const lines = stdout.toString().split('\n');
|
|
1213
1246
|
result.os = util.getValue(lines, 'os').toLowerCase();
|
|
1214
1247
|
result.hardware = util.getValue(lines, 'hardware').toLowerCase();
|
|
@@ -1224,7 +1257,7 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
|
1224
1257
|
});
|
|
1225
1258
|
}
|
|
1226
1259
|
if (_freebsd || _openbsd || _netbsd) {
|
|
1227
|
-
exec('sysctl -i kern.hostid kern.hostuuid',
|
|
1260
|
+
exec('sysctl -i kern.hostid kern.hostuuid', (error, stdout) => {
|
|
1228
1261
|
const lines = stdout.toString().split('\n');
|
|
1229
1262
|
result.hardware = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
|
1230
1263
|
result.os = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
|
@@ -1248,7 +1281,7 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
|
1248
1281
|
util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
|
|
1249
1282
|
let lines = stdout.split('\r\n');
|
|
1250
1283
|
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
|
1251
|
-
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin,
|
|
1284
|
+
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, (error, stdout) => {
|
|
1252
1285
|
parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
|
|
1253
1286
|
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/gi, '').toLowerCase() : '';
|
|
1254
1287
|
if (callback) {
|