diff --git a/docs/changes.html b/docs/changes.html index 374d407..65b6e1d 100644 --- a/docs/changes.html +++ b/docs/changes.html @@ -179,7 +179,7 @@
  • uuid(): added MACs
  • uuid(): better Raspberry Pi hardware ID
  • getData(): support for passing parameters and filters (see section General / getData)
  • -
  • Apple M1 Silicon extended support (now ereything supported exept of cpu temperature)
  • +
  • Apple M1 Silicon extended support (now everything supported except of cpu temperature)
  • updated TypeScript definitions
  • Test full functionality and view Version 5 results

    diff --git a/docs/index.html b/docs/index.html index 4167c2c..8fe9cc1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -201,7 +201,7 @@
    -
    12,898
    +
    13,024
    Lines of code
    @@ -209,7 +209,7 @@
    Downloads last month
    -
    375
    +
    376
    Dependents
    diff --git a/lib/wifi.js b/lib/wifi.js index 0f28df1..21a4d98 100644 --- a/lib/wifi.js +++ b/lib/wifi.js @@ -154,8 +154,8 @@ function wifiNetworks(callback) { iface = iwconfigParts[i].split(' ')[0]; } } - if (iface()) { - let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} sscan 2>/dev/null; unset LC_ALL`).toString().split(' Cell '); + if (iface) { + let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>/dev/null; unset LC_ALL`).toString().split(' Cell '); if (iwlistParts.length > 1) { iwlistParts.shift(); for (let i = 0; i < iwlistParts.length; i++) { @@ -180,7 +180,7 @@ function wifiNetworks(callback) { let wpaFlag = ''; lines.forEach(function (line) { const l = line.trim().toLowerCase(); - if (l.indexOf('group cipher')) { + if (l.indexOf('group cipher') >= 0) { if (wpaFlag) { wpaFlags.push(wpaFlag); } @@ -189,19 +189,19 @@ function wifiNetworks(callback) { wpaFlag = parts[1].trim(); } } - if (l.indexOf('pairwise cipher')) { + if (l.indexOf('pairwise cipher') >= 0) { const parts = l.split(':'); if (parts.length > 1) { - if (parts[i].indexOf('tkip')) { wpaFlag = wpaFlag ? 'TKIP/' + wpaFlag : 'TKIP'; } - else if (parts[i].indexOf('ccmp')) { wpaFlag = wpaFlag ? 'CCMP/' + wpaFlag : 'CCMP'; } - else if (parts[i].indexOf('proprietary')) { wpaFlag = wpaFlag ? 'PROP/' + wpaFlag : 'PROP'; } + if (parts[i].indexOf('tkip')) { wpaFlag = (wpaFlag ? 'TKIP/' + wpaFlag : 'TKIP'); } + else if (parts[i].indexOf('ccmp')) { wpaFlag = (wpaFlag ? 'CCMP/' + wpaFlag : 'CCMP'); } + else if (parts[i].indexOf('proprietary')) { wpaFlag = (wpaFlag ? 'PROP/' + wpaFlag : 'PROP'); } } } - if (l.indexOf('Authentication Suites')) { + if (l.indexOf('authentication suites') >= 0) { const parts = l.split(':'); if (parts.length > 1) { - if (parts[i].indexOf('802.1x')) { wpaFlag = wpaFlag ? '802.1x/' + wpaFlag : '802.1x'; } - else if (parts[i].indexOf('psk')) { wpaFlag = wpaFlag ? 'PSK/' + wpaFlag : 'PSK'; } + if (parts[i].indexOf('802.1x')) { wpaFlag = (wpaFlag ? '802.1x/' + wpaFlag : '802.1x'); } + else if (parts[i].indexOf('psk')) { wpaFlag = (wpaFlag ? 'PSK/' + wpaFlag : 'PSK'); } } } });