Skip to content

Instantly share code, notes, and snippets.

@Cysu
Created November 14, 2013 08:00
Show Gist options
  • Save Cysu/7463103 to your computer and use it in GitHub Desktop.
Save Cysu/7463103 to your computer and use it in GitHub Desktop.
Python: Network Registration for ERGWAVE Wi-Fi
import urllib
import urllib2
import socket
import uuid
macaddr = ':'.join(['{:02x}'.format((uuid.getnode() >> i) & 0xff) for i in range(0,8*6,8)][::-1])
ipaddr = socket.gethostbyname(socket.getfqdn())
url = 'https://securelogin.arubanetworks.com/cgi-bin/login?cmd=login&mac={0}&ip={1}&essid=%20'.format(macaddr, ipaddr)
query_args = {'user':'YOUR_USER_NAME', 'password':'YOUR_PASSWORD', 'fqdn':'YOUR_DEPARTMENT'}
data = urllib.urlencode(query_args)
request = urllib2.Request(url, data)
response = urllib2.urlopen(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment