Created
June 26, 2016 13:37
-
-
Save huglester/4e2c654ab4055a52fd7b0c6c1b5523a3 to your computer and use it in GitHub Desktop.
MAC address changer for MacOSX
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
#!/bin/bash | |
ORIGINAL_MAC="00:11:22:33:44:55" | |
RANDOM_MAC=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` | |
INTERFACE=en0 | |
MAC=$RANDOM_MAC | |
if [ "$1" = "original" ]; then | |
MAC=$ORIGINAL_MAC | |
fi | |
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z | |
sudo ifconfig $INTERFACE ether $MAC | |
sudo networksetup -detectnewhardware | |
sudo ifconfig $INTERFACE down | |
sudo ifconfig $INTERFACE up | |
echo "MAC address is now: $MAC" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment