I'm using pyobjc wrapper to scan for networks:
import objc
objc.loadBundle(
"CoreWLAN",
bundle_path="/System/Library/Frameworks/CoreWLAN.framework",
module_globals=globals()
)
from CoreWLAN import CWNetwork, CWWiFiClient
client = CWWiFiClient.sharedWiFiClient()
iface = client.interfaceWithName_("en0")
networks, error = iface.scanForNetworksWithName_error_(
None,
None,
)
print(networks)
and get
{( <CWNetwork: 0x7ff7a64040d0> [ssid=FRITZ!Box 7520 HT, bssid=(null), security=WPA2 Personal, rssi=-84, channel=<CWChannel: 0x7ff79644b800> [channelNumber=116(5GHz), channelWidth={80MHz}], ibss=0], <CWNetwork: 0x7ff7a64447d0> [ssid=FRITZ$Box 7412, bssid=(null), security=WPA/WPA2 Personal, rssi=-52, channel=<CWChannel: 0x7ff7964054c0> [channelNumber=11(2GHz), channelWidth={20MHz}], ibss=0], ... )}
As you might see, bssid is null. Also, as pointed here, it's expected behaviour: https://developer.apple.com/forums/thread/119490?answerId=387785022#387785022
How do I enable location services for this code to be able to get bssid?
UPD: Found a solution! github.com/ronaldoussoren/pyobjc/issues/484
This is the script I used to generate a location services permission request for Python:
In my testing with MacOS 13.2 if Python has location services permissions then you can see the BSSID. This seems to be a bug fix as this should have been the expected behavior since they started hiding the BSSID in MacOS 10.15.