Last active
August 29, 2015 14:03
-
-
Save steinfletcher/06ce978f479f86b0cc00 to your computer and use it in GitHub Desktop.
Change the mac address of a device (useful for various spoofing, e.g. for extending limited access on public wifi networks). Tested in OSX
This file contains 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/bash | |
# Author: Stein Fletcher <steinfletcher@gmail.com> | |
# Purpose: Changes the mac address for the en0 device | |
# get the current mac address | |
old_addr=`/sbin/ifconfig en0 | awk '/ether/ {print $2}'` | |
# Generates a random new mac address using openssl | |
new_addr=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` | |
# change the actual address | |
sudo /sbin/ifconfig en0 ether $new_addr | |
timestamp=`date` | |
echo "$timestamp: Changed mac address from $old_addr to $new_addr" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment