Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSSIDs not being populated by wifiNetworks() on macOS Monterey 12.0.1 #630

Closed
akashkashyap opened this issue Dec 1, 2021 · 10 comments
Closed

Comments

@akashkashyap
Copy link

Describe the bug
On macOS Monterey 12.0.1, the object returned by wifiNetworks() doesn't have BSSID's populated. It just contains empty strings for each entry. I haven't gotten the chance to see if this behavior replicates on other OS's/versions

To Reproduce
Steps to reproduce the behavior:

  1. Call wifiNetworks() on a machine running macOS Monterey 12.0.1
  2. Inspect the returned object, note missing BSSID's.

Current Output
Empty string in bssid field.

Expected behavior
The correct string in the bssid field.

Environment (please complete the following information):

  • systeminformation package version: 5.9.15
  • OS: macOS Monterey 12.0.1
  • Hardware: MacbookPro 16 inch (m1 max)

Additional context
Example screenshot:
image

@akashkashyap
Copy link
Author

akashkashyap commented Dec 1, 2021

Using '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x' returns XML that contains the bssid. Seems like a reasonable alternative, the xml can just be parsed.

@sebhildebrandt
Copy link
Owner

@akashkashyap I created an tiny xml parser and will see if this also works here. I will then implement a working version this weekend.

@akashkashyap
Copy link
Author

Thanks @sebhildebrandt, sounds great! I'll keep an eye out for a new release once you have it working.

@akashkashyap
Copy link
Author

akashkashyap commented Dec 2, 2021

FYI Something to keep in mind:

I wrote a quick-hack workaround just for bssid's for myself using xpath and xmldom, and I have been running into an issue where stdout from child_process.exec is truncated sometimes. Basically the truncated stdout doesn't break all parsing, but it results in missing some of the network connections.

Worth keeping in mind as you work on the full fix. It looks like there's an open issue on the nodejs side for this but there hasn't been any activity since May: nodejs/node#19218

@sebhildebrandt
Copy link
Owner

sebhildebrandt commented Dec 3, 2021

@akashkashyap very clear, thank you for reminding me! I will increase here the buffer size (and see if this helps - the output is quite large and might be larger than what I have configured)....

Concerning xpath, xmldom: I want to avoid dependencies so I am not using external libs for the parsing. But my own plist-parser works quite fine ;-)

I will keep you updated on the progress.

@sebhildebrandt
Copy link
Owner

@akashkashyap I just released a new version with a fix for this. Can you test it on your side? Version 5.9.16 just released

@akashkashyap
Copy link
Author

akashkashyap commented Dec 5, 2021

Looks good, it's working on my end! Thanks Sebastian.

@akashkashyap
Copy link
Author

akashkashyap commented Dec 6, 2021

@sebhildebrandt, just saw a crash today on my end in parseWifiDarwin.

TypeError: Cannot read property 'forEach' of null
    at parseWifiDarwin (/Users/akash/dev/desktop/node_modules/systeminformation/lib/wifi.js:344:11)
    at /Users/akash/dev/desktop/node_modules/systeminformation/lib/wifi.js:442:20
    at ChildProcess.exithandler (child_process.js:308:7)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)
uncaughtException TypeError: Cannot read property 'forEach' of null
    at parseWifiDarwin (/Users/akash/dev/desktop/node_modules/systeminformation/lib/wifi.js:344:11)
    at /Users/akash/dev/desktop/node_modules/systeminformation/lib/wifi.js:442:20
    at ChildProcess.exithandler (child_process.js:308:7)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)

Noticed this when wifi was turned off and ethernet was plugged in, haven't been able to repro with wifi on. I think you just need to handle the null case.

@sebhildebrandt
Copy link
Owner

@akashkashyap Will havea look on it ...

@sebhildebrandt
Copy link
Owner

@akashkashyap Should be fixed now. Version 5.9.17 just released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants