I am just curious whether it would be possible to use any Python tools to poll wi-fi signal strength in OS X. Most of my searches are just yielding Python tools for Linux, but none for OS X.
If not, are there any other ways to get such data programmatically?
The answer to this question describes how to load the CoreWLAN framework. Once you've done that, you can use the CWInterface class to find the RSSI, amongst other stats:
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())
See the CWInterface docs for the full list of available properties.
For mac there is a Command line tool called airport. You can manually adjust any wi-fi settings, network card settings, troubleshoot networks, change security types used on a connection, capture packets into a pcap file, join and leave networks, forget a wifi network, prioritize routers and networks, see signal strength and interference etc.
Its usually in here - /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
You can just type this for help
airport
airport -h
Using this and subprocess together you should be able to do most of these things in python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With