Return to Snippet

Revision: 11773
at February 18, 2009 01:17 by jakswa


Initial Code
#! /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()

Initial URL

                                

Initial Description
Me trying to not be a noob in python.

Yes, I know my noob is probably showing.

Initial Title
Detect SSID Change Python

Initial Tags
python

Initial Language
Python