#!/bin/bash

if [[ $EUID -ne 0 ]]; then
   echo "Login as the root user before using iSpoof" 
   exit 1
fi
echo iSpoof DISCLAIMER
echo
echo Spoofing the MAC address of iDevices changes the UDID, a.k.a. the Universal Device Identifier. You can always reset your MAC address to the hardware default, and your device will be exactly as it was before ever using iSpoof. Setting your MAC address to something invalid may be tragic, your internet wont work afterward for that device. How would your iDevice connect to the internet without a valid MAC address anyways? Any MAC address you set, either the hardware default or spoofed address, will persist through a restore. Restoring your iDevice will not reset your MAC address and will not fix an invalid value for one you set. With great power comes great responsibility. You have been warned! I am not responsible for your incompetence. Depending on the firmware your iDevice is on, you may have to activate or sign in to your Apple ID after spoofing your MAC address. On other firmwares, none of these additional steps may be necessary. When your MAC address is spoofed, some Apple services may or may not function correctly. Changing your MAC address to the hardware default will allow Apple services to function once again. The address you spoof to should likely be in the 192.168.0.0 - 192.168.255.255 address space unless you know what your doing otherwise. Do not spoof your MAC address to one that is already taken and not actively available in the network. The network will not know how to handle 2 simultaneously connect devices with the same supposedly unique identifier. iSpoof will not cause any damage to your iDevice as long as it is used as stated above.
echo
PS3='Would you like to: '
options=("Spoof your MAC address" "Reset your MAC address to the hardware default" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Spoof your MAC address")
            echo iSpoof by ally
echo What MAC adress do you desire? 
read varMAC
nvram wifiaddr=$varMAC 	
echo Your MAC adress is now $varMAC
read -p "Continue? (Y/y) " -n 1 -r
echo    
if [[ $REPLY =~ ^[Yy]$ ]]
then
    reboot 
fi
            ;;
        "Reset your MAC address to the hardware default")
            echo iSpoof by ally 
echo Resetting your MAC address to hardware default
nvram -d wifiaddr
echo your MAC address is now the hardware default
read -p "Continue? (Y/y) " -n 1 -r
echo    
if [[ $REPLY =~ ^[Yy]$ ]]
then
    reboot 
fi
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
done

