systeminformation 5.23.1 → 5.23.3
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 +1 -0
- package/lib/audio.js +1 -1
- package/lib/bluetooth.js +1 -1
- package/lib/cpu.js +2 -2
- package/lib/filesystem.js +4 -4
- package/lib/graphics.js +4 -1
- package/lib/memory.js +3 -3
- package/lib/network.js +10 -10
- package/lib/osinfo.js +2 -2
- package/lib/processes.js +3 -3
- package/lib/system.js +5 -5
- package/lib/usb.js +1 -2
- package/lib/util.js +10 -3
- package/lib/wifi.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,6 +128,7 @@ si.cpu()
|
|
|
128
128
|
|
|
129
129
|
(last 7 major and minor version releases)
|
|
130
130
|
|
|
131
|
+
- Version 5.23.0: `usb()` added serial number (linux)
|
|
131
132
|
- Version 5.22.0: `wifiConnections()` added signal quality
|
|
132
133
|
- Version 5.21.0: `graphics()` added subVendor (linux)
|
|
133
134
|
- Version 5.20.0: `mem()` added writeback and dirty (linux)
|
package/lib/audio.js
CHANGED
|
@@ -59,7 +59,7 @@ function getLinuxAudioPci() {
|
|
|
59
59
|
let cmd = 'lspci -v 2>/dev/null';
|
|
60
60
|
let result = [];
|
|
61
61
|
try {
|
|
62
|
-
const parts = execSync(cmd).toString().split('\n\n');
|
|
62
|
+
const parts = execSync(cmd, util.execOptsLinux).toString().split('\n\n');
|
|
63
63
|
parts.forEach(element => {
|
|
64
64
|
const lines = element.split('\n');
|
|
65
65
|
if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) {
|
package/lib/bluetooth.js
CHANGED
|
@@ -129,7 +129,7 @@ function bluetoothDevices(callback) {
|
|
|
129
129
|
});
|
|
130
130
|
// determine "connected" with hcitool con
|
|
131
131
|
try {
|
|
132
|
-
const hdicon = execSync('hcitool con').toString().toLowerCase();
|
|
132
|
+
const hdicon = execSync('hcitool con', util.execOptsLinux).toString().toLowerCase();
|
|
133
133
|
for (let i = 0; i < result.length; i++) {
|
|
134
134
|
if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) {
|
|
135
135
|
result[i].connected = true;
|
package/lib/cpu.js
CHANGED
|
@@ -1049,7 +1049,7 @@ function cpuTemperature(callback) {
|
|
|
1049
1049
|
// CPU Chipset, Socket
|
|
1050
1050
|
try {
|
|
1051
1051
|
const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;';
|
|
1052
|
-
const parts = execSync(cmd).toString().split('-----\n');
|
|
1052
|
+
const parts = execSync(cmd, util.execOptsLinux).toString().split('-----\n');
|
|
1053
1053
|
if (parts.length === 2) {
|
|
1054
1054
|
const lines = parts[0].split('\n');
|
|
1055
1055
|
const lines2 = parts[1].split('\n');
|
|
@@ -1605,7 +1605,7 @@ function getLoad() {
|
|
|
1605
1605
|
// linux: try to get other cpu stats
|
|
1606
1606
|
if (_linux) {
|
|
1607
1607
|
try {
|
|
1608
|
-
const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu',
|
|
1608
|
+
const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', util.execOptsLinux).toString().split('\n');
|
|
1609
1609
|
if (lines.length > 1) {
|
|
1610
1610
|
lines.shift();
|
|
1611
1611
|
if (lines.length === cpus.length) {
|
package/lib/filesystem.js
CHANGED
|
@@ -139,7 +139,7 @@ function fsSize(drive, callback) {
|
|
|
139
139
|
if (_linux) {
|
|
140
140
|
try {
|
|
141
141
|
cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL';
|
|
142
|
-
execSync('cat /proc/mounts 2>/dev/null').toString().split('\n').filter(line => {
|
|
142
|
+
execSync('cat /proc/mounts 2>/dev/null', util.execOptsLinux).toString().split('\n').filter(line => {
|
|
143
143
|
return line.startsWith('/');
|
|
144
144
|
}).forEach((line) => {
|
|
145
145
|
osMounts[line.split(' ')[0]] = osMounts[line.split(' ')[0]] || false;
|
|
@@ -426,7 +426,7 @@ function raidMatchLinux(data) {
|
|
|
426
426
|
try {
|
|
427
427
|
data.forEach(element => {
|
|
428
428
|
if (element.type.startsWith('raid')) {
|
|
429
|
-
const lines = execSync(`mdadm --export --detail /dev/${element.name}
|
|
429
|
+
const lines = execSync(`mdadm --export --detail /dev/${element.name}`, util.execOptsLinux).toString().split('\n');
|
|
430
430
|
const mdData = decodeMdabmData(lines);
|
|
431
431
|
|
|
432
432
|
element.label = mdData.label; // <- assign label info
|
|
@@ -1087,7 +1087,7 @@ function diskLayout(callback) {
|
|
|
1087
1087
|
} catch (e) {
|
|
1088
1088
|
// fallback to older version of lsblk
|
|
1089
1089
|
try {
|
|
1090
|
-
const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL').toString();
|
|
1090
|
+
const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString();
|
|
1091
1091
|
let lines = blkStdoutToObject(out2).split('\n');
|
|
1092
1092
|
const data = parseBlk(lines);
|
|
1093
1093
|
devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); });
|
|
@@ -1100,7 +1100,7 @@ function diskLayout(callback) {
|
|
|
1100
1100
|
const BSDName = '/dev/' + device.name;
|
|
1101
1101
|
const logical = device.name;
|
|
1102
1102
|
try {
|
|
1103
|
-
mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null').toString().split('\n')[0];
|
|
1103
|
+
mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null', util.execOptsLinux).toString().split('\n')[0];
|
|
1104
1104
|
} catch (e) {
|
|
1105
1105
|
util.noop();
|
|
1106
1106
|
}
|
package/lib/graphics.js
CHANGED
|
@@ -216,7 +216,7 @@ function graphics(callback) {
|
|
|
216
216
|
// PCI bus IDs
|
|
217
217
|
let pciIDs = [];
|
|
218
218
|
try {
|
|
219
|
-
pciIDs = execSync('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "').toString().split('\n');
|
|
219
|
+
pciIDs = execSync('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "', util.execOptsLinux).toString().split('\n');
|
|
220
220
|
for (let i = 0; i < pciIDs.length; i++) {
|
|
221
221
|
pciIDs[i] = pciIDs[i].replace('Bus Address:', '').replace('0000:', '').trim();
|
|
222
222
|
}
|
|
@@ -421,6 +421,9 @@ function graphics(callback) {
|
|
|
421
421
|
if (nvidiaSmiExe) {
|
|
422
422
|
const nvidiaSmiOpts = '--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits';
|
|
423
423
|
const cmd = nvidiaSmiExe + ' ' + nvidiaSmiOpts + (_linux ? ' 2>/dev/null' : '');
|
|
424
|
+
if (_linux) {
|
|
425
|
+
options.stdio = ['pipe', 'pipe', 'ignore'];
|
|
426
|
+
}
|
|
424
427
|
try {
|
|
425
428
|
const res = execSync(cmd, options).toString();
|
|
426
429
|
return res;
|
package/lib/memory.js
CHANGED
|
@@ -399,7 +399,7 @@ function memLayout(callback) {
|
|
|
399
399
|
|
|
400
400
|
// Try Raspberry PI
|
|
401
401
|
try {
|
|
402
|
-
let stdout = execSync('cat /proc/cpuinfo 2>/dev/null');
|
|
402
|
+
let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux);
|
|
403
403
|
let lines = stdout.toString().split('\n');
|
|
404
404
|
let model = util.getValue(lines, 'hardware', ':', true).toUpperCase();
|
|
405
405
|
let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
|
|
@@ -419,14 +419,14 @@ function memLayout(callback) {
|
|
|
419
419
|
result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
|
|
420
420
|
result[0].formFactor = 'SoC';
|
|
421
421
|
|
|
422
|
-
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
|
|
422
|
+
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux);
|
|
423
423
|
lines = stdout.toString().split('\n');
|
|
424
424
|
let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
|
|
425
425
|
if (freq) {
|
|
426
426
|
result[0].clockSpeed = freq;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null');
|
|
429
|
+
stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux);
|
|
430
430
|
lines = stdout.toString().split('\n');
|
|
431
431
|
let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
|
|
432
432
|
if (voltage) {
|
package/lib/network.js
CHANGED
|
@@ -91,7 +91,7 @@ function getDefaultNetworkInterface() {
|
|
|
91
91
|
}
|
|
92
92
|
if (_linux) {
|
|
93
93
|
let cmd = 'ip route 2> /dev/null | grep default';
|
|
94
|
-
let result = execSync(cmd);
|
|
94
|
+
let result = execSync(cmd, util.execOptsLinux);
|
|
95
95
|
let parts = result.toString().split('\n')[0].split(/\s+/);
|
|
96
96
|
if (parts[0] === 'none' && parts[5]) {
|
|
97
97
|
ifacename = parts[5];
|
|
@@ -130,7 +130,7 @@ function getMacAddresses() {
|
|
|
130
130
|
if (_linux || _freebsd || _openbsd || _netbsd) {
|
|
131
131
|
if (typeof pathToIp === 'undefined') {
|
|
132
132
|
try {
|
|
133
|
-
const lines = execSync('which ip').toString().split('\n');
|
|
133
|
+
const lines = execSync('which ip', util.execOptsLinux).toString().split('\n');
|
|
134
134
|
if (lines.length && lines[0].indexOf(':') === -1 && lines[0].indexOf('/') === 0) {
|
|
135
135
|
pathToIp = lines[0];
|
|
136
136
|
} else {
|
|
@@ -142,7 +142,7 @@ function getMacAddresses() {
|
|
|
142
142
|
}
|
|
143
143
|
try {
|
|
144
144
|
const cmd = 'export LC_ALL=C; ' + ((pathToIp) ? pathToIp + ' link show up' : '/sbin/ifconfig') + '; unset LC_ALL';
|
|
145
|
-
let res = execSync(cmd);
|
|
145
|
+
let res = execSync(cmd, util.execOptsLinux);
|
|
146
146
|
const lines = res.toString().split('\n');
|
|
147
147
|
for (let i = 0; i < lines.length; i++) {
|
|
148
148
|
if (lines[i] && lines[i][0] !== ' ') {
|
|
@@ -511,7 +511,7 @@ function getLinuxIfaceConnectionName(interfaceName) {
|
|
|
511
511
|
const cmd = `nmcli device status 2>/dev/null | grep ${interfaceName}`;
|
|
512
512
|
|
|
513
513
|
try {
|
|
514
|
-
const result = execSync(cmd).toString();
|
|
514
|
+
const result = execSync(cmd, util.execOptsLinux).toString();
|
|
515
515
|
const resultFormat = result.replace(/\s+/g, ' ').trim();
|
|
516
516
|
const connectionNameLines = resultFormat.split(' ').slice(3);
|
|
517
517
|
const connectionName = connectionNameLines.join(' ');
|
|
@@ -525,7 +525,7 @@ function checkLinuxDCHPInterfaces(file) {
|
|
|
525
525
|
let result = [];
|
|
526
526
|
try {
|
|
527
527
|
let cmd = `cat ${file} 2> /dev/null | grep 'iface\\|source'`;
|
|
528
|
-
const lines = execSync(cmd,
|
|
528
|
+
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
529
529
|
|
|
530
530
|
lines.forEach(line => {
|
|
531
531
|
const parts = line.replace(/\s+/g, ' ').trim().split(' ');
|
|
@@ -550,7 +550,7 @@ function getLinuxDHCPNics() {
|
|
|
550
550
|
let cmd = 'ip a 2> /dev/null';
|
|
551
551
|
let result = [];
|
|
552
552
|
try {
|
|
553
|
-
const lines = execSync(cmd,
|
|
553
|
+
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
554
554
|
const nsections = splitSectionsNics(lines);
|
|
555
555
|
result = (parseLinuxDHCPNics(nsections));
|
|
556
556
|
} catch (e) {
|
|
@@ -591,7 +591,7 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) {
|
|
|
591
591
|
if (connectionName) {
|
|
592
592
|
const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.method;`;
|
|
593
593
|
try {
|
|
594
|
-
const lines = execSync(cmd).toString();
|
|
594
|
+
const lines = execSync(cmd, util.execOptsLinux).toString();
|
|
595
595
|
const resultFormat = lines.replace(/\s+/g, ' ').trim();
|
|
596
596
|
|
|
597
597
|
let dhcStatus = resultFormat.split(' ').slice(1).toString();
|
|
@@ -631,7 +631,7 @@ function getLinuxIfaceDNSsuffix(connectionName) {
|
|
|
631
631
|
if (connectionName) {
|
|
632
632
|
const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.dns-search;`;
|
|
633
633
|
try {
|
|
634
|
-
const result = execSync(cmd).toString();
|
|
634
|
+
const result = execSync(cmd, util.execOptsLinux).toString();
|
|
635
635
|
const resultFormat = result.replace(/\s+/g, ' ').trim();
|
|
636
636
|
const dnsSuffix = resultFormat.split(' ').slice(1).toString();
|
|
637
637
|
return dnsSuffix == '--' ? 'Not defined' : dnsSuffix;
|
|
@@ -647,7 +647,7 @@ function getLinuxIfaceIEEE8021xAuth(connectionName) {
|
|
|
647
647
|
if (connectionName) {
|
|
648
648
|
const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep 802-1x.eap;`;
|
|
649
649
|
try {
|
|
650
|
-
const result = execSync(cmd).toString();
|
|
650
|
+
const result = execSync(cmd, util.execOptsLinux).toString();
|
|
651
651
|
const resultFormat = result.replace(/\s+/g, ' ').trim();
|
|
652
652
|
const authenticationProtocol = resultFormat.split(' ').slice(1).toString();
|
|
653
653
|
|
|
@@ -875,7 +875,7 @@ function networkInterfaces(callback, rescan, defaultString) {
|
|
|
875
875
|
|
|
876
876
|
let lines = [];
|
|
877
877
|
try {
|
|
878
|
-
lines = execSync(cmd).toString().split('\n');
|
|
878
|
+
lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
879
879
|
const connectionName = getLinuxIfaceConnectionName(ifaceSanitized);
|
|
880
880
|
dhcp = getLinuxIfaceDHCPstatus(ifaceSanitized, connectionName, _dhcpNics);
|
|
881
881
|
dnsSuffix = getLinuxIfaceDNSsuffix(connectionName);
|
package/lib/osinfo.js
CHANGED
|
@@ -168,13 +168,13 @@ function getFQDN() {
|
|
|
168
168
|
let fqdn = os.hostname;
|
|
169
169
|
if (_linux || _darwin) {
|
|
170
170
|
try {
|
|
171
|
-
const stdout = execSync('hostnamectl --json short 2>/dev/null');
|
|
171
|
+
const stdout = execSync('hostnamectl --json short 2>/dev/null', util.execOptsLinux);
|
|
172
172
|
const json = JSON.parse(stdout.toString());
|
|
173
173
|
|
|
174
174
|
fqdn = json['StaticHostname'];
|
|
175
175
|
} catch (e) {
|
|
176
176
|
try {
|
|
177
|
-
const stdout = execSync('hostname -f 2>/dev/null');
|
|
177
|
+
const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux);
|
|
178
178
|
fqdn = stdout.toString().split(os.EOL)[0];
|
|
179
179
|
} catch (e) {
|
|
180
180
|
util.noop();
|
package/lib/processes.js
CHANGED
|
@@ -152,7 +152,7 @@ function services(srv, callback) {
|
|
|
152
152
|
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
|
153
153
|
if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') {
|
|
154
154
|
try {
|
|
155
|
-
const tmpsrv = execSync('systemctl --all --type=service --no-legend 2> /dev/null').toString().split('\n');
|
|
155
|
+
const tmpsrv = execSync('systemctl --all --type=service --no-legend 2> /dev/null', util.execOptsLinux).toString().split('\n');
|
|
156
156
|
srvs = [];
|
|
157
157
|
for (const s of tmpsrv) {
|
|
158
158
|
const name = s.split('.service')[0];
|
|
@@ -164,7 +164,7 @@ function services(srv, callback) {
|
|
|
164
164
|
} catch (d) {
|
|
165
165
|
try {
|
|
166
166
|
srvString = '';
|
|
167
|
-
const tmpsrv = execSync('service --status-all 2> /dev/null').toString().split('\n');
|
|
167
|
+
const tmpsrv = execSync('service --status-all 2> /dev/null', util.execOptsLinux).toString().split('\n');
|
|
168
168
|
for (const s of tmpsrv) {
|
|
169
169
|
const parts = s.split(']');
|
|
170
170
|
if (parts.length === 2) {
|
|
@@ -174,7 +174,7 @@ function services(srv, callback) {
|
|
|
174
174
|
srvs = srvString.split('|');
|
|
175
175
|
} catch (e) {
|
|
176
176
|
try {
|
|
177
|
-
const srvStr = execSync('ls /etc/init.d/ -m 2> /dev/null').toString().split('\n').join('');
|
|
177
|
+
const srvStr = execSync('ls /etc/init.d/ -m 2> /dev/null', util.execOptsLinux).toString().split('\n').join('');
|
|
178
178
|
srvString = '';
|
|
179
179
|
if (srvStr) {
|
|
180
180
|
const tmpsrv = srvStr.split(',');
|
package/lib/system.js
CHANGED
|
@@ -61,7 +61,7 @@ function system(callback) {
|
|
|
61
61
|
echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo;
|
|
62
62
|
echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;`;
|
|
63
63
|
try {
|
|
64
|
-
lines = execSync(cmd).toString().split('\n');
|
|
64
|
+
lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
65
65
|
result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer;
|
|
66
66
|
result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model;
|
|
67
67
|
result.version = result.version === '' ? util.getValue(lines, 'product_version') : result.version;
|
|
@@ -107,7 +107,7 @@ function system(callback) {
|
|
|
107
107
|
}
|
|
108
108
|
if (!result.virtual) {
|
|
109
109
|
try {
|
|
110
|
-
const disksById = execSync('ls -1 /dev/disk/by-id/ 2>/dev/null').toString();
|
|
110
|
+
const disksById = execSync('ls -1 /dev/disk/by-id/ 2>/dev/null', util.execOptsLinux).toString();
|
|
111
111
|
if (disksById.indexOf('_QEMU_') >= 0) {
|
|
112
112
|
result.virtual = true;
|
|
113
113
|
result.virtualHost = 'QEMU';
|
|
@@ -129,7 +129,7 @@ function system(callback) {
|
|
|
129
129
|
}
|
|
130
130
|
if ((_freebsd || _openbsd || _netbsd) && !result.virtualHost) {
|
|
131
131
|
try {
|
|
132
|
-
const procInfo = execSync('dmidecode -t 4');
|
|
132
|
+
const procInfo = execSync('dmidecode -t 4', util.execOptsLinux);
|
|
133
133
|
const procLines = procInfo.toString().split('\n');
|
|
134
134
|
const procManufacturer = util.getValue(procLines, 'manufacturer', ':', true);
|
|
135
135
|
switch (procManufacturer.toLowerCase()) {
|
|
@@ -371,7 +371,7 @@ function bios(callback) {
|
|
|
371
371
|
echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo;
|
|
372
372
|
echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;`;
|
|
373
373
|
try {
|
|
374
|
-
lines = execSync(cmd).toString().split('\n');
|
|
374
|
+
lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
375
375
|
result.vendor = !result.vendor ? util.getValue(lines, 'bios_vendor') : result.vendor;
|
|
376
376
|
result.version = !result.version ? util.getValue(lines, 'bios_version') : result.version;
|
|
377
377
|
datetime = util.getValue(lines, 'bios_date');
|
|
@@ -485,7 +485,7 @@ function baseboard(callback) {
|
|
|
485
485
|
echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo;
|
|
486
486
|
echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;`;
|
|
487
487
|
try {
|
|
488
|
-
lines = execSync(cmd).toString().split('\n');
|
|
488
|
+
lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
489
489
|
result.manufacturer = !result.manufacturer ? util.getValue(lines, 'board_vendor') : result.manufacturer;
|
|
490
490
|
result.model = !result.model ? util.getValue(lines, 'board_name') : result.model;
|
|
491
491
|
result.version = !result.version ? util.getValue(lines, 'board_version') : result.version;
|
package/lib/usb.js
CHANGED
|
@@ -114,7 +114,6 @@ function getDarwinUsbType(name) {
|
|
|
114
114
|
return result;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
|
|
118
117
|
function parseDarwinUsb(usb, id) {
|
|
119
118
|
const result = {};
|
|
120
119
|
result.id = id;
|
|
@@ -258,7 +257,7 @@ function usb(callback) {
|
|
|
258
257
|
const parts = stdout.toString().split(/\n\s*\n/);
|
|
259
258
|
for (let i = 0; i < parts.length; i++) {
|
|
260
259
|
const usb = parseWindowsUsb(parts[i].split('\n'), i);
|
|
261
|
-
if (usb) {
|
|
260
|
+
if (usb && result.filter(x => x.deviceId === usb.deviceId).length === 0) {
|
|
262
261
|
result.push(usb);
|
|
263
262
|
}
|
|
264
263
|
}
|
package/lib/util.js
CHANGED
|
@@ -55,6 +55,12 @@ const execOptsWin = {
|
|
|
55
55
|
env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' })
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
+
const execOptsLinux = {
|
|
59
|
+
maxBuffer: 1024 * 20000,
|
|
60
|
+
encoding: 'UTF-8',
|
|
61
|
+
stdio: ['pipe', 'pipe', 'ignore']
|
|
62
|
+
};
|
|
63
|
+
|
|
58
64
|
function toInt(value) {
|
|
59
65
|
let result = parseInt(value, 10);
|
|
60
66
|
if (isNaN(result)) {
|
|
@@ -573,7 +579,7 @@ function getCodepage() {
|
|
|
573
579
|
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
|
574
580
|
if (!codepage) {
|
|
575
581
|
try {
|
|
576
|
-
const stdout = execSync('echo $LANG');
|
|
582
|
+
const stdout = execSync('echo $LANG', util.execOptsLinux);
|
|
577
583
|
const lines = stdout.toString().split('\r\n');
|
|
578
584
|
const parts = lines[0].split('.');
|
|
579
585
|
codepage = parts.length > 1 ? parts[1].trim() : '';
|
|
@@ -607,7 +613,7 @@ function smartMonToolsInstalled() {
|
|
|
607
613
|
}
|
|
608
614
|
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
|
609
615
|
try {
|
|
610
|
-
const pathArray = execSync('which smartctl 2>/dev/null',
|
|
616
|
+
const pathArray = execSync('which smartctl 2>/dev/null', execOptsLinux).toString().split('\r\n');
|
|
611
617
|
_smartMonToolsInstalled = pathArray.length > 0;
|
|
612
618
|
} catch (e) {
|
|
613
619
|
util.noop();
|
|
@@ -1146,7 +1152,7 @@ function linuxVersion() {
|
|
|
1146
1152
|
let result = '';
|
|
1147
1153
|
if (_linux) {
|
|
1148
1154
|
try {
|
|
1149
|
-
result = execSync('uname -v').toString();
|
|
1155
|
+
result = execSync('uname -v', util.execOptsLinux).toString();
|
|
1150
1156
|
} catch (e) {
|
|
1151
1157
|
result = '';
|
|
1152
1158
|
}
|
|
@@ -1318,6 +1324,7 @@ function noop() { }
|
|
|
1318
1324
|
exports.toInt = toInt;
|
|
1319
1325
|
exports.splitByNumber = splitByNumber;
|
|
1320
1326
|
exports.execOptsWin = execOptsWin;
|
|
1327
|
+
exports.execOptsLinux = execOptsLinux;
|
|
1321
1328
|
exports.getCodepage = getCodepage;
|
|
1322
1329
|
exports.execWin = execWin;
|
|
1323
1330
|
exports.isFunction = isFunction;
|
package/lib/wifi.js
CHANGED
|
@@ -130,7 +130,7 @@ function ifaceListLinux() {
|
|
|
130
130
|
const result = [];
|
|
131
131
|
const cmd = 'iw dev 2>/dev/null';
|
|
132
132
|
try {
|
|
133
|
-
const all = execSync(cmd).toString().split('\n').map(line => line.trim()).join('\n');
|
|
133
|
+
const all = execSync(cmd, util.execOptsLinux).toString().split('\n').map(line => line.trim()).join('\n');
|
|
134
134
|
const parts = all.split('\nInterface ');
|
|
135
135
|
parts.shift();
|
|
136
136
|
parts.forEach(ifaceDetails => {
|
|
@@ -149,7 +149,7 @@ function ifaceListLinux() {
|
|
|
149
149
|
return result;
|
|
150
150
|
} catch (e) {
|
|
151
151
|
try {
|
|
152
|
-
const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null').toString();
|
|
152
|
+
const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null', util.execOptsLinux).toString();
|
|
153
153
|
const parts = all.split('\n\n');
|
|
154
154
|
let i = 1;
|
|
155
155
|
parts.forEach(ifaceDetails => {
|
|
@@ -178,7 +178,7 @@ function ifaceListLinux() {
|
|
|
178
178
|
function nmiDeviceLinux(iface) {
|
|
179
179
|
const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2>/dev/null`;
|
|
180
180
|
try {
|
|
181
|
-
const lines = execSync(cmd).toString().split('\n');
|
|
181
|
+
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
182
182
|
const ssid = util.getValue(lines, 'GENERAL.CONNECTION');
|
|
183
183
|
return {
|
|
184
184
|
iface,
|
|
@@ -196,7 +196,7 @@ function nmiDeviceLinux(iface) {
|
|
|
196
196
|
function nmiConnectionLinux(ssid) {
|
|
197
197
|
const cmd = `nmcli -t --show-secrets connection show ${ssid} 2>/dev/null`;
|
|
198
198
|
try {
|
|
199
|
-
const lines = execSync(cmd).toString().split('\n');
|
|
199
|
+
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
200
200
|
const bssid = util.getValue(lines, '802-11-wireless.seen-bssids').toLowerCase();
|
|
201
201
|
return {
|
|
202
202
|
ssid: ssid !== '--' ? ssid : null,
|
|
@@ -217,7 +217,7 @@ function wpaConnectionLinux(iface) {
|
|
|
217
217
|
}
|
|
218
218
|
const cmd = `wpa_cli -i ${iface} status 2>&1`;
|
|
219
219
|
try {
|
|
220
|
-
const lines = execSync(cmd).toString().split('\n');
|
|
220
|
+
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
221
221
|
const freq = util.toInt(util.getValue(lines, 'freq', '='));
|
|
222
222
|
return {
|
|
223
223
|
ssid: util.getValue(lines, 'ssid', '='),
|
|
@@ -236,7 +236,7 @@ function getWifiNetworkListNmi() {
|
|
|
236
236
|
const result = [];
|
|
237
237
|
const cmd = 'nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null';
|
|
238
238
|
try {
|
|
239
|
-
const stdout = execSync(cmd,
|
|
239
|
+
const stdout = execSync(cmd, util.execOptsLinux);
|
|
240
240
|
const parts = stdout.toString().split('ACTIVE:');
|
|
241
241
|
parts.shift();
|
|
242
242
|
parts.forEach(part => {
|
|
@@ -270,7 +270,7 @@ function getWifiNetworkListNmi() {
|
|
|
270
270
|
function getWifiNetworkListIw(iface) {
|
|
271
271
|
const result = [];
|
|
272
272
|
try {
|
|
273
|
-
let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL
|
|
273
|
+
let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`, util.execOptsLinux).toString().split(' Cell ');
|
|
274
274
|
if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; }
|
|
275
275
|
if (iwlistParts.length > 1) {
|
|
276
276
|
iwlistParts.shift();
|
|
@@ -404,7 +404,7 @@ function wifiNetworks(callback) {
|
|
|
404
404
|
result = getWifiNetworkListNmi();
|
|
405
405
|
if (result.length === 0) {
|
|
406
406
|
try {
|
|
407
|
-
const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL').toString().split('\n\n');
|
|
407
|
+
const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString().split('\n\n');
|
|
408
408
|
let iface = '';
|
|
409
409
|
iwconfigParts.forEach(element => {
|
|
410
410
|
if (element.indexOf('no wireless') === -1 && element.trim() !== '') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.3",
|
|
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)",
|