Skip to content

Instantly share code, notes, and snippets.

@mertsalik
Created September 13, 2019 20:06
Show Gist options
  • Save mertsalik/f8283f01b33c7aeef220486200776f01 to your computer and use it in GitHub Desktop.
Save mertsalik/f8283f01b33c7aeef220486200776f01 to your computer and use it in GitHub Desktop.
import objc
objc.loadBundle('CoreWLAN', bundle_path = '/System/Library/Frameworks/CoreWLAN.framework',
module_globals = globals())
iface = CWInterface.interface()
# Scan all available networks
iface.scanForNetworksWithName_includeHidden_error_(None, True, None)
# Scan with specific name
networks, error = iface.scanForNetworksWithName_error_('FooNetworkName', None)
# Select network
network = networks.anyObject()
# Connect
success, error = iface.associateToNetwork_password_error_(network, 'foobar_password', None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment