Created
November 14, 2013 08:00
-
-
Save Cysu/7463103 to your computer and use it in GitHub Desktop.
Python: Network Registration for ERGWAVE Wi-Fi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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