home > linux > scripts > auto-mac-switch-download-limit

Auto Mac Switch Download Limit

| 15 Jul 2011

Here is a script to auto change mac address, once you reach a specified download amount. This can be useful weather you want to stay anonymous across a public wifi, or there are download limits.

#mac will switch afer 100MB

curDownload=$(ifconfig wlan0 | grep "RX bytes" | sed 's/.*(//; s/ MiB.*//')
if [ "$curDownload" -gt "$maxDownload" ]; then
    newMac=$(date | md5sum | sed 's/../&:/g' | cut -b 1-17)
    ifconfig $interface down
    ifconfig $interface hw ether $newMac
    ifconfig $interface up
    ifconfig $interface |grep HWaddr

Post a Comment