Adding script to change en0 mac address to something random

This commit is contained in:
Dustin Swan
2014-06-17 10:03:59 -05:00
parent 0c55eae12f
commit af66337aab
2 changed files with 19023 additions and 0 deletions

19004
bin/oui.txt Normal file

File diff suppressed because it is too large Load Diff

19
bin/random_mac.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
INTERFACE=en0
OUI="$HOME/dotfiles/bin/oui.txt"
OUI_LEN=19004
R=$(((RANDOM % ${OUI_LEN})+1))
PREFIX=`head -$R $OUI | tail -1`
CMD="sudo ifconfig ${INTERFACE} ether ${PREFIX}:"
for i in `seq 1 6`; do
R=$(((RANDOM % 15)+1))
C=`echo "obase=16; $R" | bc`
CMD="$CMD$C"
if [ $((i % 2)) = 0 ] && [ $i != 6 ]; then
CMD="$CMD:"
fi
done
RESULT=`$CMD`
echo $CMD