Auto Mac Switch Download Limit
19 | 15 Jul 2011Here 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.
#!/bin/bash
interface="wlan0"
#mac will switch afer 100MB
maxDownload=100
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
fi