Add restore to latest, macOS ver check, fix iOS 4

This commit is contained in:
LukeZGD 2022-12-17 13:41:00 +08:00
parent 211b89112c
commit 584cc0d6f2
33 changed files with 106 additions and 30 deletions

View File

@ -34,7 +34,7 @@ SaveOTABlobs() {
}
Save712Blobs() {
local SHSHChk
local SHSHChk=${UniqueChipID}_${ProductType}_7.1.2-11D257_*.shsh2
BuildManifest="saved/$ProductType/BuildManifest.plist"
SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh"
@ -57,9 +57,23 @@ Save712Blobs() {
Log "Saving 7.1.2 blobs with tsschecker..."
$tsschecker -d $ProductType -i 7.1.2 -e $UniqueChipID -m $BuildManifest -s -b
SHSHChk=$(ls ${UniqueChipID}_${ProductType}_7.1.2-11D257_*.shsh2)
SHSHChk=$(ls $SHSHChk)
[[ -z $SHSHChk ]] && Error "Saving 7.1.2 blobs failed. Please run the script again"
mkdir -p saved/shsh 2>/dev/null
mv $SHSHChk $SHSH
Log "Successfully saved 7.1.2 blobs: $SHSH"
}
SaveLatestBlobs() {
local APNonce=$($irecovery -q | grep "NONC" | cut -c 7-)
local SHSHChk=${UniqueChipID}_${ProductType}_${LatestVer}-${LatestBuildVer}_*.shsh2
SHSH="shsh/${UniqueChipID}-${ProductType}-${LatestVer}.shsh"
Log "Saving $LatestVer blobs with tsschecker..."
mkdir -p saved/$ProductType shsh 2>/dev/null
cp -f $IPSWRestore/BuildManifest.plist saved/$ProductType/
$tsschecker -d $ProductType -i $LatestVer -e $UniqueChipID -m saved/$ProductType/BuildManifest.plist -s -b --apnonce $($irecovery -q | grep "NONC" | cut -c 7-)
SHSHChk=$(ls $SHSHChk)
[[ -z $SHSHChk ]] && Error "Saving $LatestVer blobs failed. Please run the script again"
mv $SHSHChk $SHSH
Log "Successfully saved $LatestVer blobs: $SHSH"
}

View File

@ -20,6 +20,14 @@ SetToolPaths() {
elif [[ $OSTYPE == "darwin"* ]]; then
platform="macos"
platformver="${1:-$(sw_vers -productVersion)}"
if [[ $(echo $platformver | cut -c -2) == 10 ]]; then
local macver=$(echo $platformver | cut -c 4-)
macver=${macver%.*}
if (( macver < 13 )); then
Error "Your macOS version ($platformver) is not supported." \
"You need to be on macOS 10.13 or newer to continue."
fi
fi
MPath+="$platform"
if [[ -e /usr/local/bin/idevicedate && -e /usr/local/bin/irecovery ]]; then
Detect+="Homebrew (Intel Mac)"

View File

@ -102,21 +102,21 @@ GetDeviceValues() {
Firmware=resources/firmware/$ProductType
Baseband=0
BasebandURL=$(cat $Firmware/13G37/url 2>/dev/null)
LatestVer="9.3.6"
LatestBuildVer="13G37"
if [[ $ProductType == "iPad2,2" ]]; then
BasebandURL=$(cat $Firmware/13G36/url)
LatestVer="9.3.5"
LatestBuildVer="13G36"
Baseband="ICE3_04.12.09_BOOT_02.13.Release.bbfw"
BasebandSHA1="e6f54acc5d5652d39a0ef9af5589681df39e0aca"
LatestVer="9.3.5"
elif [[ $ProductType == "iPad2,3" ]]; then
Baseband="Phoenix-3.6.03.Release.bbfw"
BasebandSHA1="8d4efb2214344ea8e7c9305392068ab0a7168ba4"
elif [[ $ProductType == "iPhone3,3" ]]; then
BasebandURL=$(cat $Firmware/11D257/url)
LatestBuildVer="11D257"
Baseband="Phoenix-3.0.04.Release.bbfw"
BasebandSHA1="a507ee2fe061dfbf8bee7e512df52ade8777e113"
@ -134,14 +134,14 @@ GetDeviceValues() {
elif [[ $ProductType == "iPad3,5" || $ProductType == "iPad3,6" ||
$ProductType == "iPhone5,1" || $ProductType == "iPhone5,2" ]]; then
BasebandURL=$(cat $Firmware/14G61/url)
LatestVer="10.3.4"
LatestBuildVer="14G61"
Baseband="Mav5-11.80.00.Release.bbfw"
BasebandSHA1="8951cf09f16029c5c0533e951eb4c06609d0ba7f"
LatestVer="10.3.4"
elif [[ $ProductType == "iPad4,2" || $ProductType == "iPad4,3" || $ProductType == "iPad4,5" ||
$ProductType == "iPhone5"* || $ProductType == "iPhone6"* ]]; then
BasebandURL=$(cat $Firmware/14G60/url)
LatestBuildVer="14G60"
Baseband="Mav7Mav8-7.60.00.Release.bbfw"
BasebandSHA1="f397724367f6bed459cf8f3d523553c13e8ae12c"
if [[ $ProductType == "iPhone5"* ]]; then
@ -150,16 +150,24 @@ GetDeviceValues() {
fi
elif [[ $ProductType == "iPhone3"* ]]; then
BasebandURL=$(cat $Firmware/11D257/url)
LatestBuildVer="11D257"
Baseband="ICE3_04.12.09_BOOT_02.13.Release.bbfw"
BasebandSHA1="007365a5655ac2f9fbd1e5b6dba8f4be0513e364"
elif [[ $ProductType == "iPad2"* || $ProductType == "iPad3"* || $ProductType == "iPad4,1" ||
$ProductType == "iPad4,4" || $ProductType == "iPod5,1" ]]; then
elif [[ $ProductType == "iPad2"* || $ProductType == "iPad3,1" || $ProductType == "iPod5,1" ]]; then
LatestVer="9.3.5"
LatestBuildVer="13G36"
elif [[ $ProductType == "iPad3,4" ]]; then
LatestVer="10.3.3"
LatestBuildVer="14G60"
elif [[ $ProductType == "iPad4,1" || $ProductType == "iPad4,4" ]]; then
BasebandURL=0
else
Error "Your device $ProductType ${version}is not supported."
fi
[[ $BasebandURL != 0 ]] && BasebandURL=$(cat $Firmware/$LatestBuildVer/url 2>/dev/null)
if [[ $ProductType == "iPhone3"* ]]; then
DeviceProc=4
@ -304,6 +312,7 @@ Recovery() {
$ideviceenterrecovery $UniqueDeviceID >/dev/null
FindDevice "Recovery"
fi
[[ $1 == "only" ]] && return
Echo "* Get ready to enter DFU mode."
read -p "$(Input 'Select Y to continue, N to exit recovery (Y/n)')" RecoveryDFU

View File

@ -3,7 +3,7 @@
FRBaseband() {
local BasebandSHA1L
if [[ $DeviceProc == 7 ]]; then
if [[ $DeviceProc == 7 || $1 == "latest" ]]; then
mkdir -p saved/baseband 2>/dev/null
cp -f $IPSWRestore/Firmware/$Baseband saved/baseband/
fi
@ -58,7 +58,7 @@ FutureRestore() {
Log "Device $ProductType has no baseband/disabled baseband update"
ExtraArgs+=("--no-baseband")
else
FRBaseband
FRBaseband $1
if [[ -e saved/baseband/$Baseband && -e $BuildManifest ]]; then
ExtraArgs+=("-b" "saved/baseband/$Baseband" "-p" "$BuildManifest")
else
@ -301,3 +301,18 @@ Downgrade4() {
RetryOption iDeviceRestore
Log "Downgrade script done!"
}
RestoreLatest() {
if [[ $ProductType == "iPhone5"* ]]; then
IPSWType="iPhone_4.0_32bit"
elif [[ $DeviceProc == 6 && $ProductType == "iPad3"* ]]; then
IPSWType="iPad_32bit"
fi
IPSWA7=1
SendiBSS=1
IPSWFindVerify
IPSWSetExtract
Recovery only
SaveLatestBlobs
FutureRestore latest
}

View File

@ -0,0 +1 @@
daa2b495f135151bd5531b8deca99de5ebf613b4

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS9.3.5/031-73136-20160825-6A2B0F0A-6711-11E6-BE6C-193834D2D062/iPad2,1_9.3.5_13G36_Restore.ipsw

View File

@ -0,0 +1 @@
a2653b6bea444f241da601951c17dd7f3e01c916

View File

@ -0,0 +1 @@
5e282665bcf182c14900591a46da2c3290e9b740

View File

@ -0,0 +1 @@
2cd8e2a54693bfa2d4c8d0010215482205c91009

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS9.3.5/031-73989-20160825-088A95A0-6715-11E6-A551-343E34D2D062/iPad2,4_9.3.5_13G36_Restore.ipsw

View File

@ -0,0 +1 @@
11aa53648b32064ff1dcc9752621c23e84a2c524

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS9.3.5/031-74004-20160825-995D69FE-6715-11E6-A974-933E34D2D062/iPad2,5_9.3.5_13G36_Restore.ipsw

View File

@ -0,0 +1 @@
ba0d788fa0bb806f0a42034aba17f0030b202806

View File

@ -0,0 +1 @@
1a5340b9c53a6ac01394211172f4fccbca345b95

View File

@ -0,0 +1 @@
311df97224bbfaa6ac91546b62aeb1e758005ff2

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS9.3.5/031-73961-20160825-88328FDE-6714-11E6-97F2-B63D34D2D062/iPad3,1_9.3.5_13G36_Restore.ipsw

View File

@ -0,0 +1 @@
4e6be7d5fd9f5004bb8c913bf63f6ed5a0c6143d

View File

@ -0,0 +1 @@
540c1348bfdb5660386e414bf4aa9fbd971aafd4

View File

@ -0,0 +1 @@
88bb926d58e9e2497fcc2a941987314fd6656cc2

View File

@ -0,0 +1 @@
http://appldnld.apple.com/ios10.3.3/091-23117-20170719-CA973B02-6977-11E7-953B-279100BA0AE3/iPad_32bit_10.3.3_14G60_Restore.ipsw

View File

@ -0,0 +1 @@
65aad86d4868bdc26185a00e3fd1d3e2a85b5c57

View File

@ -0,0 +1 @@
65aad86d4868bdc26185a00e3fd1d3e2a85b5c57

View File

@ -0,0 +1 @@
6ccddbfdf4a0d6747924252d379ad6d52f7d4ea8

View File

@ -0,0 +1 @@
2f88a216491667ce33e768ab54752d9d0f53dc20

View File

@ -0,0 +1 @@
2f88a216491667ce33e768ab54752d9d0f53dc20

View File

@ -0,0 +1 @@
db8a4d22bda6b9a88b429eb439b5721ceb4e9fd3

View File

@ -0,0 +1 @@
db8a4d22bda6b9a88b429eb439b5721ceb4e9fd3

View File

@ -0,0 +1 @@
8ee90db33805358d4b24b3ef3e9e91914e13e05a

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS9.3.5/031-73183-20160825-6A2D8488-6711-11E6-9C7E-1B3834D2D062/iPod5,1_9.3.5_13G36_Restore.ipsw

View File

@ -387,7 +387,7 @@ IPSW4Cherry() {
Log "Preparing custom IPSW with ch3rryflower..."
cp -R ../$cherrymac/FirmwareBundles ../$cherrymac/src .
unzip -j ../$IPSW.ipsw Firmware/all_flash/all_flash.${HWModel}ap.production/iBoot*
mv iBoot.${HWModel}ap.RELEASE.img3 tmp/
mv iBoot.${HWModel}ap.RELEASE.img3 tmp
$xpwntool tmp ibot.dec -iv $IV -k $Key
../$cherry/bin/iBoot32Patcher ibot.dec ibot.pwned --rsa --boot-partition --boot-ramdisk $ExtraArgs
$xpwntool ibot.pwned iBoot -t tmp

View File

@ -125,8 +125,8 @@ Main() {
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)"
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/different than remote ($LatestVersion)"
elif [[ $(echo $CurrentVersion | cut -c 12-) != $(echo $LatestVersion | cut -c 12-) ]]; then
Echo "* A newer version of iOS-OTA-Downgrader is available."
Echo "* Current version: $CurrentVersion"
@ -173,6 +173,7 @@ Main() {
if [[ $DeviceProc != 7 ]]; then
Selection+=("Create Custom IPSW")
[[ $DeviceState == "Normal" ]] && Selection+=("Put Device in kDFU Mode")
[[ $DeviceProc != 4 && $platform != "win" ]] && Selection+=("Restore to latest iOS")
fi
Selection+=("(Re-)Install Dependencies" "(Any other key to exit)")
@ -186,6 +187,7 @@ Main() {
"Put Device in kDFU Mode" ) Mode="kDFU"; break;;
"Disable/Enable Exploit" ) Mode="Remove4"; break;;
"Restore to 7.1.2" ) Mode="Restore712"; break;;
"Restore to latest iOS" ) Mode="RestoreLatest"; break;;
"SSH Ramdisk" ) Mode="Ramdisk4"; break;;
"(Re-)Install Dependencies" ) InstallDepends;;
* ) exit 0;;
@ -254,15 +256,13 @@ Main() {
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
Echo "* Please specify if the device is already in kDFU mode or not."
read -p "$(Input 'Is your device in kDFU mode? (y/N):')" opt
if [[ $opt == "Y" || $opt == "y" ]]; then
Log "kDFU mode specified by user."
else
EnterPwnDFU
fi
elif [[ $DeviceState == "Normal" ]]; then
Echo "* The device needs to be in recovery/DFU mode before proceeding."
read -p "$(Input 'Send device to recovery mode? (y/N):')" Selection
@ -281,6 +281,7 @@ Main() {
Log "32-bit A${DeviceProc} device detected in DFU mode."
Echo "* DFU Advanced Menu"
Echo "* Please specify if the device is already in kDFU mode or not."
Echo "* Troubleshooting link: https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting#dfu-advanced-menu-for-32-bit-devices"
read -p "$(Input 'Is your device in kDFU mode? (y/N):')" opt
if [[ $opt == "Y" || $opt == "y" ]]; then
Log "kDFU mode specified by user."
@ -318,6 +319,10 @@ SelectVersion() {
OSVer="10.3.3"
BuildVer="14G60"
return
elif [[ $Mode == "RestoreLatest" ]]; then
OSVer=$LatestVer
BuildVer=$LatestBuildVer
return
elif [[ $Mode == "kDFU" || $Mode == *"4" ]]; then
return
fi