Created
February 14, 2018 07:00
-
-
Save Luxian/4610369e015ddc8c013491012f6d1d72 to your computer and use it in GitHub Desktop.
Randomize MAC address for Macbook Pro's WiFi card to bypass traffic limitation imposed by some hotels
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
#!/usr/bin/env bash | |
# Randomize MAC address for the WiFi cards on Macbook Pro | |
# | |
# Most of the code comes from here: | |
# https://apple.stackexchange.com/questions/151986/change-mac-address-in-os-x-yosemite | |
# | |
echo "Randomizing WiFi MAC address..."; | |
echo; | |
echo " Current settings: `sudo ifconfig en0 ether | grep ether | cut -c 8-`"; | |
RANDOM_MAC="`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/./0/2; s/.$//'`"; | |
echo " New generated MAC: $RANDOM_MAC"; | |
echo -n " Setting new MAC address..." | |
sudo ifconfig en0 ether $RANDOM_MAC | |
echo " done" | |
echo -n " Force new hardware detection..." | |
networksetup -detectnewhardware | |
echo " done" | |
echo " MAC address after the change: `sudo ifconfig en0 ether | grep ether | cut -c 8-`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment