networkConnections() fix (windows)
This commit is contained in:
parent
c242237019
commit
a5b1d1dde4
@ -1189,7 +1189,7 @@ function networkStatsSingle(iface) {
|
|||||||
if (sections[i].trim() !== '') {
|
if (sections[i].trim() !== '') {
|
||||||
let lines = sections[i].trim().split('\r\n');
|
let lines = sections[i].trim().split('\r\n');
|
||||||
perfData.push({
|
perfData.push({
|
||||||
name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase(),
|
name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace(/\#|\//g, '_').toLowerCase(),
|
||||||
rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', ':'), 10),
|
rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', ':'), 10),
|
||||||
rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', ':'), 10),
|
rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', ':'), 10),
|
||||||
rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', ':'), 10),
|
rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', ':'), 10),
|
||||||
@ -1340,8 +1340,8 @@ function networkStatsSingle(iface) {
|
|||||||
det.mac.toLowerCase() === ifaceSanitized.toLowerCase() ||
|
det.mac.toLowerCase() === ifaceSanitized.toLowerCase() ||
|
||||||
det.ip4.toLowerCase() === ifaceSanitized.toLowerCase() ||
|
det.ip4.toLowerCase() === ifaceSanitized.toLowerCase() ||
|
||||||
det.ip6.toLowerCase() === ifaceSanitized.toLowerCase() ||
|
det.ip6.toLowerCase() === ifaceSanitized.toLowerCase() ||
|
||||||
det.ifaceName.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase() === ifaceSanitized.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase()) &&
|
det.ifaceName.replace(/[()[\] ]+/g, '').replace(/\#|\//g, '_').toLowerCase() === ifaceSanitized.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase()) &&
|
||||||
(det.ifaceName.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase() === detail.name)) {
|
(det.ifaceName.replace(/[()[\] ]+/g, '').replace(/\#|\//g, '_').toLowerCase() === detail.name)) {
|
||||||
ifaceName = det.iface;
|
ifaceName = det.iface;
|
||||||
rx_bytes = detail.rx_bytes;
|
rx_bytes = detail.rx_bytes;
|
||||||
rx_dropped = detail.rx_dropped;
|
rx_dropped = detail.rx_dropped;
|
||||||
@ -1558,6 +1558,7 @@ function networkConnections(callback) {
|
|||||||
localaddress.pop();
|
localaddress.pop();
|
||||||
localip = localaddress.join(':');
|
localip = localaddress.join(':');
|
||||||
}
|
}
|
||||||
|
localip = localip.replace(/\[/g, '').replace(/\]/g, '');
|
||||||
let peerip = line[2];
|
let peerip = line[2];
|
||||||
let peerport = '';
|
let peerport = '';
|
||||||
let peeraddress = line[2].split(':');
|
let peeraddress = line[2].split(':');
|
||||||
@ -1566,6 +1567,7 @@ function networkConnections(callback) {
|
|||||||
peeraddress.pop();
|
peeraddress.pop();
|
||||||
peerip = peeraddress.join(':');
|
peerip = peeraddress.join(':');
|
||||||
}
|
}
|
||||||
|
peerip = peerip.replace(/\[/g, '').replace(/\]/g, '');
|
||||||
let pid = util.toInt(line[4]);
|
let pid = util.toInt(line[4]);
|
||||||
let connstate = line[3];
|
let connstate = line[3];
|
||||||
if (connstate === 'HERGESTELLT') { connstate = 'ESTABLISHED'; }
|
if (connstate === 'HERGESTELLT') { connstate = 'ESTABLISHED'; }
|
||||||
@ -1578,7 +1580,7 @@ function networkConnections(callback) {
|
|||||||
if (connstate === 'SYN_RECEIVED') { connstate = 'SYN_RECV'; }
|
if (connstate === 'SYN_RECEIVED') { connstate = 'SYN_RECV'; }
|
||||||
if (connstate === 'FIN_WAIT_1') { connstate = 'FIN_WAIT1'; }
|
if (connstate === 'FIN_WAIT_1') { connstate = 'FIN_WAIT1'; }
|
||||||
if (connstate === 'FIN_WAIT_2') { connstate = 'FIN_WAIT2'; }
|
if (connstate === 'FIN_WAIT_2') { connstate = 'FIN_WAIT2'; }
|
||||||
if (connstate) {
|
if (line[0].toLowerCase() !== 'udp' && connstate) {
|
||||||
result.push({
|
result.push({
|
||||||
protocol: line[0].toLowerCase(),
|
protocol: line[0].toLowerCase(),
|
||||||
localAddress: localip,
|
localAddress: localip,
|
||||||
@ -1589,6 +1591,17 @@ function networkConnections(callback) {
|
|||||||
pid,
|
pid,
|
||||||
process: ''
|
process: ''
|
||||||
});
|
});
|
||||||
|
} else if (line[0].toLowerCase() === 'udp') {
|
||||||
|
result.push({
|
||||||
|
protocol: line[0].toLowerCase(),
|
||||||
|
localAddress: localip,
|
||||||
|
localPort: localport,
|
||||||
|
peerAddress: peerip,
|
||||||
|
peerPort: peerport,
|
||||||
|
state: '',
|
||||||
|
pid: line[3],
|
||||||
|
process: ''
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user