I wrote a small shell script to spoof my wireless interface mac address. I'd like to run this script on my mac (snow leopard) before the airport utility starts and attempts to connect to an access point. Where would I put this script or what appropriate startup file is referenced where I can have it call my spoofing script?

Here's my little bash script:

$ cat spoof_apple_mac_wifi_mac.sh 

#bring en1 down
sudo ifconfig en1 down;
#generate random mac address
MAC=`/usr/bin/openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`;
#change mac address with ifconfig
sudo ifconfig en1 ether $MAC;
#bring en1 up
sudo ifconfig en1 up;

how about run a script on shutdown to turn the airport off. Then when you start up the system again airport will be off and just turn the airport on at the end of the script?

/usr/sbin/networksetup -setairportpower en1 off

I don't know if it's possible, but you could try to create a script to change the MAC address and then, turn airport on (maybe using this http://macstuff.beachdogs.org/blog/?p=44)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .