#!/system/xbin/bash # Ensure we are running as root, because this won't work otherwise. uid=$(id | sed -n 's/uid=\([0-9]\+\).*/\1/p') if [[ ${uid} != 0 ]]; then echo "Not running as root. Cannot proceed. Exiting..." exit 1 fi echo "Remounting /system with write access so we can make the modification." mount -o remount,rw /system # The path to the wlan cal file cal_path=/system/etc/wifi/bcmdhd.cal # Don't need this, but might be handy to have documented #old_mac=00:90:4c:c5:12:38 # Generate the new mac address new_mac=$(printf '00:90:4c:%02x:%02x:%02x\n' $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]) # Sed expression to replace the mac address with something less problematic sed -i "s/macaddr=.*/macaddr=${new_mac}/" ${cal_path} echo "Your new mac address is ${new_mac}."