networkConnections() refactored PID parsing (macOS)

This commit is contained in:
Sebastian Hildebrandt 2024-12-21 17:47:49 +01:00
parent 93ccfdf3db
commit 1dd534d4cd
4 changed files with 13 additions and 6 deletions

View File

@ -90,6 +90,7 @@ 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.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.16</th>
<td>2024-12-22</td>
<td><span class="code">networkConnections()</span> refactored PID parsing (macOS)</td>
</tr>
<tr>
<th scope="row">5.23.15</th>
<td>2024-12-21</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.15</span></div>
<div class="version">New Version: <span id="version">5.23.16</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

@ -1417,9 +1417,10 @@ function getProcessName(processes, pid) {
}
});
cmd = cmd.split(' -')[0];
// return cmd;
const cmdParts = cmd.split('/');
return cmdParts[cmdParts.length - 1];
cmd = cmd.split(' /')[0];
return cmd;
// const cmdParts = cmd.split('/');
// return cmdParts[cmdParts.length - 1];
}
function networkConnections(callback) {
@ -1546,7 +1547,7 @@ function networkConnections(callback) {
lines.forEach(function (line) {
line = line.replace(/ +/g, ' ').split(' ');
const hasTransferred = line.length >= 19;
const hasTransferred = line.length >= 17;
if (line.length >= 8) {
let localip = line[3];
let localport = '';
@ -1566,7 +1567,7 @@ function networkConnections(callback) {
}
const hasState = states.indexOf(line[5]) >= 0;
let connstate = hasState ? line[5] : 'UNKNOWN';
let pid = parseInt(line[8 + (hasState ? 0 : -1) + (hasTransferred ? 2 : 0)], 10);
let pid = parseInt(line[6 + (hasState ? 0 : -1) + (hasTransferred ? 2 : 0)], 10);
if (connstate) {
result.push({
protocol: line[0],