Skip to content

Instantly share code, notes, and snippets.

@travis-g
Created October 9, 2015 20:24
Show Gist options
  • Save travis-g/ad76f9b0fb9ce1a0b728 to your computer and use it in GitHub Desktop.
Save travis-g/ad76f9b0fb9ce1a0b728 to your computer and use it in GitHub Desktop.
MAC randomizer script
#!/bin/sh
usage() {
cat<<EOF
usage: $(basename $0) [-h] dev
Useful for getting around timed public WiFi sessions. Your wireless device may
need to be restarted after running for the changes to apply.
EOF
}
test "$1" = '-h' && usage && exit 0
DEFAULT_DEV=eth0
DEFAULT_ADDR=ether
dev=${1:-$DEFAULT_DEV}
addr=${2:-$DEFAULT_ADDR}
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' | xargs sudo ifconfig $dev $addr || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment