Tweak randomMac script

This commit is contained in:
Jonathan Hodgson 2019-09-19 10:46:02 +01:00
parent 07323af8cd
commit b547a8e2a6

View file

@ -8,9 +8,9 @@
if [ "$1" != "" ]; then if [ "$1" != "" ]; then
if [ "$(ip link show | grep $1)" != "" ]; then if [ "$(ip link show | grep $1)" != "" ]; then
if [ ! -f ~/mac-address.bck ]; then if [ ! -f ~/mac-address-$1.bck ]; then
echo "storing original information in ~/mac-address.bck" echo "storing original information in ~/mac-address-$1.bck"
ip link show > ~/mac-address.bck ip link show > ~/mac-address-$1.bck
fi fi
sudo ip link set dev $1 down sudo ip link set dev $1 down
sudo ip link set dev $1 address $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') sudo ip link set dev $1 address $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')