From 4c3b850772cc857ec1896eb1ce2b4a066aeba6b2 Mon Sep 17 00:00:00 2001 From: LukeZGD Date: Thu, 18 Nov 2021 18:33:15 +0800 Subject: [PATCH] Add latest version signing check and fix other stuff --- resources/blobs.sh | 40 +++++++++++++++++++++++----------------- resources/device.sh | 5 +++++ resources/downgrade.sh | 9 ++++----- restore.sh | 1 + 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/resources/blobs.sh b/resources/blobs.sh index 9c1eccc..00f314a 100755 --- a/resources/blobs.sh +++ b/resources/blobs.sh @@ -4,31 +4,37 @@ SaveOTABlobs() { local ExtraArgs local SHSHChk local SHSHContinue + local SHSHLatest local SHSHExisting - Log "Saving $OSVer blobs with tsschecker..." + if [[ $DeviceProc != 7 && $Baseband != 0 && $Baseband8 != 1 ]]; then + Log "Checking signing status of iOS $LatestVer..." + SHSHChk=*_${ProductType}_${HWModel}ap_${LatestVer}*.shsh* + $tsschecker -d $ProductType -i $LatestVer -e $UniqueChipID -s -B ${HWModel}ap + SHSHLatest=$(ls $SHSHChk) + if [[ ! -e $SHSHLatest ]]; then + Error "For some reason, the latest version for your device (iOS $LatestVer) is not signed. Cannot continue." + fi + Log "Latest version for $ProductType (iOS $LatestVer) is signed." + rm $SHSHLatest + fi + + Log "Saving iOS $OSVer blobs with tsschecker..." BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist" - ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap" - SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh* - if [[ $DeviceProc == 7 ]]; then - ExtraArgs+=" --generator 0x1111111111111111" + ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap --generator 0x1111111111111111" + SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}_3a88b7c3802f2f0510abc432104a15ebd8bd7154.shsh* + if [[ $Baseband8 != 1 ]]; then + ExtraArgs+=" --no-baseband" fi $tsschecker $ExtraArgs SHSH=$(ls $SHSHChk) SHSHExisting=$(ls saved/shsh/$SHSHChk 2>/dev/null) - if [[ ! $SHSH && ! $SHSHExisting ]]; then - Log "Saving $OSVer blobs failed. Trying again with fallback..." - ExtraArgs+=" --no-baseband" - $tsschecker $ExtraArgs + if [[ ! -e $SHSH && ! -e $SHSHExisting ]]; then + Error "Saving $OSVer blobs failed. Please run the script again" \ + "It is also possible that $OSVer for $ProductType is no longer signed" - SHSH=$(ls $SHSHChk) - if [[ ! $SHSH ]]; then - Error "Saving $OSVer blobs failed. Please run the script again" \ - "It is also possible that $OSVer for $ProductType is no longer signed" - fi - - elif [[ ! $SHSH ]]; then + elif [[ ! -e $SHSH ]]; then Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs. Continuing..." cp $SHSHExisting . SHSH=$(ls $SHSHChk) @@ -37,7 +43,7 @@ SaveOTABlobs() { if [[ -n $SHSH && $SHSHContinue != 1 ]]; then mkdir -p saved/shsh 2>/dev/null - [[ ! $SHSHExisting ]] && cp "$SHSH" saved/shsh + cp "$SHSH" saved/shsh Log "Successfully saved $OSVer blobs." fi } diff --git a/resources/device.sh b/resources/device.sh index 7de4165..04dc483 100755 --- a/resources/device.sh +++ b/resources/device.sh @@ -83,11 +83,13 @@ GetDeviceValues() { Firmware=resources/firmware/$ProductType Baseband=0 BasebandURL=$(cat $Firmware/13G37/url 2>/dev/null) + LatestVer="9.3.6" if [[ $ProductType == "iPad2,2" ]]; then BasebandURL=$(cat $Firmware/13G36/url) 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" @@ -110,6 +112,7 @@ GetDeviceValues() { BasebandURL=$(cat $Firmware/14G61/url) Baseband="Mav5-11.80.00.Release.bbfw" BasebandSHA1="8951cf09f16029c5c0533e951eb4c06609d0ba7f" + LatestVer="10.3.4" elif [[ $ProductType == "iPad4,2" || $ProductType == "iPad4,3" || $ProductType == "iPad4,5" || $ProductType == "iPhone6,1" || $ProductType == "iPhone6,2" ]]; then @@ -165,7 +168,9 @@ GetDeviceValues() { } Baseband841() { + Baseband8=1 BasebandURL=$(cat $Firmware/12H321/url) + if [[ $ProductType == "iPad2,3" ]]; then Baseband="Phoenix-3.0.04.Release.bbfw" BasebandSHA1="a507ee2fe061dfbf8bee7e512df52ade8777e113" diff --git a/resources/downgrade.sh b/resources/downgrade.sh index 2f35e0d..9828dd1 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -3,7 +3,7 @@ FRBaseband() { local BasebandSHA1L - if [[ $DeviceProc == 7 ]] || [[ $Baseband5 != 0 && $OSVer == "8.4.1" ]]; then + if [[ $DeviceProc == 7 ]] || [[ $Baseband8 == 1 && $OSVer == "8.4.1" ]]; then mkdir -p saved/baseband 2>/dev/null cp -f $IPSWRestore/Firmware/$Baseband saved/baseband fi @@ -16,7 +16,7 @@ FRBaseband() { mv $Baseband saved/baseband mv BuildManifest.plist saved/$ProductType BuildManifest="saved/$ProductType/BuildManifest.plist" - elif [[ $Baseband5 == 0 ]]; then + elif [[ $Baseband8 != 1 ]]; then BuildManifest="saved/$ProductType/BuildManifest.plist" fi @@ -89,12 +89,11 @@ Downgrade() { Echo "* I recommend to disable the option for these devices to flash the iOS 8.4.1 baseband." fi Echo "* This option is enabled by default (Y)." - read -p "$(Input 'Enable this option? (Y/n):')" Baseband5 - if [[ $Baseband5 == 'N' || $Baseband5 == 'n' ]]; then + read -p "$(Input 'Enable this option? (Y/n):')" Baseband8 + if [[ $Baseband8 == 'N' || $Baseband8 == 'n' ]]; then Baseband841 Log "Latest baseband disabled by user. Using iOS 8.4.1 baseband" else - Baseband5=0 Log "Latest baseband enabled." fi echo diff --git a/restore.sh b/restore.sh index 27aed8e..5ceeb7d 100755 --- a/restore.sh +++ b/restore.sh @@ -140,6 +140,7 @@ Main() { Echo "* This custom IPSW has a jailbreak built in ($JBName)" Echo "* Run the script again and select Downgrade Device to use the custom IPSW." Echo "* You may also use futurerestore manually (make sure to use the latest beta)" + exit 0 elif [[ $Mode != "Downgrade" ]]; then $Mode