Skip to content

Instantly share code, notes, and snippets.

@Gabelbombe
Last active May 18, 2021 00:39
Show Gist options
  • Save Gabelbombe/25ffc325d80242c75f873dc77c085069 to your computer and use it in GitHub Desktop.
Save Gabelbombe/25ffc325d80242c75f873dc77c085069 to your computer and use it in GitHub Desktop.
Rotate your mac on command, or force reiteration with CRONTabbin the SOB.....
## Alter your comps fingerprint..
function rollmac()
{
# Disassociate yourself from the airport binary
# http://osxdaily.com/2007/01/18/airport-the-little-known-command-line-wireless-utility/
! hash airport 2>/dev/null && {
[ -f /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport ] && {
ln -fs /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport /usr/local/bin
} || {
# Dave's not here..
echo -e "[err] Airport doesn't seem to exist on your system..." \
&& open 'https://www.youtube.com/watch?v=rtDAK7Umk7A'
}
}
# Stash the SSID of your network sheep so we can autojoin after rotation
SSID=$(/usr/local/bin/airport -I |awk '/ SSID/ {print substr($0,index($0,$2))}')
BSID=$(/usr/local/bin/airport -I |awk '/ BSSID/ {print substr($0,index($0,$2))}')
sudo /usr/local/bin/airport --disassociate # bye felicia..
# Conjour a new MAC fingerprint from the ethers...
MAC=$(
openssl rand -hex 6 | \
/usr/bin/sed \
-e 's/\(..\)/\1:/g' \
-e 's/./0/2' \
-e 's/.$//' \
)
echo -e "Old MAC address was: $(ifconfig en0 |grep ether |awk '{print$2}')\nNew MAC address is: ${MAC}"
sudo ifconfig en0 ether ${MAC}
# Replay with new MAC over the top...
networksetup -detectnewhardware
networksetup -setairportnetwork en0 "${SSID}"
echo -e '[info] Roll down, expect a prompt from your network to accept ToS in a few seconds ;)'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment