Thread: [Python] Checking if ubuntu is connected to *given* wireless network
hey guys,
working on script logs schools hotspot when connects. have http-request done, pretty easy how check if ubuntu connected aau-ins wireless network?
here code far(just http request):
code:#! /usr/bin/python import urllib import urllib2 import sys import cookielib import hashlib #accept cookies browse telmore website cookiejar = cookielib.lwpcookiejar() opener = urllib2.build_opener(urllib2.httpcookieprocessor(cookiejar)) #add headers opener.addheaders = [('user-agent', "mozilla/5.0")] #accept arguments username , password username = sys.argv[1] password = sys.argv[2] #url request url = "https://hotspot.tnb.aau.dk/nwa_auth/action/smb" #fill forms username , password arguments form = { "auth_smb_user" : username, "auth_smb_pass" : password } #encode form , create request encodedform = urllib.urlencode(form) request = urllib2.request(url, encodedform) page = opener.open(request) contents = page.read()
thanks,
dane
code:iwconfig wlan0 | grep -o aau-ins
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [Python] Checking if ubuntu is connected to *given* wireless network
Ubuntu
Comments
Post a Comment