fix networkConnections()

This commit is contained in:
Sebastian Hildebrandt 2024-12-23 09:39:58 +01:00
parent 8a801aec95
commit 7eb83e2565
6 changed files with 13 additions and 15 deletions

2
2
View File

@ -1,2 +0,0 @@
WARNING: The airport command line tool is deprecated and will be removed in a future release.
For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.

View File

@ -90,7 +90,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.23.16 | 2024-12-13 | `networkConnections()` refactored PID parsing (macOS) |
| 5.23.17 | 2024-12-23 | `wifiConnections()` refactored - Sequoia compatibel (macOS) |
| 5.23.16 | 2024-12-22 | `networkConnections()` refactored PID parsing (macOS) |
| 5.23.15 | 2024-12-21 | `users()`, `wifiNetworks()` fixed parsing (macOS Seguoia) |
| 5.23.14 | 2024-12-18 | `chassis()` new chassis detection (macOS) |
| 5.23.13 | 2024-12-14 | `wifiConnections()` improved BSSID parsing (windows) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.23.17</th>
<td>2024-12-23</td>
<td><span class="code">wifiConnections()</span> refactored - Sequoia compatibel (macOS)</td>
</tr>
<tr>
<th scope="row">5.23.16</th>
<td>2024-12-22</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.23.16</span></div>
<div class="version">New Version: <span id="version">5.23.17</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -1535,7 +1535,7 @@ function networkConnections(callback) {
});
}
if (_darwin) {
let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
let cmd = 'netstat -natvln | head -n2; netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
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('|');
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
if (!error) {
@ -1543,15 +1543,9 @@ function networkConnections(callback) {
let processes = stdout2.toString().split('\n');
processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); }));
let lines = stdout.toString().split('\n');
let pidPos = 8;
if (lines[0] !== '') {
const lineParts = lines[0].replace(/ +/g, ' ').split(' ');
for (let i = 0; i < lineParts.length; i++) {
if (states.indexOf(lineParts[i]) >= 0) {
pidPos = i + 3;
}
};
}
lines.shift();
const header = lines.shift().replace(/ Address/g, '_Address').replace(/ +/g, ' ').split(' ');
let pidPos = header.indexOf('pid');
lines.forEach(function (line) {
line = line.replace(/ +/g, ' ').split(' ');
if (line.length >= 8) {

View File

@ -176,7 +176,7 @@ function ifaceListLinux() {
}
function nmiDeviceLinux(iface) {
const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2>/dev/null`;
const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2> /dev/null`;
try {
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
const ssid = util.getValue(lines, 'GENERAL.CONNECTION');