wifiInterfaces(), wifiConnections() improved parsing (linux)

This commit is contained in:
Sebastian Hildebrandt 2022-10-27 07:09:37 +02:00
parent 2a8e7f89fa
commit f74972217c
51 changed files with 90 additions and 96 deletions

View File

@ -80,7 +80,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.12.10 | 2022-10-25 | `bluetooth()` adapted parsing to acceptü also new profile (mac OS) |
| 5.12.11 | 2022-10-27 | `wifiInterfaces()`, `wifiConnections` improved parsing (linux) |
| 5.12.10 | 2022-10-25 | `bluetooth()` adapted parsing to accept also new profile (mac OS) |
| 5.12.9 | 2022-10-24 | fix typescript typings, code cleanup, docs updated |
| 5.12.8 | 2022-10-23 | `processes()` fix truncated commands (windows) |
| 5.12.7 | 2022-10-15 | `versions()` fix postgres |

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -26,7 +26,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -26,7 +26,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -26,7 +26,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.12.11</th>
<td>2022-10-27</td>
<td><span class="code">wifiInterfaces()</span>, <span class="code">wifiConnections()</span> improved parsing (linux)</td>
</tr>
<tr>
<th scope="row">5.12.10</th>
<td>2022-10-25</td>
@ -2779,4 +2784,4 @@
</body>
</html>
</html>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.12.10</span></div>
<div class="version">New Version: <span id="version">5.12.11</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
@ -206,7 +206,7 @@
</div>
<div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">15,217</div>
<div class="numbers">15,211</div>
<div class="title">Lines of code</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">

View File

@ -26,7 +26,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -26,7 +26,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -26,7 +26,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -25,7 +25,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -25,7 +25,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -25,7 +25,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -25,7 +25,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -25,7 +25,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -25,7 +25,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -29,7 +29,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png">
<a href="/v4/index.html"><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation - Version 4</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -30,7 +30,7 @@
<body>
<nav class="nav">
<div class="container">
<a href="."><img class="logo float-left" src="assets/logo.png">
<a href="."><img class="logo float-left" src="assets/logo.png" alt="logo">
<div class="title float-left">systeminformation</div>
</a>
<div class="text float-right github"><a href="https://github.com/sebhildebrandt/systeminformation">View on Github <i class="fab fa-github"></i></a></div>

View File

@ -159,14 +159,6 @@ function getDynamicData(srv, iface, callback) {
};
})();
// var totalFunctions = 14;
// function functionProcessed() {
// if (--totalFunctions === 0) {
// if (callback) { callback(data) }
// resolve(data);
// }
// }
let data = {};
// get time
@ -342,7 +334,6 @@ function get(valueObject, callback) {
result[key] = data[i];
} else {
let keys = valueObject[key];
// let params = '';
let filter = '';
let filterParts = [];
// remove params

View File

@ -125,7 +125,7 @@ function wifiChannelFromFrequencs(frequency) {
function ifaceListLinux() {
const result = [];
const cmd = 'iw dev';
const cmd = 'iw dev 2>/dev/null';
try {
const all = execSync(cmd).toString().split('\n').map(line => line.trim()).join('\n');
const parts = all.split('\nInterface ');
@ -145,7 +145,30 @@ function ifaceListLinux() {
});
return result;
} catch (e) {
return [];
try {
const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null').toString();
const parts = all.split('\nGENERAL.DEVICE:');
let i = 1;
parts.forEach(ifaceDetails => {
const lines = ifaceDetails.split('\n');
const iface = util.getValue(lines, 'GENERAL.DEVICE');
const type = util.getValue(lines, 'GENERAL.TYPE');
const id = i++; // // util.getValue(lines, 'GENERAL.PATH');
const mac = util.getValue(lines, 'GENERAL.HWADDR');
const channel = '';
if (type.toLowerCase() === 'wifi') {
result.push({
id,
iface,
mac,
channel
});
}
});
return result;
} catch (e) {
return [];
}
}
}
@ -244,8 +267,8 @@ function getWifiNetworkListIw(iface) {
if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; }
if (iwlistParts.length > 1) {
iwlistParts.shift();
for (let i = 0; i < iwlistParts.length; i++) {
const lines = iwlistParts[i].split('\n');
iwlistParts.forEach(element => {
const lines = element.split('\n');
const channel = util.getValue(lines, 'channel', ':', true);
const address = (lines && lines.length && lines[0].indexOf('Address:') >= 0 ? lines[0].split('Address:')[1].trim().toLowerCase() : '');
const mode = util.getValue(lines, 'mode', ':', true);
@ -257,8 +280,8 @@ function getWifiNetworkListIw(iface) {
const ssid = util.getValue(lines, 'essid', ':', true);
// security and wpa-flags
const isWpa = iwlistParts[i].indexOf(' WPA ') >= 0;
const isWpa2 = iwlistParts[i].indexOf('WPA2 ') >= 0;
const isWpa = element.indexOf(' WPA ') >= 0;
const isWpa2 = element.indexOf('WPA2 ') >= 0;
const security = [];
if (isWpa) { security.push('WPA'); }
if (isWpa2) { security.push('WPA2'); }
@ -307,7 +330,7 @@ function getWifiNetworkListIw(iface) {
wpaFlags,
rsnFlags: []
});
}
});
}
return result;
} catch (e) {
@ -315,30 +338,6 @@ function getWifiNetworkListIw(iface) {
}
}
/*
ssid: line.substring(parsedhead[0].from, parsedhead[0].to).trim(),
bssid: line.substring(parsedhead[1].from, parsedhead[1].to).trim().toLowerCase(),
mode: '',
channel,
frequency: wifiFrequencyFromChannel(channel),
signalLevel: signalLevel ? parseInt(signalLevel, 10) : null,
quality: wifiQualityFromDB(signalLevel),
security,
wpaFlags,
rsnFlags: []
const securityAll = line.substring(parsedhead[6].from, 1000).trim().split(' ');
let security = [];
let wpaFlags = [];
securityAll.forEach(securitySingle => {
if (securitySingle.indexOf('(') > 0) {
const parts = securitySingle.split('(');
security.push(parts[0]);
wpaFlags = wpaFlags.concat(parts[1].replace(')', '').split(','));
}
});
*/
function parseWifiDarwin(wifiObj) {
const result = [];
if (wifiObj) {
@ -392,11 +391,11 @@ function wifiNetworks(callback) {
try {
const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL').toString().split('\n\n');
let iface = '';
for (let i = 0; i < iwconfigParts.length; i++) {
if (iwconfigParts[i].indexOf('no wireless') === -1 && iwconfigParts[i].trim() !== '') {
iface = iwconfigParts[i].split(' ')[0];
iwconfigParts.forEach(element => {
if (element.indexOf('no wireless') === -1 && element.trim() !== '') {
iface = element.split(' ')[0];
}
}
});
if (iface) {
const res = getWifiNetworkListIw(iface);
if (res === -1) {
@ -574,7 +573,6 @@ function wifiConnections(callback) {
const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true));
const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
const signalLevel = rssi - noise;
// const signal = wifiQualityFromDB(signalLevel);
if (ssid || bssid) {
result.push({
id: 'Wi-Fi',
@ -589,7 +587,6 @@ function wifiConnections(callback) {
signalLevel,
txRate
});
}
}
if (callback) {