[Python]How to scan for available networks on OSX

Hi!
I’m posting this simple code for getting list of avaliable networks on OSX.


#!/usr/bin/python
import os

f = os.popen('airport -s')
now = f.read().splitlines(True)
database=[]
for x in range(1,len(now)):
	i = now[x].strip().index(':')
	ssid_database=now[x].strip()
	#print(ssid_database)
	database.append(ssid_database[0:i-3])
print(database)

Try that with
python filename.py

Have fun! 🙂

Published by

@pawisoon

Programmer, designer and dubstep listener.

2 thoughts on “[Python]How to scan for available networks on OSX”

Leave a Reply

Your email address will not be published. Required fields are marked *