networkConnections(): added process name (mac OS)
This commit is contained in:
parent
2e1cfb0a68
commit
1001e1e14c
@ -56,6 +56,7 @@ We had to make **several interface changes** to keep systeminformation as consis
|
|||||||
- `graphics()`: extended properties (mac OS)
|
- `graphics()`: extended properties (mac OS)
|
||||||
- `graphics()`: extended nvidia-smi parsing
|
- `graphics()`: extended nvidia-smi parsing
|
||||||
- `networkInterfaces()`: type detection improved (win - wireless)
|
- `networkInterfaces()`: type detection improved (win - wireless)
|
||||||
|
- `networkConnections()`: added process name (mac OS)
|
||||||
- `memLayout()`: extended manufacturer list (decoding)
|
- `memLayout()`: extended manufacturer list (decoding)
|
||||||
- `memLayout()`: added ECC flag
|
- `memLayout()`: added ECC flag
|
||||||
- `osInfo()`: better fqdn (win)
|
- `osInfo()`: better fqdn (win)
|
||||||
@ -80,6 +81,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
||||||
|
| 5.13.0 | 2022-11-17 | `networkConnections()` addedd process name (mac OS) |
|
||||||
| 5.12.15 | 2022-11-16 | `networkConnections()` adapted parsing to reflect also UDP (mac OS) |
|
| 5.12.15 | 2022-11-16 | `networkConnections()` adapted parsing to reflect also UDP (mac OS) |
|
||||||
| 5.12.14 | 2022-11-11 | restored `powershell` compatibility for version 7.3 (windows) |
|
| 5.12.14 | 2022-11-11 | restored `powershell` compatibility for version 7.3 (windows) |
|
||||||
| 5.12.13 | 2022-11-06 | updated docs |
|
| 5.12.13 | 2022-11-06 | updated docs |
|
||||||
|
|||||||
@ -112,6 +112,7 @@ si.cpu()
|
|||||||
|
|
||||||
(last 7 major and minor version releases)
|
(last 7 major and minor version releases)
|
||||||
|
|
||||||
|
- Version 5.13.0: `networkConnections()` added process name (mac OS)
|
||||||
- Version 5.12.0: `cpu()` added performance and efficiency cores
|
- Version 5.12.0: `cpu()` added performance and efficiency cores
|
||||||
- Version 5.11.0: `networkInterfaces()` added default property and default parameter
|
- Version 5.11.0: `networkInterfaces()` added default property and default parameter
|
||||||
- Version 5.10.0: basic `android` support
|
- Version 5.10.0: basic `android` support
|
||||||
@ -595,7 +596,7 @@ Full function reference with examples can be found at [https://systeminformation
|
|||||||
| | [0].peerPort | X | X | X | X | | peer port |
|
| | [0].peerPort | X | X | X | X | | peer port |
|
||||||
| | [0].state | X | X | X | X | | like ESTABLISHED, TIME_WAIT, ... |
|
| | [0].state | X | X | X | X | | like ESTABLISHED, TIME_WAIT, ... |
|
||||||
| | [0].pid | X | X | X | X | | process ID |
|
| | [0].pid | X | X | X | X | | process ID |
|
||||||
| | [0].process | X | X | | | | process name |
|
| | [0].process | X | X | X | | | process name |
|
||||||
| si.inetChecksite(url, cb) | {...} | X | X | X | X | X | response-time (ms) to fetch given URL |
|
| si.inetChecksite(url, cb) | {...} | X | X | X | X | X | response-time (ms) to fetch given URL |
|
||||||
| | url | X | X | X | X | X | given url |
|
| | url | X | X | X | X | X | given url |
|
||||||
| | ok | X | X | X | X | X | status code OK (2xx, 3xx) |
|
| | ok | X | X | X | X | X | status code OK (2xx, 3xx) |
|
||||||
|
|||||||
@ -57,6 +57,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">5.13.0</th>
|
||||||
|
<td>2022-11-17</td>
|
||||||
|
<td><span class="code">networkConnections()</span> added process name (mac OS)</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">5.12.15</th>
|
<th scope="row">5.12.15</th>
|
||||||
<td>2022-11-16</td>
|
<td>2022-11-16</td>
|
||||||
|
|||||||
@ -170,7 +170,7 @@
|
|||||||
<img class="logo" src="assets/logo.png" alt="logo">
|
<img class="logo" src="assets/logo.png" alt="logo">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span> </div>
|
<div class="subtitle"><span id="typed"></span> </div>
|
||||||
<div class="version">New Version: <span id="version">5.12.15</span></div>
|
<div class="version">New Version: <span id="version">5.13.0</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>
|
<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>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
@ -643,7 +643,7 @@ setInterval(function() {
|
|||||||
<td>[0].process</td>
|
<td>[0].process</td>
|
||||||
<td>X</td>
|
<td>X</td>
|
||||||
<td>X</td>
|
<td>X</td>
|
||||||
<td></td>
|
<td>X</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>process name</td>
|
<td>process name</td>
|
||||||
|
|||||||
@ -1088,7 +1088,7 @@ function cpuTemperature(callback) {
|
|||||||
}
|
}
|
||||||
} else if (section === 'pch') {
|
} else if (section === 'pch') {
|
||||||
// chipset temp
|
// chipset temp
|
||||||
if (firstPart.indexOf('TEMP') !== -1) {
|
if (firstPart.indexOf('TEMP') !== -1 && !result.chipset) {
|
||||||
result.chipset = parseFloat(temps);
|
result.chipset = parseFloat(temps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -339,7 +339,7 @@ function parseBlk(lines) {
|
|||||||
'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')),
|
'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')),
|
||||||
'uuid': disk.uuid,
|
'uuid': disk.uuid,
|
||||||
'label': disk.label,
|
'label': disk.label,
|
||||||
'model': disk.model,
|
'model': (disk.model || '').trim(),
|
||||||
'serial': disk.serial,
|
'serial': disk.serial,
|
||||||
'removable': disk.rm === '1',
|
'removable': disk.rm === '1',
|
||||||
'protocol': disk.tran,
|
'protocol': disk.tran,
|
||||||
|
|||||||
@ -1369,6 +1369,22 @@ exports.networkStats = networkStats;
|
|||||||
// --------------------------
|
// --------------------------
|
||||||
// NET - connections (sockets)
|
// NET - connections (sockets)
|
||||||
|
|
||||||
|
function getProcessName(processes, pid) {
|
||||||
|
let cmd = '';
|
||||||
|
processes.forEach(line => {
|
||||||
|
const parts = line.split(' ');
|
||||||
|
const id = parseInt(parts[0], 10) || -1;
|
||||||
|
if (id === pid) {
|
||||||
|
parts.shift();
|
||||||
|
cmd = parts.join(' ').split(':')[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cmd = cmd.split(' -')[0];
|
||||||
|
// return cmd;
|
||||||
|
const cmdParts = cmd.split('/');
|
||||||
|
return cmdParts[cmdParts.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
function networkConnections(callback) {
|
function networkConnections(callback) {
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@ -1411,7 +1427,7 @@ function networkConnections(callback) {
|
|||||||
peerPort: peerport,
|
peerPort: peerport,
|
||||||
state: connstate,
|
state: connstate,
|
||||||
pid: proc[0] && proc[0] !== '-' ? parseInt(proc[0], 10) : null,
|
pid: proc[0] && proc[0] !== '-' ? parseInt(proc[0], 10) : null,
|
||||||
process: proc[1] ? proc[1].split(' ')[0] : ''
|
process: proc[1] ? proc[1].split(' ')[0].split(':')[0] : ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1453,7 +1469,7 @@ function networkConnections(callback) {
|
|||||||
if (line.length >= 7 && line[6].indexOf('users:') > -1) {
|
if (line.length >= 7 && line[6].indexOf('users:') > -1) {
|
||||||
let proc = line[6].replace('users:(("', '').replace(/"/g, '').split(',');
|
let proc = line[6].replace('users:(("', '').replace(/"/g, '').split(',');
|
||||||
if (proc.length > 2) {
|
if (proc.length > 2) {
|
||||||
process = proc[0].split(' ')[0];
|
process = proc[0].split(' ')[0].split(':')[0];
|
||||||
pid = parseInt(proc[1], 10);
|
pid = parseInt(proc[1], 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1486,7 +1502,9 @@ function networkConnections(callback) {
|
|||||||
const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN';
|
const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN';
|
||||||
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) {
|
||||||
|
let processes = stdout2.toString().split('\n');
|
||||||
|
processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); }));
|
||||||
let lines = stdout.toString().split('\n');
|
let lines = stdout.toString().split('\n');
|
||||||
|
|
||||||
lines.forEach(function (line) {
|
lines.forEach(function (line) {
|
||||||
@ -1520,7 +1538,7 @@ function networkConnections(callback) {
|
|||||||
peerPort: peerport,
|
peerPort: peerport,
|
||||||
state: connstate,
|
state: connstate,
|
||||||
pid: pid,
|
pid: pid,
|
||||||
process: ''
|
process: getProcessName(processes, pid)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1529,6 +1547,8 @@ function networkConnections(callback) {
|
|||||||
callback(result);
|
callback(result);
|
||||||
}
|
}
|
||||||
resolve(result);
|
resolve(result);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user