Created
April 8, 2019 23:24
-
-
Save ihatem/14092668d531f410b5e47d1c2d9cf1c9 to your computer and use it in GitHub Desktop.
Generate mac adress with randomized hex
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 | |
CURRENT=`ifconfig en1 | grep ether | cut -c8-24` | |
RANDOM=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` | |
echo "Current MAC Adress : $CURRENT" | |
echo "Random MAC Adress : $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')" | |
printf "Continue Y/N? "; read res | |
if [[($res == "Y")]]; then | |
sudo ifconfig en1 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') | |
else | |
echo "quitting..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment