2019-11-22 11:48:41 +01:00
|
|
|
#!/bin/bash
|
2021-06-01 03:49:00 +02:00
|
|
|
trap "Clean" EXIT
|
|
|
|
trap "Clean; exit 1" INT TERM
|
2021-05-29 13:26:08 +02:00
|
|
|
|
2021-06-01 03:02:27 +02:00
|
|
|
cd "$(dirname $0)"
|
2021-05-29 13:26:08 +02:00
|
|
|
. ./resources/blobs.sh
|
|
|
|
. ./resources/depends.sh
|
|
|
|
. ./resources/device.sh
|
|
|
|
. ./resources/downgrade.sh
|
|
|
|
. ./resources/ipsw.sh
|
|
|
|
|
2022-07-22 11:43:40 +02:00
|
|
|
for i in "$@"; do
|
|
|
|
if [[ $i == "EntryDevice" ]]; then
|
|
|
|
EntryDevice=1
|
|
|
|
elif [[ $i == "NoColor" ]]; then
|
|
|
|
NoColor=1
|
|
|
|
elif [[ $i == "NoDevice" ]]; then
|
|
|
|
NoDevice=1
|
2022-10-11 03:26:33 +02:00
|
|
|
elif [[ $i == "NoVersionCheck" ]]; then
|
|
|
|
NoVersionCheck=1
|
2022-07-22 11:43:40 +02:00
|
|
|
elif [[ $i == "PwnedDevice" ]]; then
|
|
|
|
PwnedDevice=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ $NoColor != 1 ]]; then
|
2021-09-29 17:19:18 +02:00
|
|
|
TERM=xterm-256color
|
2020-09-01 04:25:27 +02:00
|
|
|
Color_R=$(tput setaf 9)
|
|
|
|
Color_G=$(tput setaf 10)
|
|
|
|
Color_B=$(tput setaf 12)
|
|
|
|
Color_Y=$(tput setaf 11)
|
|
|
|
Color_N=$(tput sgr0)
|
|
|
|
fi
|
2019-11-22 11:48:41 +01:00
|
|
|
|
2021-05-01 08:21:29 +02:00
|
|
|
Clean() {
|
2022-08-27 17:26:09 +02:00
|
|
|
rm -rf iP*/ shsh/ tmp/ *.im4p *.bbfw *.plist *.tmp version.xml
|
2021-11-06 15:10:04 +01:00
|
|
|
kill $iproxyPID $ServerPID 2>/dev/null
|
2020-03-09 02:30:19 +01:00
|
|
|
}
|
|
|
|
|
2021-05-01 08:21:29 +02:00
|
|
|
Echo() {
|
2020-09-01 04:25:27 +02:00
|
|
|
echo "${Color_B}$1 ${Color_N}"
|
|
|
|
}
|
|
|
|
|
2021-05-01 08:21:29 +02:00
|
|
|
Error() {
|
2020-09-01 04:25:27 +02:00
|
|
|
echo -e "\n${Color_R}[Error] $1 ${Color_N}"
|
2021-11-17 07:37:02 +01:00
|
|
|
[[ -n $2 ]] && echo "${Color_R}* $2 ${Color_N}"
|
2020-07-30 17:09:34 +02:00
|
|
|
echo
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 1
|
2020-03-09 02:30:19 +01:00
|
|
|
}
|
|
|
|
|
2021-05-01 08:21:29 +02:00
|
|
|
Input() {
|
2020-09-01 04:25:27 +02:00
|
|
|
echo "${Color_Y}[Input] $1 ${Color_N}"
|
|
|
|
}
|
|
|
|
|
2021-05-01 08:21:29 +02:00
|
|
|
Log() {
|
2020-09-01 04:25:27 +02:00
|
|
|
echo "${Color_G}[Log] $1 ${Color_N}"
|
2020-04-01 04:49:55 +02:00
|
|
|
}
|
|
|
|
|
2022-05-29 16:57:53 +02:00
|
|
|
ExitWin() {
|
|
|
|
if [[ $platform == "win" ]]; then
|
2022-06-05 03:14:07 +02:00
|
|
|
echo
|
2022-05-29 16:57:53 +02:00
|
|
|
Input "Press Enter/Return to exit."
|
|
|
|
read -s
|
|
|
|
fi
|
2022-06-05 03:14:07 +02:00
|
|
|
exit $1
|
2022-05-29 16:57:53 +02:00
|
|
|
}
|
|
|
|
|
2021-05-01 08:21:29 +02:00
|
|
|
Main() {
|
2021-11-07 14:29:31 +01:00
|
|
|
local Selection=()
|
2022-07-24 14:33:27 +02:00
|
|
|
|
2020-07-23 02:47:36 +02:00
|
|
|
clear
|
2020-09-01 04:25:27 +02:00
|
|
|
Echo "******* iOS-OTA-Downgrader *******"
|
2022-04-20 04:39:57 +02:00
|
|
|
Echo " - Downgrader script by LukeZGD - "
|
2020-07-23 02:47:36 +02:00
|
|
|
echo
|
2020-07-27 15:42:41 +02:00
|
|
|
|
2021-10-02 06:46:35 +02:00
|
|
|
if [[ $EUID == 0 ]]; then
|
|
|
|
Error "Running the script as root is not allowed."
|
|
|
|
fi
|
|
|
|
|
2021-07-10 02:25:21 +02:00
|
|
|
if [[ ! -d ./resources ]]; then
|
|
|
|
Error "resources folder cannot be found. Replace resources folder and try again." \
|
|
|
|
"If resources folder is present try removing spaces from path/folder name"
|
|
|
|
fi
|
|
|
|
|
2022-07-24 14:33:27 +02:00
|
|
|
if [[ -d .git ]]; then
|
2022-08-20 06:45:07 +02:00
|
|
|
if [[ $platform == "macos" ]]; then
|
2022-10-11 03:26:33 +02:00
|
|
|
CurrentVersion="$(date -r $(git log -1 --format="%at") +%Y-%m-%d)-$(git rev-parse HEAD | cut -c -7)"
|
2022-08-20 06:45:07 +02:00
|
|
|
else
|
2022-10-11 03:26:33 +02:00
|
|
|
CurrentVersion="$(date -d @$(git log -1 --format="%at") --rfc-3339=date)-$(git rev-parse HEAD | cut -c -7)"
|
2022-08-20 06:45:07 +02:00
|
|
|
fi
|
2022-10-11 03:26:33 +02:00
|
|
|
Echo "Version: $CurrentVersion"
|
2022-07-24 14:33:27 +02:00
|
|
|
elif [[ -e resources/git_hash ]]; then
|
|
|
|
Echo "Version: $(cat resources/git_hash)"
|
|
|
|
else
|
|
|
|
Echo "Version: Unknown"
|
2022-10-11 03:26:33 +02:00
|
|
|
if [[ $NoVersionCheck != 1 ]]; then
|
|
|
|
Error "git_hash or .git not found. Your copy of iOS-OTA-Downgrader is downloaded incorrectly." \
|
|
|
|
"Please download iOS-OTA-Downgrader from the GitHub releases page or using git clone."
|
|
|
|
fi
|
2022-07-24 14:33:27 +02:00
|
|
|
fi
|
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
SetToolPaths
|
2021-07-10 02:25:21 +02:00
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
Error "Setting tool paths failed. Your copy of iOS-OTA-Downgrader seems to be incomplete."
|
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
|
|
|
|
if [[ ! $platform ]]; then
|
|
|
|
Error "Platform unknown/not supported."
|
|
|
|
fi
|
2022-04-29 10:16:31 +02:00
|
|
|
|
2022-06-08 18:14:01 +02:00
|
|
|
chmod +x ./resources/*.sh ./resources/tools/*
|
2021-07-10 02:25:21 +02:00
|
|
|
if [[ $? != 0 ]]; then
|
2021-11-07 14:29:31 +01:00
|
|
|
Error "A problem with file permissions has been detected, cannot proceed."
|
2021-05-29 13:26:08 +02:00
|
|
|
fi
|
|
|
|
|
2021-10-12 09:02:37 +02:00
|
|
|
Log "Checking Internet connection..."
|
2022-08-08 07:29:30 +02:00
|
|
|
$ping 208.67.222.222 >/dev/null
|
2021-11-20 14:56:52 +01:00
|
|
|
if [[ $? != 0 ]]; then
|
2021-05-29 13:26:08 +02:00
|
|
|
Error "Please check your Internet connection before proceeding."
|
|
|
|
fi
|
2022-10-11 03:26:33 +02:00
|
|
|
|
|
|
|
if [[ $NoVersionCheck == 1 ]]; then
|
|
|
|
Log "WARNING - NoVersionCheck detected, update check will be disabled and no support may be provided."
|
|
|
|
else
|
|
|
|
Log "Checking for updates..."
|
|
|
|
LatestVersion=$(curl https://api.github.com/repos/LukeZGD/iOS-OTA-Downgrader/releases/latest 2>/dev/null | grep "latest/iOS-OTA-Downgrader_complete" | cut -c 131- | cut -c -18)
|
|
|
|
if [[ -z $LatestVersion ]]; then
|
|
|
|
Log "WARNING - Failed to check for updates. GitHub may be down or blocked by your network."
|
|
|
|
elif [[ $LatestVersion != $CurrentVersion ]]; then
|
|
|
|
if (( $(echo $CurrentVersion | cut -c -10 | sed -e 's/-//g') > $(echo $LatestVersion | cut -c -10 | sed -e 's/-//g') )); then
|
|
|
|
Log "WARNING - Current version is newer than remote ($LatestVersion)"
|
|
|
|
else
|
|
|
|
Echo "* A newer version of iOS-OTA-Downgrader is available."
|
|
|
|
Echo "* Current version: $CurrentVersion"
|
|
|
|
Echo "* Latest version: $LatestVersion"
|
|
|
|
Echo "* Please download the latest version before continuing."
|
|
|
|
ExitWin 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
|
|
|
|
if [[ $platform == "macos" && $(uname -m) != "x86_64" ]]; then
|
2021-07-12 16:36:51 +02:00
|
|
|
Log "Apple Silicon Mac detected. Support may be limited, proceed at your own risk."
|
2021-05-29 13:26:08 +02:00
|
|
|
elif [[ $(uname -m) != "x86_64" ]]; then
|
|
|
|
Error "Only 64-bit (x86_64) distributions are supported."
|
2021-05-03 05:09:21 +02:00
|
|
|
fi
|
2021-11-20 14:56:52 +01:00
|
|
|
|
|
|
|
if [[ $1 == "Install" || -z $bspatch || ! -e $ideviceinfo || ! -e $irecoverychk ||
|
|
|
|
! -e $ideviceenterrecovery || ! -e $iproxy || -z $python ||
|
2022-07-04 13:58:45 +02:00
|
|
|
! -e ./resources/first_run ]]; then
|
2021-11-20 14:56:52 +01:00
|
|
|
if [[ ! -e $ideviceinfo || ! -e $irecoverychk ||
|
|
|
|
! -e $ideviceenterrecovery || ! -e $iproxy ]]; then
|
|
|
|
rm -rf ./resources/libimobiledevice_$platform
|
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
Clean
|
|
|
|
InstallDepends
|
2020-09-10 11:20:46 +02:00
|
|
|
fi
|
|
|
|
|
2022-07-22 11:43:40 +02:00
|
|
|
GetDeviceValues
|
2020-07-27 15:42:41 +02:00
|
|
|
Clean
|
|
|
|
mkdir tmp
|
2021-10-21 13:42:50 +02:00
|
|
|
|
2022-10-11 03:26:33 +02:00
|
|
|
if [[ -n $1 && $1 != "No"* && $1 != *"Device" ]]; then
|
2021-10-21 13:42:50 +02:00
|
|
|
Mode="$1"
|
|
|
|
else
|
2022-07-22 11:43:40 +02:00
|
|
|
[[ $NoDevice != 1 ]] && Selection+=("Downgrade Device")
|
2022-05-28 12:21:26 +02:00
|
|
|
[[ $DeviceProc != 4 ]] && Selection+=("Save OTA Blobs")
|
|
|
|
|
2022-09-20 14:28:20 +02:00
|
|
|
if [[ $ProductType == "iPhone3"* && $NoDevice != 1 ]]; then
|
|
|
|
Selection+=("Restore to 7.1.2")
|
|
|
|
[[ $ProductType != "iPhone3,2" ]] && Selection+=("Disable/Enable Exploit")
|
|
|
|
[[ $ProductType == "iPhone3,1" ]] && Selection+=("SSH Ramdisk")
|
2022-05-28 12:56:10 +02:00
|
|
|
fi
|
|
|
|
|
2021-11-09 09:59:56 +01:00
|
|
|
if [[ $DeviceProc != 7 ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
Selection+=("Create Custom IPSW")
|
2021-11-09 09:59:56 +01:00
|
|
|
[[ $DeviceState == "Normal" ]] && Selection+=("Put Device in kDFU Mode")
|
2021-10-21 13:42:50 +02:00
|
|
|
fi
|
2022-05-28 12:21:26 +02:00
|
|
|
|
2021-10-21 13:42:50 +02:00
|
|
|
Selection+=("(Re-)Install Dependencies" "(Any other key to exit)")
|
|
|
|
Echo "*** Main Menu ***"
|
|
|
|
Input "Select an option:"
|
|
|
|
select opt in "${Selection[@]}"; do
|
|
|
|
case $opt in
|
2021-11-04 02:07:42 +01:00
|
|
|
"Downgrade Device" ) Mode="Downgrade"; break;;
|
|
|
|
"Save OTA Blobs" ) Mode="SaveOTABlobs"; break;;
|
|
|
|
"Create Custom IPSW" ) Mode="IPSW32"; break;;
|
|
|
|
"Put Device in kDFU Mode" ) Mode="kDFU"; break;;
|
2022-05-28 12:56:10 +02:00
|
|
|
"Disable/Enable Exploit" ) Mode="Remove4"; break;;
|
|
|
|
"Restore to 7.1.2" ) Mode="Restore712"; break;;
|
|
|
|
"SSH Ramdisk" ) Mode="Ramdisk4"; break;;
|
2021-10-21 13:42:50 +02:00
|
|
|
"(Re-)Install Dependencies" ) InstallDepends;;
|
|
|
|
* ) exit 0;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
SelectVersion
|
|
|
|
|
2021-11-04 02:07:42 +01:00
|
|
|
if [[ $Mode == "IPSW32" ]]; then
|
|
|
|
echo
|
2022-08-27 17:30:44 +02:00
|
|
|
[[ $platform == "win" ]] && IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_CustomW"
|
2022-05-28 12:21:26 +02:00
|
|
|
JailbreakOption
|
|
|
|
if [[ -e "$IPSWCustom.ipsw" ]]; then
|
2022-04-20 04:39:57 +02:00
|
|
|
Log "Found existing Custom IPSW, stopping here."
|
|
|
|
Echo "* If you want to re-create the custom IPSW, move/delete the existing one first."
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 0
|
2022-05-29 16:57:53 +02:00
|
|
|
elif [[ $Jailbreak != 1 && $platform != "win" ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
if [[ $DeviceProc == 4 && $OSVer == "7.1.2" ]]; then
|
|
|
|
Log "Creating custom IPSW is not needed for non-jailbroken 7.1.2 restores."
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 0
|
2022-08-27 17:26:09 +02:00
|
|
|
elif [[ $ProductType != "iPhone3"* && $ProductType != "$DisableBBUpdate" ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
Log "Creating custom IPSW is not needed for non-jailbroken restores on your device."
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 0
|
2022-05-28 12:56:10 +02:00
|
|
|
fi
|
2022-04-20 04:39:57 +02:00
|
|
|
fi
|
2022-05-28 12:21:26 +02:00
|
|
|
|
|
|
|
IPSWFindVerify
|
2022-05-28 12:56:10 +02:00
|
|
|
if [[ $DeviceProc == 4 ]]; then
|
2022-07-03 03:51:54 +02:00
|
|
|
[[ $OSVer != "7.1.2" ]] && IPSWFindVerify 712
|
2022-05-28 12:56:10 +02:00
|
|
|
IPSW4
|
|
|
|
else
|
|
|
|
IPSW32
|
|
|
|
fi
|
2021-11-04 02:07:42 +01:00
|
|
|
Log "Custom IPSW has been created: $IPSWCustom.ipsw"
|
2022-05-28 12:56:10 +02:00
|
|
|
[[ $Jailbreak == 1 ]] && Echo "* This custom IPSW has a jailbreak built in ($JBName)"
|
2021-11-06 15:10:04 +01:00
|
|
|
Echo "* Run the script again and select Downgrade Device to use the custom IPSW."
|
2022-05-29 16:57:53 +02:00
|
|
|
if [[ $DeviceProc != 4 && $platform != "win" ]]; then
|
|
|
|
Echo "* You may also use futurerestore manually (make sure to use the latest beta)"
|
|
|
|
fi
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 0
|
2021-11-04 02:07:42 +01:00
|
|
|
|
2022-05-28 12:56:10 +02:00
|
|
|
elif [[ $Mode != "Downgrade"* && $Mode != *"4" ]]; then
|
2021-10-21 13:42:50 +02:00
|
|
|
$Mode
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 0
|
2021-10-21 13:42:50 +02:00
|
|
|
fi
|
|
|
|
|
2022-07-20 12:21:30 +02:00
|
|
|
if [[ $DeviceProc == 7 && $platform == "win" ]]; then
|
2022-05-29 16:57:53 +02:00
|
|
|
local Message="If you want to restore your A7 device on Windows, put the device in pwnDFU mode."
|
|
|
|
if [[ $DeviceState == "Normal" ]]; then
|
|
|
|
Error "$Message"
|
|
|
|
elif [[ $DeviceState == "Recovery" ]]; then
|
|
|
|
Log "A7 device detected in recovery mode."
|
|
|
|
Log "$Message"
|
|
|
|
RecoveryExit
|
|
|
|
elif [[ $DeviceState == "DFU" ]]; then
|
|
|
|
Log "A7 device detected in DFU mode."
|
|
|
|
Echo "* Make sure that your device is already in pwnDFU mode with signature checks disabled."
|
|
|
|
Echo "* If your device is not in pwnDFU mode, the restore will not proceed!"
|
|
|
|
Echo "* Entering pwnDFU mode is not supported on Windows. You need to use a Mac/Linux machine or another iOS device to do so."
|
|
|
|
Input "Press Enter/Return to continue (or press Ctrl+C to cancel)"
|
|
|
|
read -s
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif [[ $Mode == *"4" || $DeviceProc == 7 ]]; then
|
2022-07-04 04:45:05 +02:00
|
|
|
if [[ $DeviceState == "Normal" && $OSVer == "7.1.2" ]]; then
|
|
|
|
kDFU
|
|
|
|
elif [[ $DeviceState == "DFU" && $OSVer == "7.1.2" ]]; then
|
|
|
|
Input "Select the mode that your device is currently in:"
|
|
|
|
Selection=("kDFU mode" "DFU/pwnDFU mode")
|
|
|
|
select opt in "${Selection[@]}"; do
|
|
|
|
case $opt in
|
|
|
|
"kDFU mode" ) break;;
|
|
|
|
"DFU/pwnDFU mode" ) EnterPwnDFU; break;;
|
|
|
|
* ) exit 0;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
elif [[ $DeviceState == "Normal" ]]; then
|
2021-05-29 13:26:08 +02:00
|
|
|
Echo "* The device needs to be in recovery/DFU mode before proceeding."
|
|
|
|
read -p "$(Input 'Send device to recovery mode? (y/N):')" Selection
|
|
|
|
[[ $Selection == 'Y' || $Selection == 'y' ]] && Recovery || exit
|
|
|
|
elif [[ $DeviceState == "Recovery" ]]; then
|
|
|
|
Recovery
|
|
|
|
elif [[ $DeviceState == "DFU" ]]; then
|
2022-05-28 12:21:26 +02:00
|
|
|
EnterPwnDFU
|
2021-05-29 13:26:08 +02:00
|
|
|
fi
|
2022-05-28 12:56:10 +02:00
|
|
|
if [[ $Mode == *"4" ]]; then
|
|
|
|
$Mode
|
2022-07-23 05:50:57 +02:00
|
|
|
ExitWin 0
|
2022-05-28 12:56:10 +02:00
|
|
|
fi
|
2022-05-28 12:21:26 +02:00
|
|
|
|
2021-05-29 13:26:08 +02:00
|
|
|
elif [[ $DeviceState == "DFU" ]]; then
|
2022-07-22 11:43:40 +02:00
|
|
|
if [[ $PwnedDevice != 1 ]]; then
|
2021-11-25 08:24:50 +01:00
|
|
|
echo -e "\n${Color_R}[Error] 32-bit A${DeviceProc} device detected in DFU mode. ${Color_N}"
|
|
|
|
echo "${Color_Y}* Please put the device in normal mode and jailbroken before proceeding. ${Color_N}"
|
|
|
|
echo "${Color_Y}* Exit DFU mode by holding the TOP and HOME buttons for 15 seconds. ${Color_N}"
|
|
|
|
echo "${Color_Y}* For usage of the DFU Advanced Menu, add PwnedDevice as an argument. ${Color_N}"
|
|
|
|
echo "${Color_Y}* For more details, read the \"Troubleshooting\" wiki page in GitHub ${Color_N}"
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 1
|
2021-11-25 08:24:50 +01:00
|
|
|
fi
|
|
|
|
echo
|
|
|
|
Echo "* DFU Advanced Menu"
|
|
|
|
Echo "* This menu is for ADVANCED USERS ONLY."
|
|
|
|
Echo "* If you do not know what you are doing, EXIT NOW by pressing Ctrl+C and restart your device in normal mode."
|
|
|
|
Input "Select the mode that your device is currently in:"
|
2021-05-29 13:26:08 +02:00
|
|
|
Selection=("kDFU mode")
|
2022-05-29 16:57:53 +02:00
|
|
|
if [[ $platform != "win" ]]; then
|
|
|
|
[[ $DeviceProc == 5 ]] && Selection+=("pwnDFU mode (A5)") || Selection+=("DFU mode (A4/A6)")
|
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
Selection+=("Any other key to exit")
|
|
|
|
select opt in "${Selection[@]}"; do
|
|
|
|
case $opt in
|
|
|
|
"kDFU mode" ) break;;
|
2022-05-28 12:56:10 +02:00
|
|
|
"DFU mode (A4/A6)" ) EnterPwnDFU; break;;
|
2022-07-07 08:21:53 +02:00
|
|
|
"pwnDFU mode (A5)" ) SendPwnediBSSA5; break;;
|
2021-05-30 05:03:39 +02:00
|
|
|
* ) exit 0;;
|
2021-05-29 13:26:08 +02:00
|
|
|
esac
|
2020-08-12 16:05:51 +02:00
|
|
|
done
|
2020-08-22 03:52:58 +02:00
|
|
|
Log "Downgrading $ProductType in kDFU/pwnDFU mode..."
|
2021-05-29 13:26:08 +02:00
|
|
|
|
|
|
|
elif [[ $DeviceState == "Recovery" ]]; then
|
2022-05-29 16:57:53 +02:00
|
|
|
if [[ $DeviceProc == 4 || $DeviceProc == 6 ]] && [[ $platform != "win" ]]; then
|
2020-09-07 09:55:38 +02:00
|
|
|
Recovery
|
|
|
|
else
|
2021-09-30 07:05:27 +02:00
|
|
|
Log "32-bit A${DeviceProc} device detected in recovery mode."
|
2021-05-29 13:26:08 +02:00
|
|
|
Echo "* Please put the device in normal mode and jailbroken before proceeding."
|
2021-11-25 08:24:50 +01:00
|
|
|
Echo "* For usage of the DFU Advanced Menu, put the device in kDFU or pwnDFU mode"
|
2021-09-30 05:49:41 +02:00
|
|
|
RecoveryExit
|
2020-09-07 09:55:38 +02:00
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
Log "Downgrading $ProductType in pwnDFU mode..."
|
2020-07-23 04:08:46 +02:00
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
|
2021-10-21 13:42:50 +02:00
|
|
|
Downgrade
|
2022-09-04 04:08:03 +02:00
|
|
|
Log "Downgrade script done!"
|
2022-06-05 03:14:07 +02:00
|
|
|
ExitWin 0
|
2020-03-05 12:48:41 +01:00
|
|
|
}
|
|
|
|
|
2021-05-01 08:21:29 +02:00
|
|
|
SelectVersion() {
|
2022-05-31 02:14:24 +02:00
|
|
|
if [[ $DeviceProc == 7 ]]; then
|
2021-05-29 13:26:08 +02:00
|
|
|
OSVer="10.3.3"
|
|
|
|
BuildVer="14G60"
|
|
|
|
return
|
2022-05-31 02:14:24 +02:00
|
|
|
elif [[ $Mode == "kDFU" || $Mode == *"4" ]]; then
|
|
|
|
return
|
2020-07-23 02:47:36 +02:00
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
|
2022-05-28 12:21:26 +02:00
|
|
|
if [[ $ProductType == "iPhone5,3" || $ProductType == "iPhone5,4" || $ProductType == "iPhone3"* ]]; then
|
2021-01-10 08:27:00 +01:00
|
|
|
Selection=()
|
|
|
|
else
|
|
|
|
Selection=("iOS 8.4.1")
|
|
|
|
fi
|
2021-05-29 13:26:08 +02:00
|
|
|
|
|
|
|
if [[ $ProductType == "iPad2,1" || $ProductType == "iPad2,2" ||
|
|
|
|
$ProductType == "iPad2,3" || $ProductType == "iPhone4,1" ]]; then
|
2020-09-16 08:50:12 +02:00
|
|
|
Selection+=("iOS 6.1.3")
|
2020-03-05 12:48:41 +01:00
|
|
|
fi
|
2022-05-28 12:56:10 +02:00
|
|
|
|
2022-09-20 14:28:20 +02:00
|
|
|
if [[ $ProductType == "iPhone3"* ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
[[ $Mode == "IPSW32" ]] && Selection+=("7.1.2")
|
2022-09-20 14:29:49 +02:00
|
|
|
[[ $ProductType != "iPhone3,2" ]] && Selection+=("6.1.3")
|
2022-09-20 14:28:20 +02:00
|
|
|
|
2022-10-08 06:25:24 +02:00
|
|
|
if [[ $platform == "macos" ]]; then
|
|
|
|
Echo "* Using iPhone4Down on macOS is not recommended for downgrading."
|
|
|
|
Echo "* Please use powdersn0w or cherryflowerJB from dora2ios instead."
|
|
|
|
fi
|
|
|
|
|
2022-09-20 14:28:20 +02:00
|
|
|
if [[ $ProductType == "iPhone3,1" ]]; then
|
2022-09-20 14:29:49 +02:00
|
|
|
Selection+=("5.1.1 (9B208)" "5.1.1 (9B206)")
|
2022-09-20 14:28:20 +02:00
|
|
|
Selection2=("6.1.2" "6.1" "6.0.1" "6.0" "5.1" "5.0.1" "5.0")
|
|
|
|
if [[ $platform != "linux" ]]; then
|
|
|
|
Echo "* iOS 4.3.x downgrades are supported on Linux only"
|
|
|
|
Echo "* For macOS users, use cherryflowerJB instead"
|
|
|
|
fi
|
|
|
|
if [[ $platform != "win" ]]; then
|
|
|
|
Selection+=("4.3.5")
|
|
|
|
Selection2+=("4.3.3" "4.3")
|
|
|
|
fi
|
|
|
|
Selection+=("More versions")
|
2022-09-20 14:29:49 +02:00
|
|
|
|
|
|
|
elif [[ $ProductType == "iPhone3,3" && $platform != "macos" && $Mode != "Restore712" ]]; then
|
|
|
|
Echo "* For creating 6.1.3 custom IPSW, make sure to have darling installed: https://github.com/darlinghq/darling"
|
|
|
|
Echo "* For Ubuntu/Debian, you may install the .deb from releases."
|
|
|
|
Echo "* For Arch, you may install darling-bin from AUR."
|
|
|
|
Echo "* For other distros, you might need to build darling yourself."
|
2022-09-20 14:28:20 +02:00
|
|
|
fi
|
|
|
|
|
2022-07-24 03:15:52 +02:00
|
|
|
if [[ $Mode == "Restore712" ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
Echo "* Make sure to disable the exploit first! See the README for more details."
|
|
|
|
Input "Press Enter/Return to continue (or press Ctrl+C to cancel)"
|
|
|
|
read -s
|
|
|
|
OSVer="7.1.2"
|
|
|
|
BuildVer="11D257"
|
|
|
|
Mode="Downgrade4"
|
|
|
|
return
|
2022-07-22 09:41:52 +02:00
|
|
|
fi
|
2022-09-20 14:28:20 +02:00
|
|
|
|
2022-07-22 09:41:52 +02:00
|
|
|
if [[ $Mode == "Downgrade" ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
Mode="Downgrade4"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-07-24 03:15:52 +02:00
|
|
|
if [[ $platform != "win" && $Mode == "Downgrade"* ]]; then
|
|
|
|
Selection+=("Other (use SHSH blobs)")
|
2022-05-29 16:57:53 +02:00
|
|
|
fi
|
2020-07-27 13:27:46 +02:00
|
|
|
Selection+=("(Any other key to exit)")
|
2021-05-29 13:26:08 +02:00
|
|
|
|
2021-10-12 09:02:37 +02:00
|
|
|
echo
|
2020-09-01 04:25:27 +02:00
|
|
|
Input "Select iOS version:"
|
2020-04-01 04:16:29 +02:00
|
|
|
select opt in "${Selection[@]}"; do
|
2021-05-29 13:26:08 +02:00
|
|
|
case $opt in
|
|
|
|
"iOS 8.4.1" ) OSVer="8.4.1"; BuildVer="12H321"; break;;
|
|
|
|
"iOS 6.1.3" ) OSVer="6.1.3"; BuildVer="10B329"; break;;
|
|
|
|
"Other (use SHSH blobs)" ) OSVer="Other"; break;;
|
2022-05-28 12:56:10 +02:00
|
|
|
"7.1.2" ) OSVer="7.1.2"; BuildVer="11D257"; break;;
|
|
|
|
"6.1.3" ) OSVer="6.1.3"; BuildVer="10B329"; break;;
|
|
|
|
"5.1.1 (9B208)" ) OSVer="5.1.1"; BuildVer="9B208"; break;;
|
|
|
|
"5.1.1 (9B206)" ) OSVer="5.1.1"; BuildVer="9B206"; break;;
|
2022-07-17 04:24:12 +02:00
|
|
|
"4.3.5" ) OSVer="4.3.5"; BuildVer="8L1"; break;;
|
2022-07-22 09:41:52 +02:00
|
|
|
"More versions" ) OSVer="More"; break;;
|
2022-03-05 12:57:23 +01:00
|
|
|
* ) exit 0;;
|
2021-05-29 13:26:08 +02:00
|
|
|
esac
|
2020-07-23 02:47:36 +02:00
|
|
|
done
|
2022-05-28 12:56:10 +02:00
|
|
|
|
2022-07-24 03:15:52 +02:00
|
|
|
if [[ $OSVer == "Other" ]]; then
|
|
|
|
Mode="Downgrade"
|
|
|
|
elif [[ $OSVer == "More" ]]; then
|
2022-05-28 12:56:10 +02:00
|
|
|
select opt in "${Selection2[@]}"; do
|
|
|
|
case $opt in
|
|
|
|
"6.1.2" ) OSVer="6.1.2"; BuildVer="10B146"; break;;
|
|
|
|
"6.1" ) OSVer="6.1"; BuildVer="10B144"; break;;
|
|
|
|
"6.0.1" ) OSVer="6.0.1"; BuildVer="10A523"; break;;
|
|
|
|
"6.0" ) OSVer="6.0"; BuildVer="10A403"; break;;
|
|
|
|
"5.1" ) OSVer="5.1"; BuildVer="9B176"; break;;
|
|
|
|
"5.0.1" ) OSVer="5.0.1"; BuildVer="9A405"; break;;
|
|
|
|
"5.0" ) OSVer="5.0"; BuildVer="9A334"; break;;
|
|
|
|
"4.3.3" ) OSVer="4.3.3"; BuildVer="8J2"; break;;
|
|
|
|
"4.3" ) OSVer="4.3"; BuildVer="8F190"; break;;
|
|
|
|
* ) exit 0;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
2020-07-23 02:47:36 +02:00
|
|
|
}
|
|
|
|
|
2020-07-23 04:08:46 +02:00
|
|
|
Main $1
|