#!/bin/sh # macowell 2 May 2006 ####################################################### # DESCRIPTION # this script uses curl to log a user on to the davidson college campus network. # It's particularly useful when Kicker.xml is modified to call it. That # modification and the code to test the SSID of the wifi network is from a # script written by wombert 24 Nov 2005 at # (http://forums.macrumors.com/showthread.php?t=162636) ####################################################### # INSTALLATION # Set the and variables appropriately, removing the # greater-than and less-than symbols. # Open the terminal and navigate to the directory in which the script resides, # and execute the following command to make the script executable: # chmod +x autologin.sh # # In a nutshell, every time the computer's network connectivity changes, the # programs and agents specified in # /System/Library/SystemConfiguration/Kicker.bundle/Contents/Resources/Kicker.xml # are notified. By modifying Kicker.xml, we can ensure this script will be called # automatically whenever networks with the Davidson SSID are detected. # # Add the following segment to the Kicker.xml file, without the pound-signs. # Replace [yourUID] and [PathToScriptDirectory] with appropriate values, # also without [brackets]. Use the "id" command in a terminal to determine # your UID. NOTE: be sure to add the code above the bottom three closing tags, # # # # execCommand # /Users/[PathToScriptDirectory]/autologin.sh # execUID # [yourUID] # keys # # Setup:/ # State:/Network/Global/IPv4 # # name # AutoLogin # # # once you have made the changes, just reboot to reload the kicker. ####################################################### username=YOURUSERNAME pwort=YOURPASSWORD logger -i "wifi auto-connecter v0.1 looking for networks..." ssid=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | fgrep -i " ssid" | grep -Eo "[a-zA-Z0-9]+$"` # set variables... might be smart to set curl's retry options when fetching the first address. ip=`ifconfig en1 | grep 'inet ' | sed -e 's/^.inet //' -e 's/ netmask.*//'` subdomain=`curl -s http://www.google.com | grep -o URL=.*\