Skip to content

Commit

Permalink
networkInterfaces() sanitizing SSID names (windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhildebrandt committed Dec 9, 2024
1 parent 51c7698 commit f7af0a6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.

| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.23.7 | 2024-12-09 | `networkInterfaces()` sanitizing SSID names (windows) |
| 5.23.6 | 2024-12-08 | `system()` added Raspberry CM5 detection |
| 5.23.5 | 2024-08-21 | `processLoad()` fixed * process list (linux) |
| 5.23.4 | 2024-08-06 | `baseboard()` `chassis()` cleaned defaults (linux) |
Expand Down
5 changes: 5 additions & 0 deletions docs/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ <h3>Full version history</h3>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.23.7</th>
<td>2024-12-09</td>
<td><span class="code">networkInterfaces()</span> sanitizing SSID names (windows)</td>
</tr>
<tr>
<th scope="row">5.23.6</th>
<td>2024-12-08</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.23.6</span></div>
<div class="version">New Version: <span id="version">5.23.7</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">
Expand Down
16 changes: 13 additions & 3 deletions lib/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function getWindowsWirelessIfaceSSID(interfaceName) {
try {
const result = execSync(`netsh wlan show interface name="${interfaceName}" | findstr "SSID"`, util.execOptsWin);
const SSID = result.split('\r\n').shift();
const parseSSID = SSID.split(':').pop();
const parseSSID = SSID.split(':').pop().trim();
return parseSSID;
} catch (error) {
return 'Unknown';
Expand Down Expand Up @@ -400,8 +400,18 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
try {
const SSID = getWindowsWirelessIfaceSSID(iface);
if (SSID !== 'Unknown') {
i8021xState = execSync(`netsh wlan show profiles "${SSID}" | findstr "802.1X"`, util.execOptsWin);
i8021xProtocol = execSync(`netsh wlan show profiles "${SSID}" | findstr "EAP"`, util.execOptsWin);

let ifaceSanitized = '';
const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(SSID);
const l = util.mathMin(s.length, 2000);

for (let i = 0; i <= l; i++) {
if (s[i] !== undefined) {
ifaceSanitized = ifaceSanitized + s[i];
}
}
i8021xState = execSync(`netsh wlan show profiles "${ifaceSanitized}" | findstr "802.1X"`, util.execOptsWin);
i8021xProtocol = execSync(`netsh wlan show profiles "${ifaceSanitized}" | findstr "EAP"`, util.execOptsWin);
}

if (i8021xState.includes(':') && i8021xProtocol.includes(':')) {
Expand Down

0 comments on commit f7af0a6

Please sign in to comment.