Created
October 11, 2018 08:40
-
-
Save joshspicer/7fc8571e7b6a04b6250631855eeea358 to your computer and use it in GitHub Desktop.
Change the MAC address for a given interface on your Mac computer.
This file contains hidden or 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 | |
if [ "$#" -ne 1 ]; then | |
echo "[-] Usage: ./changeMAC.sh <interface>" | |
echo "[-] Hold down the option key and click the WiFi symbol to see your default interface name" | |
exit 1 | |
fi | |
interface=$1 | |
echo "==BEFORE==" | |
ifconfig | grep -A 1 $interface | grep "ether" | |
randomMAC=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') | |
sudo ifconfig $interface ether $randomMAC | |
echo "==AFTER==" | |
ifconfig | grep -A 1 $interface | grep "ether" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment