Skip to content

Instantly share code, notes, and snippets.

@Neal
Last active July 19, 2017 07:13
Show Gist options
  • Save Neal/e725a38b60f814c8565117fca40ee265 to your computer and use it in GitHub Desktop.
Save Neal/e725a38b60f814c8565117fca40ee265 to your computer and use it in GitHub Desktop.
"Forget" all known open wifi networks
import os
import plistlib
pl = plistlib.readPlist('/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist')
for key, network in pl['KnownNetworks'].items():
if network['SecurityType'] == 'Open':
os.system('networksetup -removepreferredwirelessnetwork en0 "{}"'.format(network['SSIDString']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment