Created
January 26, 2017 15:02
-
-
Save egemenyildiz/d3199f4616f0bb127fde6ed0542012fb to your computer and use it in GitHub Desktop.
bash function to spoof hw/MAC address of active/current interface
This file contains hidden or 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
spomac() { | |
IFACE=$(ip route get 8.8.8.8 | awk '{print $5}' | head -1) | |
MAC=$(printf '%02x' $((0x$(od /dev/urandom -N1 -t x1 -An | cut -c 2-) & 0xFE | 0x02)); od /dev/urandom -N5 -t x1 -An | sed 's/ /:/g') | |
ifconfig $IFACE down; | |
ifconfig $IFACE hw ether $MAC; | |
ifconfig $IFACE up; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment