systeminformation 5.23.15 → 5.23.16
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 +15 -8
- package/lib/wifi.js +11 -16
- package/package.json +1 -1
package/lib/network.js
CHANGED
|
@@ -1417,9 +1417,10 @@ function getProcessName(processes, pid) {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
});
|
|
1419
1419
|
cmd = cmd.split(' -')[0];
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1420
|
+
cmd = cmd.split(' /')[0];
|
|
1421
|
+
return cmd;
|
|
1422
|
+
// const cmdParts = cmd.split('/');
|
|
1423
|
+
// return cmdParts[cmdParts.length - 1];
|
|
1423
1424
|
}
|
|
1424
1425
|
|
|
1425
1426
|
function networkConnections(callback) {
|
|
@@ -1535,18 +1536,24 @@ function networkConnections(callback) {
|
|
|
1535
1536
|
}
|
|
1536
1537
|
if (_darwin) {
|
|
1537
1538
|
let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
|
|
1538
|
-
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';
|
|
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('|');
|
|
1539
1540
|
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
|
1540
1541
|
if (!error) {
|
|
1541
1542
|
exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) {
|
|
1542
1543
|
let processes = stdout2.toString().split('\n');
|
|
1543
1544
|
processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); }));
|
|
1544
1545
|
let lines = stdout.toString().split('\n');
|
|
1545
|
-
|
|
1546
|
-
|
|
1546
|
+
let pidPos = 8;
|
|
1547
|
+
if (lines[0] !== '') {
|
|
1548
|
+
const lineParts = lines[0].replace(/ +/g, ' ').split(' ');
|
|
1549
|
+
for (let i = 0; i < lineParts.length; i++) {
|
|
1550
|
+
if (states.indexOf(lineParts[i]) >= 0) {
|
|
1551
|
+
pidPos = i + 3;
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1547
1555
|
lines.forEach(function (line) {
|
|
1548
1556
|
line = line.replace(/ +/g, ' ').split(' ');
|
|
1549
|
-
const hasTransferred = line.length >= 19;
|
|
1550
1557
|
if (line.length >= 8) {
|
|
1551
1558
|
let localip = line[3];
|
|
1552
1559
|
let localport = '';
|
|
@@ -1566,7 +1573,7 @@ function networkConnections(callback) {
|
|
|
1566
1573
|
}
|
|
1567
1574
|
const hasState = states.indexOf(line[5]) >= 0;
|
|
1568
1575
|
let connstate = hasState ? line[5] : 'UNKNOWN';
|
|
1569
|
-
let pid = parseInt(line[
|
|
1576
|
+
let pid = parseInt(line[pidPos + (hasState ? 0 : -1)], 10);
|
|
1570
1577
|
if (connstate) {
|
|
1571
1578
|
result.push({
|
|
1572
1579
|
protocol: line[0],
|
package/lib/wifi.js
CHANGED
|
@@ -345,7 +345,7 @@ function getWifiNetworkListIw(iface) {
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
function
|
|
348
|
+
function parseWifiDarwinXX(wifiObj) {
|
|
349
349
|
const result = [];
|
|
350
350
|
if (wifiObj) {
|
|
351
351
|
wifiObj.forEach(function (wifiItem) {
|
|
@@ -397,7 +397,7 @@ function parseWifiDarwin(wifiObj) {
|
|
|
397
397
|
return result;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
function
|
|
400
|
+
function parseWifiDarwin(wifiStr) {
|
|
401
401
|
const result = [];
|
|
402
402
|
try {
|
|
403
403
|
let wifiObj = JSON.parse(wifiStr);
|
|
@@ -417,16 +417,17 @@ function parseWifi2Darwin(wifiStr) {
|
|
|
417
417
|
} else if (sm.startsWith('pairport_security_mode_wpa3')) {
|
|
418
418
|
security.push('WPA3');
|
|
419
419
|
}
|
|
420
|
-
const
|
|
420
|
+
const channel = parseInt(('' + wifiItem.spairport_network_channel).split(' ')[0]) || 0;
|
|
421
|
+
const signalLevel = wifiItem.spairport_signal_noise || null;
|
|
421
422
|
|
|
422
423
|
result.push({
|
|
423
424
|
ssid: wifiItem._name || '',
|
|
424
|
-
bssid:
|
|
425
|
+
bssid: wifiItem.spairport_network_bssid || null,
|
|
425
426
|
mode: wifiItem.spairport_network_phymode,
|
|
426
|
-
channel
|
|
427
|
-
frequency: wifiFrequencyFromChannel(
|
|
428
|
-
signalLevel: null,
|
|
429
|
-
quality:
|
|
427
|
+
channel,
|
|
428
|
+
frequency: wifiFrequencyFromChannel(channel),
|
|
429
|
+
signalLevel: signalLevel ? parseInt(signalLevel, 10) : null,
|
|
430
|
+
quality: wifiQualityFromDB(signalLevel),
|
|
430
431
|
security,
|
|
431
432
|
wpaFlags: [],
|
|
432
433
|
rsnFlags: []
|
|
@@ -500,15 +501,9 @@ function wifiNetworks(callback) {
|
|
|
500
501
|
resolve(result);
|
|
501
502
|
}
|
|
502
503
|
} else if (_darwin) {
|
|
503
|
-
let cmd = '
|
|
504
|
+
let cmd = 'system_profiler SPAirPortDataType -json 2>/dev/null';
|
|
504
505
|
exec(cmd, { maxBuffer: 1024 * 40000 }, function (error, stdout) {
|
|
505
|
-
|
|
506
|
-
const parts = output.split('######');
|
|
507
|
-
if (parts[0]) {
|
|
508
|
-
result = parseWifiDarwin(util.plistParser(parts[0]));
|
|
509
|
-
} else {
|
|
510
|
-
result = parseWifi2Darwin(parts[1]);
|
|
511
|
-
}
|
|
506
|
+
result = parseWifiDarwin(stdout.toString());
|
|
512
507
|
if (callback) {
|
|
513
508
|
callback(result);
|
|
514
509
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.16",
|
|
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)",
|