Is there a way to access WI-Fi OS X data using Python? (E.g. signal strength)

I'm just curious to know if any Python tools can be used to query the wi-fi signal level in OS X. Most of my searches just bring Python tools for Linux, but none of them for OS X.

If not, are there other ways to get this data programmatically?

+8
python networking wifi macos
source share
2 answers

The answer to this question describes how to load the CoreWLAN infrastructure. Once you do this, you can use the CWInterface class to search for RSSI among other features:

import objc objc.loadBundle('CoreWLAN', bundle_path='/System/Library/Frameworks/CoreWLAN.framework', module_globals=globals()) for iname in CWInterface.interfaceNames(): interface = CWInterface.interfaceWithName_(iname) print """ Interface: %s SSID: %s Transmit Rate: %s Transmit Power: %s RSSI: %s""" % (iname, interface.ssid(), interface.transmitRate(), interface.transmitPower(), interface.rssi()) 

For a complete list of available properties, see CWInterface Docs .

+7
source share

For mac, there is a command line tool called an airport. You can manually configure any wi-fi settings, network card settings, troubleshoot networks, change the security types used in the connection, capture packets in a pcap file, join and leave networks, forget the Wi-Fi network, determine the priorities of routers and networks, see signal strength and interference, etc.

Usually it is here - /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport

You can just enter this for reference.

 airport airport -h 

Using this and the subprocess together, you can accomplish most of these things in python

+1
source share

All Articles