systeminformation 5.17.15 → 5.17.17
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/lib/osinfo.js +13 -7
- package/lib/usb.js +18 -2
- package/lib/util.js +6 -6
- package/package.json +1 -1
package/lib/osinfo.js
CHANGED
|
@@ -168,15 +168,21 @@ function getFQDN() {
|
|
|
168
168
|
let fqdn = os.hostname;
|
|
169
169
|
if (_linux || _darwin) {
|
|
170
170
|
try {
|
|
171
|
-
const stdout = execSync('
|
|
172
|
-
|
|
171
|
+
const stdout = execSync('hostnamectl --json short 2>/dev/null');
|
|
172
|
+
const json = JSON.parse(stdout.toString());
|
|
173
|
+
|
|
174
|
+
fqdn = json['StaticHostname'];
|
|
173
175
|
} catch (e) {
|
|
174
|
-
|
|
176
|
+
try {
|
|
177
|
+
const stdout = execSync('hostname -f 2>/dev/null');
|
|
178
|
+
fqdn = stdout.toString().split(os.EOL)[0];
|
|
179
|
+
} catch (e) {
|
|
180
|
+
util.noop();
|
|
181
|
+
}
|
|
175
182
|
}
|
|
176
|
-
}
|
|
177
|
-
if (_freebsd || _openbsd || _netbsd) {
|
|
183
|
+
} if (_freebsd || _openbsd || _netbsd) {
|
|
178
184
|
try {
|
|
179
|
-
const stdout = execSync('hostname');
|
|
185
|
+
const stdout = execSync('hostname 2>/dev/null');
|
|
180
186
|
fqdn = stdout.toString().split(os.EOL)[0];
|
|
181
187
|
} catch (e) {
|
|
182
188
|
util.noop();
|
|
@@ -1053,7 +1059,7 @@ function getUniqueMacAdresses() {
|
|
|
1053
1059
|
for (let dev in ifaces) {
|
|
1054
1060
|
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
|
1055
1061
|
ifaces[dev].forEach(function (details) {
|
|
1056
|
-
if (details
|
|
1062
|
+
if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
|
|
1057
1063
|
const mac = details.mac.toLowerCase();
|
|
1058
1064
|
if (macs.indexOf(mac) === -1) {
|
|
1059
1065
|
macs.push(mac);
|
package/lib/usb.js
CHANGED
|
@@ -125,20 +125,36 @@ function parseDarwinUsb(usb, id) {
|
|
|
125
125
|
if (lines[i] !== '{' && lines[i] !== '}' && lines[i + 1] && lines[i + 1].trim() !== '}') {
|
|
126
126
|
lines[i] = lines[i] + ',';
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
lines[i] = lines[i].replace(':Yes,', ':"Yes",');
|
|
128
130
|
lines[i] = lines[i].replace(': Yes,', ': "Yes",');
|
|
131
|
+
lines[i] = lines[i].replace(': Yes', ': "Yes"');
|
|
132
|
+
lines[i] = lines[i].replace(':No,', ':"No",');
|
|
129
133
|
lines[i] = lines[i].replace(': No,', ': "No",');
|
|
134
|
+
lines[i] = lines[i].replace(': No', ': "No"');
|
|
135
|
+
|
|
136
|
+
// In this case (("com.apple.developer.driverkit.transport.usb"))
|
|
137
|
+
lines[i] = lines[i].replace('((', '').replace('))', '');
|
|
138
|
+
|
|
139
|
+
// In case we have <923c11> we need make it "<923c11>" for correct JSON parse
|
|
140
|
+
const match = /<(\w+)>/.exec(lines[i]);
|
|
141
|
+
if (match) {
|
|
142
|
+
const number = match[0];
|
|
143
|
+
lines[i] = lines[i].replace(number, `"${number}"`);
|
|
144
|
+
}
|
|
130
145
|
}
|
|
131
146
|
const usbObj = JSON.parse(lines.join('\n'));
|
|
132
|
-
const removableDrive = usbObj['Built-In'].toLowerCase() !== 'yes' && usbObj['non-removable'].toLowerCase() === 'no';
|
|
147
|
+
const removableDrive = (usbObj['Built-In'] ? usbObj['Built-In'].toLowerCase() !== 'yes' : true) && (usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() === 'no' : true);
|
|
133
148
|
|
|
134
149
|
result.bus = null;
|
|
135
150
|
result.deviceId = null;
|
|
136
151
|
result.id = usbObj['USB Address'] || null;
|
|
137
152
|
result.name = usbObj['kUSBProductString'] || usbObj['USB Product Name'] || null;
|
|
138
153
|
result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : ''));
|
|
139
|
-
result.removable = usbObj['non-removable'].toLowerCase() === 'no';
|
|
154
|
+
result.removable = usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() || '' === 'no' : true;
|
|
140
155
|
result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
|
|
141
156
|
result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
|
|
157
|
+
|
|
142
158
|
result.maxPower = null;
|
|
143
159
|
result.serialNumber = usbObj['kUSBSerialNumberString'] || null;
|
|
144
160
|
|
package/lib/util.js
CHANGED
|
@@ -315,7 +315,7 @@ function getWmic() {
|
|
|
315
315
|
if (!fs.existsSync(wmicPath)) {
|
|
316
316
|
try {
|
|
317
317
|
const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n');
|
|
318
|
-
if (wmicPathArray
|
|
318
|
+
if (wmicPathArray && wmicPathArray.length) {
|
|
319
319
|
wmicPath = wmicPathArray[0];
|
|
320
320
|
} else {
|
|
321
321
|
wmicPath = 'wmic';
|
|
@@ -385,7 +385,7 @@ function powerShellStart() {
|
|
|
385
385
|
encoding: 'UTF-8',
|
|
386
386
|
env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
|
|
387
387
|
});
|
|
388
|
-
if (_psChild
|
|
388
|
+
if (_psChild && _psChild.pid) {
|
|
389
389
|
_psPersistent = true;
|
|
390
390
|
_psChild.stdout.on('data', function (data) {
|
|
391
391
|
_psResult = _psResult + data.toString('utf8');
|
|
@@ -436,7 +436,7 @@ function powerShell(cmd) {
|
|
|
436
436
|
start: new Date()
|
|
437
437
|
});
|
|
438
438
|
try {
|
|
439
|
-
if (_psChild
|
|
439
|
+
if (_psChild && _psChild.pid) {
|
|
440
440
|
_psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL);
|
|
441
441
|
}
|
|
442
442
|
} catch (e) {
|
|
@@ -464,7 +464,7 @@ function powerShell(cmd) {
|
|
|
464
464
|
resolve(result);
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
|
-
if (child
|
|
467
|
+
if (child && child.pid) {
|
|
468
468
|
child.stdout.on('data', function (data) {
|
|
469
469
|
result = result + data.toString('utf8');
|
|
470
470
|
});
|
|
@@ -514,7 +514,7 @@ function execSafe(cmd, args, options) {
|
|
|
514
514
|
resolve(result);
|
|
515
515
|
});
|
|
516
516
|
}
|
|
517
|
-
if (child
|
|
517
|
+
if (child && child.pid) {
|
|
518
518
|
child.stdout.on('data', function (data) {
|
|
519
519
|
result += data.toString();
|
|
520
520
|
});
|
|
@@ -576,7 +576,7 @@ function smartMonToolsInstalled() {
|
|
|
576
576
|
if (_windows) {
|
|
577
577
|
try {
|
|
578
578
|
const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n');
|
|
579
|
-
if (pathArray
|
|
579
|
+
if (pathArray && pathArray.length) {
|
|
580
580
|
_smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0;
|
|
581
581
|
} else {
|
|
582
582
|
_smartMonToolsInstalled = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.17.
|
|
3
|
+
"version": "5.17.17",
|
|
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)",
|