systeminformation 5.23.16 → 5.23.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/network.js +4 -10
- package/lib/wifi.js +54 -77
- package/package.json +1 -1
package/lib/network.js
CHANGED
|
@@ -1535,7 +1535,7 @@ function networkConnections(callback) {
|
|
|
1535
1535
|
});
|
|
1536
1536
|
}
|
|
1537
1537
|
if (_darwin) {
|
|
1538
|
-
let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
|
|
1538
|
+
let cmd = 'netstat -natvln | head -n2; netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
|
|
1539
1539
|
const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT_1|FIN_WAIT2|FIN_WAIT_2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN'.split('|');
|
|
1540
1540
|
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
|
1541
1541
|
if (!error) {
|
|
@@ -1543,15 +1543,9 @@ function networkConnections(callback) {
|
|
|
1543
1543
|
let processes = stdout2.toString().split('\n');
|
|
1544
1544
|
processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); }));
|
|
1545
1545
|
let lines = stdout.toString().split('\n');
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
for (let i = 0; i < lineParts.length; i++) {
|
|
1550
|
-
if (states.indexOf(lineParts[i]) >= 0) {
|
|
1551
|
-
pidPos = i + 3;
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1546
|
+
lines.shift();
|
|
1547
|
+
const header = lines.shift().replace(/ Address/g, '_Address').replace(/ +/g, ' ').split(' ');
|
|
1548
|
+
let pidPos = header.indexOf('pid');
|
|
1555
1549
|
lines.forEach(function (line) {
|
|
1556
1550
|
line = line.replace(/ +/g, ' ').split(' ');
|
|
1557
1551
|
if (line.length >= 8) {
|
package/lib/wifi.js
CHANGED
|
@@ -176,7 +176,7 @@ function ifaceListLinux() {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
function nmiDeviceLinux(iface) {
|
|
179
|
-
const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2
|
|
179
|
+
const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2> /dev/null`;
|
|
180
180
|
try {
|
|
181
181
|
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
182
182
|
const ssid = util.getValue(lines, 'GENERAL.CONNECTION');
|
|
@@ -645,85 +645,62 @@ function wifiConnections(callback) {
|
|
|
645
645
|
}
|
|
646
646
|
resolve(result);
|
|
647
647
|
} else if (_darwin) {
|
|
648
|
-
let cmd = 'system_profiler SPNetworkDataType';
|
|
648
|
+
let cmd = 'system_profiler SPNetworkDataType SPAirPortDataType -xml 2>/dev/null; echo "######" ; ioreg -n AppleBCMWLANSkywalkInterface -r 2>/dev/null';
|
|
649
649
|
exec(cmd, function (error, stdout) {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
const
|
|
653
|
-
const
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
if (parts[1].indexOf(' | {') > 0 && parts[1].indexOf(' | }') > parts[1].indexOf(' | {')) {
|
|
661
|
-
lines3 = parts[1].split(' | {')[1].split(' | }')[0].replace(/ \| /g, '').replace(/"/g, '').split('\n');
|
|
662
|
-
}
|
|
663
|
-
if (lines2.length > 10) {
|
|
664
|
-
const ssid = util.getValue(lines2, 'ssid', ':', true);
|
|
665
|
-
const bssid = util.getValue(lines2, 'bssid', ':', true) || formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true));
|
|
666
|
-
const security = util.getValue(lines2, 'link auth', ':', true);
|
|
667
|
-
const txRate = util.getValue(lines2, 'lastTxRate', ':', true);
|
|
668
|
-
const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0];
|
|
669
|
-
const type = '802.11';
|
|
670
|
-
const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true));
|
|
671
|
-
/// const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
|
|
672
|
-
const signalLevel = rssi;
|
|
673
|
-
if (ssid || bssid) {
|
|
674
|
-
result.push({
|
|
675
|
-
id: 'Wi-Fi',
|
|
676
|
-
iface,
|
|
677
|
-
model,
|
|
678
|
-
ssid,
|
|
679
|
-
bssid,
|
|
680
|
-
channel: util.toInt(channel),
|
|
681
|
-
frequency: channel ? wifiFrequencyFromChannel(channel) : null,
|
|
682
|
-
type,
|
|
683
|
-
security,
|
|
684
|
-
signalLevel,
|
|
685
|
-
quality: wifiQualityFromDB(signalLevel),
|
|
686
|
-
txRate
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
if (lines3.length > 10) {
|
|
691
|
-
const ssid = util.getValue(lines3, 'IO80211SSID', '=', true);
|
|
692
|
-
const bssid = formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true));
|
|
693
|
-
const security = '';
|
|
694
|
-
const txRate = -1;
|
|
695
|
-
const signalLevel = -1;
|
|
696
|
-
const quality = -1;
|
|
697
|
-
const channel = util.getValue(lines3, 'IO80211Channel', '=', true);
|
|
698
|
-
const type = '802.11';
|
|
699
|
-
if ((ssid || bssid) && !result.length) {
|
|
700
|
-
result.push({
|
|
701
|
-
id: 'Wi-Fi',
|
|
702
|
-
iface,
|
|
703
|
-
model,
|
|
704
|
-
ssid,
|
|
705
|
-
bssid,
|
|
706
|
-
channel: util.toInt(channel),
|
|
707
|
-
frequency: channel ? wifiFrequencyFromChannel(channel) : null,
|
|
708
|
-
type,
|
|
709
|
-
security,
|
|
710
|
-
signalLevel,
|
|
711
|
-
quality,
|
|
712
|
-
txRate
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
if (callback) {
|
|
717
|
-
callback(result);
|
|
718
|
-
}
|
|
719
|
-
resolve(result);
|
|
720
|
-
});
|
|
721
|
-
} else {
|
|
722
|
-
if (callback) {
|
|
723
|
-
callback(result);
|
|
650
|
+
try {
|
|
651
|
+
const parts = stdout.toString().split('######');
|
|
652
|
+
const profilerObj = util.plistParser(parts[0]);
|
|
653
|
+
const networkObj = profilerObj[0]._SPCommandLineArguments.indexOf('SPNetworkDataType') >= 0 ? profilerObj[0]._items : profilerObj[1]._items;
|
|
654
|
+
const airportObj = profilerObj[0]._SPCommandLineArguments.indexOf('SPAirPortDataType') >= 0 ? profilerObj[0]._items[0].spairport_airport_interfaces : profilerObj[1]._items[0].spairport_airport_interfaces;
|
|
655
|
+
|
|
656
|
+
// parts[1] : ioreg
|
|
657
|
+
let lines3 = [];
|
|
658
|
+
if (parts[1].indexOf(' | {') > 0 && parts[1].indexOf(' | }') > parts[1].indexOf(' | {')) {
|
|
659
|
+
lines3 = parts[1].split(' | {')[1].split(' | }')[0].replace(/ \| /g, '').replace(/"/g, '').split('\n');
|
|
724
660
|
}
|
|
725
|
-
|
|
661
|
+
|
|
662
|
+
const networkWifiObj = networkObj.find((item) => { return item._name === 'Wi-Fi'; });
|
|
663
|
+
const airportWifiObj = airportObj[0].spairport_current_network_information;
|
|
664
|
+
|
|
665
|
+
const channel = parseInt(('' + airportWifiObj.spairport_network_channel).split(' ')[0]) || 0;
|
|
666
|
+
const signalLevel = airportWifiObj.spairport_signal_noise || null;
|
|
667
|
+
|
|
668
|
+
let security = [];
|
|
669
|
+
const sm = airportWifiObj.spairport_security_mode;
|
|
670
|
+
if (sm === 'spairport_security_mode_wep') {
|
|
671
|
+
security.push('WEP');
|
|
672
|
+
} else if (sm === 'spairport_security_mode_wpa2_personal') {
|
|
673
|
+
security.push('WPA2');
|
|
674
|
+
} else if (sm.startsWith('spairport_security_mode_wpa2_enterprise')) {
|
|
675
|
+
security.push('WPA2 EAP');
|
|
676
|
+
} else if (sm.startsWith('pairport_security_mode_wpa3_transition')) {
|
|
677
|
+
security.push('WPA2/WPA3');
|
|
678
|
+
} else if (sm.startsWith('pairport_security_mode_wpa3')) {
|
|
679
|
+
security.push('WPA3');
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
result.push({
|
|
683
|
+
id: networkWifiObj._name || 'Wi-Fi',
|
|
684
|
+
iface: networkWifiObj.interface || '',
|
|
685
|
+
model: networkWifiObj.hardware || '',
|
|
686
|
+
ssid: airportWifiObj._name || '',
|
|
687
|
+
bssid: airportWifiObj.spairport_network_bssid || '',
|
|
688
|
+
channel,
|
|
689
|
+
frequency: channel ? wifiFrequencyFromChannel(channel) : null,
|
|
690
|
+
type: airportWifiObj.spairport_network_phymode || '802.11',
|
|
691
|
+
security,
|
|
692
|
+
signalLevel: signalLevel ? parseInt(signalLevel, 10) : null,
|
|
693
|
+
quality: wifiQualityFromDB(signalLevel),
|
|
694
|
+
txRate: airportWifiObj.spairport_network_rate || null,
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
} catch (e) {
|
|
698
|
+
util.noop();
|
|
726
699
|
}
|
|
700
|
+
if (callback) {
|
|
701
|
+
callback(result);
|
|
702
|
+
}
|
|
703
|
+
resolve(result);
|
|
727
704
|
});
|
|
728
705
|
} else if (_windows) {
|
|
729
706
|
let cmd = 'netsh wlan show interfaces';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.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)",
|