/ Published in: Python

Me trying to not be a noob in python.
Yes, I know my noob is probably showing.
Yes, I know my noob is probably showing.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#! /usr/bin/env python from subprocess import Popen,PIPE import re, dbus, gtk, glib, sys, os def checkCurrentSsid(): ssidpat = re.compile('ESSID:"([^"]*)"') iwconf = Popen(['iwconfig'], stdout=PIPE).communicate()[0] if ssidpat.search(iwconf): ssid = ssidpat.search(iwconf).groups()[0] print "ssid ....... " +ssid iwpipe = os.popen('iwevent','r') while 1: iwoutput = iwpipe.readline() if (iwoutput.find("New Access") != -1 and iwoutput.find('Not-Associated') == -1): print "iwoutput ... " +iwoutput checkCurrentSsid()
Comments
