Created
December 28, 2011 22:55
-
-
Save acidprime/1530248 to your computer and use it in GitHub Desktop.
Some Python Airport code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -tt | |
import subprocess | |
airport = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport' | |
def getAirportInfo(): | |
arguments = [airport,"--getinfo"] | |
execute = subprocess.Popen(arguments, stdout=subprocess.PIPE) | |
out, err = execute.communicate() | |
dict = {} | |
for line in out.split('\n'): | |
parse = line.split(': ') | |
try: | |
key = parse[0].strip() | |
value = parse[1] | |
dict[key] = value | |
except IndexError: | |
None | |
return dict | |
airportInfo = getAirportInfo() | |
print airportInfo['SSID'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment