Last active
July 4, 2016 13:09
-
-
Save johan/2293f3b37737a48b592c to your computer and use it in GitHub Desktop.
osx mac address changer
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
function remac() { | |
local progress='.oO°Oo' | |
local airport=/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport | |
local ssid=$($airport -I|awk '/^ *SSID/ {print $2}') | |
local iface=$(networksetup -listallhardwareports|grep -A1 Wi-Fi|awk '/Device:/ {print $2}') | |
local mac=${1:-00$(openssl rand -hex 5|sed 's/\(..\)/:\1/g')} | |
echo Disconnecting Wi-Fi $iface from SSID $ssid to set new mac address $mac... | |
sudo $airport -z | |
local i n=0 | |
until ifconfig $iface ether | grep -q $mac ; do | |
sudo ifconfig $iface ether $mac | |
sleep .1 | |
i=$[++n % $#progress + 1] | |
echo -n "$progress[$i]\r" | |
done | |
networksetup -setairportnetwork $iface $ssid \ | |
&& echo mac is $mac \ | |
|| echo failed $mac && false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment