Skip to content

Instantly share code, notes, and snippets.

@ianldgs
Created May 21, 2019 15:45
Show Gist options
  • Select an option

  • Save ianldgs/d0198c59149ef2d57876e792a8d3452c to your computer and use it in GitHub Desktop.

Select an option

Save ianldgs/d0198c59149ef2d57876e792a8d3452c to your computer and use it in GitHub Desktop.
changeMac() {
local net=${1:-en0}
local mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
sudo ifconfig $net ether $mac
sudo ifconfig $net down
sudo ifconfig $net up
echo "Your new physical address for interface $net is $mac"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment