diff --git a/CHANGELOG.md b/CHANGELOG.md index 46da7c2..3247877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.12.0 | 2019-06-19 | `networkInterface()` added property virtual | | 4.11.6 | 2019-06-19 | `util` bug fix | | 4.11.5 | 2019-06-19 | `dockerAll()` bug fix | | 4.11.4 | 2019-06-17 | type definitions bug fix | diff --git a/README.md b/README.md index 08b6331..b128d1a 100644 --- a/README.md +++ b/README.md @@ -357,7 +357,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] ( | Function | Result object | Linux | BSD | Mac | Win | Sun | Comments | | --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- | | si.diskLayout(cb) | [{...}] | X | | X | X | | physical disk layout (array) | -| | [0].type | X | | X | | | e.g. /dev/sda | +| | [0].device | X | | X | | | e.g. /dev/sda | | | [0].type | X | | X | X | | HD, SSD, NVMe | | | [0].name | X | | X | X | | disk name | | | [0].vendor | X | | | X | | vendor/producer | @@ -425,6 +425,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] ( | | [0].ip6 | X | X | X | X | X | ip6 address | | | [0].mac | X | X | X | X | X | MAC address | | | [0].internal | X | X | X | X | X | true if internal interface | +| | [0].virtual | X | X | X | X | X | true if virtual interface | | | [0].operstate | X | | X | X | | up / down | | | [0].type | X | | X | X | | wireless / wired | | | [0].duplex | X | | X | | | duplex | diff --git a/docs/history.html b/docs/history.html index 1ba3c42..1c58798 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.12.0 + 2019-06-21 + networkInterface() added property virtual + 4.11.6 2019-06-19 diff --git a/docs/index.html b/docs/index.html index 80479df..4493ab7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.11.6
+
Current Version: 4.12.0
@@ -199,7 +199,7 @@
Downloads last month
-
163
+
164
Dependends
diff --git a/docs/network.html b/docs/network.html index 09d1bdc..c6a34e5 100644 --- a/docs/network.html +++ b/docs/network.html @@ -135,6 +135,16 @@ X true if internal interface + + + [0].virtual + X + X + X + X + X + true if virtual interface + [0].operstate diff --git a/lib/index.d.ts b/lib/index.d.ts index b6f43a2..d4df0f7 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -306,6 +306,7 @@ export namespace Systeminformation { ip6: string; mac: string; internal: boolean; + virtual: boolean; operstate: string; type: string; duplex: string; diff --git a/lib/network.js b/lib/network.js index 54a96c7..1eb6314 100644 --- a/lib/network.js +++ b/lib/network.js @@ -264,6 +264,10 @@ function getDarwinNics() { } } +function testVirtualNic(iface, ifaceName, mac) { + const virtualMacs = ['00:03:FF', '00:05:69', '00:0C:29', '00:0F:4B', '00:0F:4B', '00:13:07', '00:13:BE', '00:15:5d', '00:16:3E', '00:1C:42', '00:21:F6', '00:21:F6', '00:24:0B', '00:24:0B', '00:50:56', '00:A0:B1', '00:E0:C8', '08:00:27', '0A:00:27', '18:92:2C', '3C:F3:92', '54:52:00', 'FC:15:97'] + return virtualMacs.indexOf(mac.toUpperCase()) > -1 || iface.toLowerCase().indexOf(' virtual ') > -1 || ifaceName.toLowerCase().indexOf(' virtual ') > -1 || ifaceName.toLowerCase().indexOf('vethernet ') > -1 || ifaceName.toLowerCase().indexOf('vethernet ') > -1; +} function networkInterfaces(callback) { @@ -397,6 +401,7 @@ function networkInterfaces(callback) { }); } let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : null; + const virtual = testVirtualNic(dev, ifaceName, mac); result.push({ iface: dev, ifaceName, @@ -404,6 +409,7 @@ function networkInterfaces(callback) { ip6, mac, internal, + virtual, operstate, type, duplex, @@ -716,7 +722,7 @@ function networkConnections(callback) { if (_linux || _freebsd || _openbsd || _netbsd) { let cmd = 'netstat -tuna | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"'; if (_freebsd || _openbsd || _netbsd) cmd = 'netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"'; - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { let lines = stdout.toString().split('\n'); lines.forEach(function (line) { @@ -758,7 +764,7 @@ function networkConnections(callback) { resolve(result); } else { cmd = 'ss -tuna | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"'; - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { let lines = stdout.toString().split('\n'); @@ -807,7 +813,7 @@ function networkConnections(callback) { } if (_darwin) { let cmd = 'netstat -nat | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"'; - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { let lines = stdout.toString().split('\n'); diff --git a/lib/processes.js b/lib/processes.js index fc9038a..d3a177b 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -117,7 +117,7 @@ function services(srv, callback) { } let comm = (_darwin) ? 'ps -caxo pcpu,pmem,pid,command' : 'ps -axo pcpu,pmem,pid,command'; if (srv !== '' && srvs.length > 0) { - exec(comm + ' | grep -v grep | grep -iE "' + srv + '"', { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(comm + ' | grep -v grep | grep -iE "' + srv + '"', { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { let lines = stdout.toString().replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); srvs.forEach(function (srv) { @@ -158,7 +158,7 @@ function services(srv, callback) { cmd += (';cat /proc/' + result[i].pids[j] + '/stat'); } } - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { let curr_processes = stdout.toString().split('\n'); // first line (all - /proc/stat) @@ -208,7 +208,7 @@ function services(srv, callback) { resolve(result); } } else { - exec('ps -o comm | grep -v grep | egrep "' + srv + '"', { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec('ps -o comm | grep -v grep | egrep "' + srv + '"', { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { let lines = stdout.toString().replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); srvs.forEach(function (srv) { @@ -566,7 +566,7 @@ function processes(callback) { if (_freebsd || _openbsd || _netbsd) cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,lstart,state,tty,user,command; unset LC_ALL'; if (_darwin) cmd = 'export LC_ALL=C; ps -acxo pid,ppid,pcpu,pmem,pri,vsz,rss,nice,lstart,state,tty,user,command -r; unset LC_ALL'; if (_sunos) cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm'; - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { result.list = parseProcesses(stdout.toString().split('\n')); result.all = result.list.length; @@ -586,7 +586,7 @@ function processes(callback) { for (let i = 0; i < result.list.length; i++) { cmd += (';cat /proc/' + result.list[i].pid + '/stat'); } - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { let curr_processes = stdout.toString().split('\n'); // first line (all - /proc/stat) @@ -637,7 +637,7 @@ function processes(callback) { if (_sunos) { cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm'; } - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { let lines = stdout.toString().split('\n'); lines.shift(); @@ -868,7 +868,7 @@ function processLoad(proc, callback) { } if (_darwin || _linux) { - exec('ps -axo pid,pcpu,pmem,comm | grep -i ' + proc + ' | grep -v grep', { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec('ps -axo pid,pcpu,pmem,comm | grep -i ' + proc + ' | grep -v grep', { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { let lines = stdout.toString().split('\n'); @@ -901,7 +901,7 @@ function processLoad(proc, callback) { cmd += (';cat /proc/' + result.pids[i] + '/stat'); } - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { let curr_processes = stdout.toString().split('\n'); // first line (all - /proc/stat) diff --git a/lib/util.js b/lib/util.js index d4a2833..56646db 100644 --- a/lib/util.js +++ b/lib/util.js @@ -35,7 +35,7 @@ let codepage = ''; const execOptsWin = { windowsHide: true, - maxBuffer: 1024 * 2000, + maxBuffer: 1024 * 20000, encoding: 'UTF-8', env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' }) }; diff --git a/lib/wifi.js b/lib/wifi.js index 092a916..44f895a 100644 --- a/lib/wifi.js +++ b/lib/wifi.js @@ -118,7 +118,7 @@ function wifiNetworks(callback) { let result = []; if (_linux) { let cmd = 'nmcli --terse --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list'; - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { const parts = stdout.toString().split('ACTIVE:'); parts.shift(); @@ -151,7 +151,7 @@ function wifiNetworks(callback) { }); } else if (_darwin) { let cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s'; - exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { const lines = stdout.toString().split(os.EOL); if (lines && lines.length > 1) { const parsedhead = util.parseHead(lines[0], 1);