Skip to content

Instantly share code, notes, and snippets.

@royvandam
Last active August 29, 2015 14:26
Show Gist options
  • Save royvandam/4f3da6f46d4ccf6fe45d to your computer and use it in GitHub Desktop.
Save royvandam/4f3da6f46d4ccf6fe45d to your computer and use it in GitHub Desktop.
Randomise your ethernet mac address for bypassing free wifi time limits.
#!/bin/bash
if=${1-en1}
function get_if_mac() {
local if=$1
ifconfig en1 | grep ether | sed -e 's/^[[:space:]]ether //'
}
mac=$(get_if_mac $if)
while true; do
new_mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
echo "$mac -> $new_mac"
sudo ifconfig $if ether $new_mac
mac=$(get_if_mac $if)
[ ${new_mac} = ${mac} ] && break
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment