Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/sh
- # HomePass
- DATE=$(date)
- # Put a filename and path in here if you wish to log each profile change
- LOG="HomePass.log"
- # The WiFi network number we need to toggle the MAC address of
- # You must have already added a WiFi network with the ssid "attwifi" and clicked "save & apply"
- WIFI=$(uci show wireless | grep "ssid=attwifi" | awk 'NR>1{print $1}' RS=[ FS=])
- # MAC address list is missing or empty, reload it from the server
- if [ ! -s HomePass.list ]; then
- # If you only want to use the primaries and Nintendo World (not the SPOOF range)
- # then delete the current HomePass.list and add ?new=1 to the end of the next line
- wget -O HomePass.list http://csdprojects.co.uk/3DS/HomePass.php
- fi
- if [ ! -s HomePass.list ]; then
- echo "MAC address list is missing or zero in length and we were unable to update it. Try again later."
- exit
- fi
- LENGTH=$(wc -l < HomePass.list)
- if [ -z "$WIFI" ]; then
- echo Unable to identify the WiFi configuration for the attwifi network!
- echo Please make sure you have created a Wifi network with the ssid attwifi before running this script.
- exit
- fi
- # If no profile was manually specified then read it from uci
- if [ -z "$1" ]; then
- I=$(uci get wireless.@wifi-iface[$((WIFI))].profile)
- # If there is no uci entry then we start from scratch
- if [ -z "$I" ]; then
- I=1
- else
- I=$((I+1))
- fi
- # If we went over the last profile we reset back to $MIN
- if [ $I -gt $LENGTH ]; then
- I=1
- fi
- else
- I=$1
- fi
- # Read MAC address number $I from the list
- MAC=$(sed -n $((I))p HomePass.list)
- # Make sure we actually got a MAC address from the list
- if [ -n "$MAC" ]; then
- echo Setting profile $I, $MAC, $DATE
- # Write profile changes to a log file
- if [ -n "$LOG" ]; then
- echo Setting profile $I, $MAC, $DATE >> $LOG
- fi
- # Save a custom config called profile so that we know where we are in the list next time
- uci set wireless.@wifi-iface[$((WIFI))].profile=$I
- # Save the new MAC address
- uci set wireless.@wifi-iface[$((WIFI))].macaddr=$MAC
- # Restart the WiFi
- wifi 2>1 >/dev/null
- else
- echo "We had a problem reading the MAC address from the list, aborting."
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement