Last active
September 4, 2017 01:12
-
-
Save sktt/88bb85ae65661cd242220f73754d0cee to your computer and use it in GitHub Desktop.
Generates a new mac address. You know why it's useful :)
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/sh | |
| set -e | |
| IF=$1 | |
| if [ -z "$IF" ] ; then | |
| echo "Usage: $0 <interface>" | |
| exit 1 | |
| fi | |
| ifconfig $IF > /dev/null # stop execution if the interface doesn't exist | |
| MAC=`dd bs=1 count=6 if=/dev/random 2>/dev/null|hexdump -e '/1 "%02X:"' | head -c17` | |
| sudo ifconfig $IF ether $MAC | |
| sudo ifconfig en0 down | |
| sudo ifconfig en0 up | |
| ifconfig $IF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment