From 83a949ecc3895ceb8dbc79504c0af6c34d297afe Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Tue, 20 Sep 2022 15:54:02 +0200 Subject: [PATCH] allow setting mac address from argument --- local/bin/macspoofer.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/local/bin/macspoofer.sh b/local/bin/macspoofer.sh index bbe14e2..7f56425 100755 --- a/local/bin/macspoofer.sh +++ b/local/bin/macspoofer.sh @@ -2,7 +2,7 @@ # Reading our private mac here="$(dirname "$0")" -mac="$(cat "$here/macaddress")" +mac="${1:-$(cat "$here/macaddress")}" enp="$(basename /sys/class/net/enp*)" wlp="$(basename /sys/class/net/wlp*)" @@ -12,8 +12,10 @@ sudo ip link set "$enp" address "$mac" sudo ip link set "$enp" up # No more wireless -sudo sv stop /var/service/iwd -sudo ip link set "$wlp" down +if [ -e /var/service/iwd ]; then + sudo sv stop /var/service/iwd + sudo ip link set "$wlp" down +fi # Restart tor on network change sudo sv restart tor