Created
June 10, 2014 15:41
-
-
Save ochronus/33ddbc15f875158ce0aa to your computer and use it in GitHub Desktop.
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 | |
MD5_TOOL=md5 # on linux set this to 'md5sum' | |
IFACE=en0 # probably eth0, etc on linux | |
RANDOM_MAC_ADDRESS=$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null|${MD5_TOOL}|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/') | |
sudo ifconfig ${IFACE} ether ${RANDOM_MAC_ADDRESS} | |
if [[ $? != 0 ]] ; then | |
echo "Error changing the MAC address of ${IFACE}" | |
exit 1 | |
else | |
echo "The interface ${IFACE} has the MAC address: ${RANDOM_MAC_ADDRESS}" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment