List MAC addresses on your local network


Just in case you’re stuck in an hotel with a $40/day wifi access. The usual solution is to spoof a MAC address (ie. use one from someone already connected). But how to list them?

On OS X, the easiest is to use the arp command:

$ arp -an | grep -v incomplete

If you want to make sure the device is currently connected, use nmap (replace 10.0.*.* by your subnet):

$ nmap -sP "10.0.*.*"

And then, you just have to spoof one of the MAC address:

$ sudo ifconfig en0 ether CA:FE:CA:FE:CA:FE

You can eventually combine previous commands, pick a random MAC address and use it to spoof your config:

$ arp -an | grep -v incomplete | grep -v "ff:ff:ff" | grep -v "1:0:5" | cut -d " " -f4 | shuf | head -n1 | xargs sudo ifconfig en0 ether