systeminformation 5.12.14 → 5.13.0
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/README.md +2 -1
- package/lib/cpu.js +1 -1
- package/lib/filesystem.js +1 -1
- package/lib/network.js +64 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -112,6 +112,7 @@ si.cpu()
|
|
|
112
112
|
|
|
113
113
|
(last 7 major and minor version releases)
|
|
114
114
|
|
|
115
|
+
- Version 5.13.0: `networkConnections()` added process name (mac OS)
|
|
115
116
|
- Version 5.12.0: `cpu()` added performance and efficiency cores
|
|
116
117
|
- Version 5.11.0: `networkInterfaces()` added default property and default parameter
|
|
117
118
|
- Version 5.10.0: basic `android` support
|
|
@@ -595,7 +596,7 @@ Full function reference with examples can be found at [https://systeminformation
|
|
|
595
596
|
| | [0].peerPort | X | X | X | X | | peer port |
|
|
596
597
|
| | [0].state | X | X | X | X | | like ESTABLISHED, TIME_WAIT, ... |
|
|
597
598
|
| | [0].pid | X | X | X | X | | process ID |
|
|
598
|
-
| | [0].process | X | X |
|
|
599
|
+
| | [0].process | X | X | X | | | process name |
|
|
599
600
|
| si.inetChecksite(url, cb) | {...} | X | X | X | X | X | response-time (ms) to fetch given URL |
|
|
600
601
|
| | url | X | X | X | X | X | given url |
|
|
601
602
|
| | ok | X | X | X | X | X | status code OK (2xx, 3xx) |
|
package/lib/cpu.js
CHANGED
|
@@ -1088,7 +1088,7 @@ function cpuTemperature(callback) {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
} else if (section === 'pch') {
|
|
1090
1090
|
// chipset temp
|
|
1091
|
-
if (firstPart.indexOf('TEMP') !== -1) {
|
|
1091
|
+
if (firstPart.indexOf('TEMP') !== -1 && !result.chipset) {
|
|
1092
1092
|
result.chipset = parseFloat(temps);
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
package/lib/filesystem.js
CHANGED
|
@@ -339,7 +339,7 @@ function parseBlk(lines) {
|
|
|
339
339
|
'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')),
|
|
340
340
|
'uuid': disk.uuid,
|
|
341
341
|
'label': disk.label,
|
|
342
|
-
'model': disk.model,
|
|
342
|
+
'model': (disk.model || '').trim(),
|
|
343
343
|
'serial': disk.serial,
|
|
344
344
|
'removable': disk.rm === '1',
|
|
345
345
|
'protocol': disk.tran,
|
package/lib/network.js
CHANGED
|
@@ -328,7 +328,6 @@ function getWindowsIfaceDNSsuffix(ifaces, ifacename) {
|
|
|
328
328
|
if (!dnsSuffix) { dnsSuffix = ''; }
|
|
329
329
|
return dnsSuffix;
|
|
330
330
|
} catch (error) {
|
|
331
|
-
// console.log('Error getting Connection-specific DNS suffix: ', error.message);
|
|
332
331
|
return 'Unknown';
|
|
333
332
|
}
|
|
334
333
|
}
|
|
@@ -501,7 +500,6 @@ function parseLinesDarwinNics(sections) {
|
|
|
501
500
|
function getDarwinNics() {
|
|
502
501
|
const cmd = '/sbin/ifconfig -v';
|
|
503
502
|
try {
|
|
504
|
-
// console.log('SYNC - Nics darwin 12');
|
|
505
503
|
const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n');
|
|
506
504
|
const nsections = splitSectionsNics(lines);
|
|
507
505
|
return (parseLinesDarwinNics(nsections));
|
|
@@ -620,7 +618,6 @@ function getDarwinIfaceDHCPstatus(iface) {
|
|
|
620
618
|
let result = false;
|
|
621
619
|
const cmd = `ipconfig getpacket "${iface}" 2>/dev/null | grep lease_time;`;
|
|
622
620
|
try {
|
|
623
|
-
// console.log('SYNC - DHCP status darwin 17');
|
|
624
621
|
const lines = execSync(cmd).toString().split('\n');
|
|
625
622
|
if (lines.length && lines[0].startsWith('lease_time')) {
|
|
626
623
|
result = true;
|
|
@@ -1372,6 +1369,22 @@ exports.networkStats = networkStats;
|
|
|
1372
1369
|
// --------------------------
|
|
1373
1370
|
// NET - connections (sockets)
|
|
1374
1371
|
|
|
1372
|
+
function getProcessName(processes, pid) {
|
|
1373
|
+
let cmd = '';
|
|
1374
|
+
processes.forEach(line => {
|
|
1375
|
+
const parts = line.split(' ');
|
|
1376
|
+
const id = parseInt(parts[0], 10) || -1;
|
|
1377
|
+
if (id === pid) {
|
|
1378
|
+
parts.shift();
|
|
1379
|
+
cmd = parts.join(' ').split(':')[0];
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
cmd = cmd.split(' -')[0];
|
|
1383
|
+
// return cmd;
|
|
1384
|
+
const cmdParts = cmd.split('/');
|
|
1385
|
+
return cmdParts[cmdParts.length - 1];
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1375
1388
|
function networkConnections(callback) {
|
|
1376
1389
|
|
|
1377
1390
|
return new Promise((resolve) => {
|
|
@@ -1414,7 +1427,7 @@ function networkConnections(callback) {
|
|
|
1414
1427
|
peerPort: peerport,
|
|
1415
1428
|
state: connstate,
|
|
1416
1429
|
pid: proc[0] && proc[0] !== '-' ? parseInt(proc[0], 10) : null,
|
|
1417
|
-
process: proc[1] ? proc[1].split(' ')[0] : ''
|
|
1430
|
+
process: proc[1] ? proc[1].split(' ')[0].split(':')[0] : ''
|
|
1418
1431
|
});
|
|
1419
1432
|
}
|
|
1420
1433
|
}
|
|
@@ -1456,7 +1469,7 @@ function networkConnections(callback) {
|
|
|
1456
1469
|
if (line.length >= 7 && line[6].indexOf('users:') > -1) {
|
|
1457
1470
|
let proc = line[6].replace('users:(("', '').replace(/"/g, '').split(',');
|
|
1458
1471
|
if (proc.length > 2) {
|
|
1459
|
-
process = proc[0].split(' ')[0];
|
|
1472
|
+
process = proc[0].split(' ')[0].split(':')[0];
|
|
1460
1473
|
pid = parseInt(proc[1], 10);
|
|
1461
1474
|
}
|
|
1462
1475
|
}
|
|
@@ -1484,51 +1497,58 @@ function networkConnections(callback) {
|
|
|
1484
1497
|
});
|
|
1485
1498
|
}
|
|
1486
1499
|
if (_darwin) {
|
|
1487
|
-
let cmd = 'netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"';
|
|
1500
|
+
// let cmd = 'netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"';
|
|
1501
|
+
let cmd = 'netstat -natv | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
|
|
1502
|
+
const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN';
|
|
1488
1503
|
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
|
1489
1504
|
if (!error) {
|
|
1505
|
+
exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) {
|
|
1506
|
+
let processes = stdout2.toString().split('\n');
|
|
1507
|
+
processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); }));
|
|
1508
|
+
let lines = stdout.toString().split('\n');
|
|
1490
1509
|
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
}
|
|
1510
|
+
lines.forEach(function (line) {
|
|
1511
|
+
line = line.replace(/ +/g, ' ').split(' ');
|
|
1512
|
+
if (line.length >= 8) {
|
|
1513
|
+
let localip = line[3];
|
|
1514
|
+
let localport = '';
|
|
1515
|
+
let localaddress = line[3].split('.');
|
|
1516
|
+
if (localaddress.length > 1) {
|
|
1517
|
+
localport = localaddress[localaddress.length - 1];
|
|
1518
|
+
localaddress.pop();
|
|
1519
|
+
localip = localaddress.join('.');
|
|
1520
|
+
}
|
|
1521
|
+
let peerip = line[4];
|
|
1522
|
+
let peerport = '';
|
|
1523
|
+
let peeraddress = line[4].split('.');
|
|
1524
|
+
if (peeraddress.length > 1) {
|
|
1525
|
+
peerport = peeraddress[peeraddress.length - 1];
|
|
1526
|
+
peeraddress.pop();
|
|
1527
|
+
peerip = peeraddress.join('.');
|
|
1528
|
+
}
|
|
1529
|
+
const hasState = states.indexOf(line[5]) >= 0;
|
|
1530
|
+
let connstate = hasState ? line[5] : 'UNKNOWN';
|
|
1531
|
+
let pid = parseInt(line[8 + (hasState ? 0 : -1)], 10);
|
|
1532
|
+
if (connstate) {
|
|
1533
|
+
result.push({
|
|
1534
|
+
protocol: line[0],
|
|
1535
|
+
localAddress: localip,
|
|
1536
|
+
localPort: localport,
|
|
1537
|
+
peerAddress: peerip,
|
|
1538
|
+
peerPort: peerport,
|
|
1539
|
+
state: connstate,
|
|
1540
|
+
pid: pid,
|
|
1541
|
+
process: getProcessName(processes, pid)
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1525
1544
|
}
|
|
1545
|
+
});
|
|
1546
|
+
if (callback) {
|
|
1547
|
+
callback(result);
|
|
1526
1548
|
}
|
|
1549
|
+
resolve(result);
|
|
1527
1550
|
});
|
|
1528
|
-
|
|
1529
|
-
callback(result);
|
|
1530
|
-
}
|
|
1531
|
-
resolve(result);
|
|
1551
|
+
|
|
1532
1552
|
}
|
|
1533
1553
|
});
|
|
1534
1554
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.0",
|
|
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)",
|