dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit d312f1d10163f7a41139f2c421495917947610ae
parent b065f431b276364838dd9a4601b2d78ccb6cd480
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Fri,  2 Mar 2018 15:47:00 -0500

Add script to spoof mac addresses

Diffstat:
Alinks/bin/spoof-mac-address.sh | 32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)

diff --git a/links/bin/spoof-mac-address.sh b/links/bin/spoof-mac-address.sh @@ -0,0 +1,32 @@ +#!/bin/bash -e +device=en0 + +yellow=`tput setaf 3` +reset=`tput sgr0` + +function printmac { + echo $(ifconfig $device | grep ether | sed 's/ether //') +} + +echo -en "${yellow}Mac address of $device before:${reset}\t" +printmac + +echo "Bringing $device down" +sudo ifconfig $device down + +sleepduration=$(echo 10 + $RANDOM/1000 | bc) +echo -e "${yellow}Sleeping $sleepduration seconds...${reset}" +sleep $sleepduration + +echo "Bringing $device up" +sudo ifconfig $device up + +sleep 1 + +fakemac=$(od -An -N6 -tx1 /dev/urandom | \ + sed -e 's/^ *//' -e 's/ */:/g' -e 's/:$//' -e 's/^\(.\)[13579bdf]/\10/') +echo "Spoofing MAC address for $device" +sudo ifconfig $device ether $fakemac + +echo -en "${yellow}Mac address of $device after:${reset}\t" +printmac