Use 8.4.1 iBSS only, add baseband sha1sum verifying

This commit is contained in:
LukeeGD 2020-05-05 15:05:49 +08:00
parent c56b61ef07
commit 53444cfa47

View File

@ -6,25 +6,31 @@ function BasebandDetect {
if [ $ProductType == iPad2,2 ]; then if [ $ProductType == iPad2,2 ]; then
BasebandURL=$(cat $Firmware/13G36/url) BasebandURL=$(cat $Firmware/13G36/url)
Baseband=ICE3_04.12.09_BOOT_02.13.Release.bbfw Baseband=ICE3_04.12.09_BOOT_02.13.Release.bbfw
BasebandSHA1=e6f54acc5d5652d39a0ef9af5589681df39e0aca
elif [ $ProductType == iPad2,3 ]; then elif [ $ProductType == iPad2,3 ]; then
Baseband=Phoenix-3.6.03.Release.bbfw Baseband=Phoenix-3.6.03.Release.bbfw
BasebandSHA1=8d4efb2214344ea8e7c9305392068ab0a7168ba4
elif [ $ProductType == iPad2,6 ] || [ $ProductType == iPad2,7 ]; then elif [ $ProductType == iPad2,6 ] || [ $ProductType == iPad2,7 ]; then
Baseband=Mav5-11.80.00.Release.bbfw Baseband=Mav5-11.80.00.Release.bbfw
BasebandSHA1=aa52cf75b82fc686f94772e216008345b6a2a750
elif [ $ProductType == iPad3,2 ] || [ $ProductType == iPad3,3 ]; then elif [ $ProductType == iPad3,2 ] || [ $ProductType == iPad3,3 ]; then
Baseband=Mav4-6.7.00.Release.bbfw Baseband=Mav4-6.7.00.Release.bbfw
BasebandSHA1=a5d6978ecead8d9c056250ad4622db4d6c71d15e
elif [ $ProductType == iPhone4,1 ]; then elif [ $ProductType == iPhone4,1 ]; then
Baseband=Trek-6.7.00.Release.bbfw Baseband=Trek-6.7.00.Release.bbfw
BasebandSHA1=22a35425a3cdf8fa1458b5116cfb199448eecf49
elif [ $ProductType == iPad3,5 ] || [ $ProductType == iPad3,6 ] || elif [ $ProductType == iPad3,5 ] || [ $ProductType == iPad3,6 ] ||
[ $ProductType == iPhone5,1 ] || [ $ProductType == iPhone5,2 ]; then [ $ProductType == iPhone5,1 ] || [ $ProductType == iPhone5,2 ]; then
BasebandURL=$(cat $Firmware/14G61/url) BasebandURL=$(cat $Firmware/14G61/url)
Baseband=Mav5-11.80.00.Release.bbfw Baseband=Mav5-11.80.00.Release.bbfw
BasebandSHA1=8951cf09f16029c5c0533e951eb4c06609d0ba7f
else # For Wi-Fi only devices else # For Wi-Fi only devices
Baseband=0 Baseband=0
fi fi
} }
function Clean { function Clean {
rm -rf iP*/ tmp/ $(ls *_${ProductType}_${DowngradeVer}-*.shsh2 2>/dev/null) $(ls *.bbfw 2>/dev/null) BuildManifest.plist rm -rf iP*/ tmp/ $(ls *_${ProductType}_${OSVer}-*.shsh2 2>/dev/null) $(ls *.bbfw 2>/dev/null) BuildManifest.plist
} }
function Log { function Log {
@ -100,24 +106,20 @@ function SelectVersion {
function Select841 { function Select841 {
echo "iOS 8.4.1 $Mode" echo "iOS 8.4.1 $Mode"
iBSS="iBSS.$HWModel.RELEASE" OSVer="8.4.1"
DowngradeVer="8.4.1" BuildVer="12H321"
DowngradeBuildVer="12H321"
Action Action
} }
function Select613 { function Select613 {
echo "iOS 6.1.3 $Mode" echo "iOS 6.1.3 $Mode"
iBSS="iBSS.${HWModel}ap.RELEASE" OSVer="6.1.3"
DowngradeVer="6.1.3" BuildVer="10B329"
DowngradeBuildVer="10B329"
Action Action
} }
function SelectOther { function SelectOther {
echo "Other $Mode" echo "Other $Mode"
iBSS="iBSS.$HWModel.RELEASE"
DowngradeBuildVer="12H321"
NotOTA=1 NotOTA=1
read -p "[Input] Path to IPSW (drag IPSW to terminal window): " IPSW read -p "[Input] Path to IPSW (drag IPSW to terminal window): " IPSW
IPSW="$(basename "$IPSW" .ipsw)" IPSW="$(basename "$IPSW" .ipsw)"
@ -126,10 +128,9 @@ function SelectOther {
} }
function Action { function Action {
Firmware=$Firmware/$DowngradeBuildVer iBSS="iBSS.$HWModel.RELEASE"
IV=$(cat $Firmware/iv) IV=$(cat $Firmware/12H321/iv)
Key=$(cat $Firmware/key) Key=$(cat $Firmware/12H321/key)
if [[ $Mode == 'Downgrade' ]]; then if [[ $Mode == 'Downgrade' ]]; then
Downgrade Downgrade
elif [[ $Mode == 'SaveOTABlobs' ]]; then elif [[ $Mode == 'SaveOTABlobs' ]]; then
@ -141,21 +142,20 @@ function Action {
} }
function SaveOTABlobs { function SaveOTABlobs {
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${DowngradeVer}.plist" BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
Log "Saving $DowngradeVer blobs with tsschecker..." Log "Saving $OSVer blobs with tsschecker..."
env "LD_PRELOAD=libcurl.so.3" resources/tools/tsschecker_$platform -d $ProductType -i $DowngradeVer -o -s -e $UniqueChipID -m $BuildManifest env "LD_PRELOAD=libcurl.so.3" resources/tools/tsschecker_$platform -d $ProductType -i $OSVer -o -s -e $UniqueChipID -m $BuildManifest
SHSH=$(ls *_${ProductType}_${DowngradeVer}-*.shsh2) SHSH=$(ls *_${ProductType}_${OSVer}-*.shsh2)
[ ! -e "$SHSH" ] && Error "Saving $DowngradeVer blobs failed. Please run the script again" "It is also possible that $DowngradeVer for $ProductType is no longer signed" [ ! -e "$SHSH" ] && Error "Saving $OSVer blobs failed. Please run the script again" "It is also possible that $OSVer for $ProductType is no longer signed"
mkdir -p saved/shsh 2>/dev/null mkdir -p saved/shsh 2>/dev/null
cp "$SHSH" saved/shsh cp "$SHSH" saved/shsh
Log "Successfully saved $DowngradeVer blobs." Log "Successfully saved $OSVer blobs."
} }
function kDFU { function kDFU {
if [ ! -e saved/$ProductType/$iBSS.dfu ]; then if [ ! -e saved/$ProductType/$iBSS.dfu ]; then
# Downloading 8.4.1 iBSS for "other" downgrades
Log "Downloading iBSS..." Log "Downloading iBSS..."
resources/tools/pzb_$platform -g Firmware/dfu/${iBSS}.dfu -o $iBSS.dfu $(cat $Firmware/url) resources/tools/pzb_$platform -g Firmware/dfu/${iBSS}.dfu -o $iBSS.dfu $(cat $Firmware/12H321/url)
mkdir -p saved/$ProductType 2>/dev/null mkdir -p saved/$ProductType 2>/dev/null
mv $iBSS.dfu saved/$ProductType mv $iBSS.dfu saved/$ProductType
fi fi
@ -229,14 +229,14 @@ function FindDFU {
function Downgrade { function Downgrade {
if [ ! $NotOTA ]; then if [ ! $NotOTA ]; then
SaveOTABlobs SaveOTABlobs
IPSW="${ProductType}_${DowngradeVer}_${DowngradeBuildVer}_Restore" IPSW="${ProductType}_${OSVer}_${BuildVer}_Restore"
if [ ! -e "$IPSW.ipsw" ]; then if [ ! -e "$IPSW.ipsw" ]; then
Log "iOS $DowngradeVer IPSW is missing, downloading IPSW..." Log "iOS $OSVer IPSW is missing, downloading IPSW..."
curl -L $(cat $Firmware/url) -o tmp/$IPSW.ipsw curl -L $(cat $Firmware/$BuildVer/url) -o tmp/$IPSW.ipsw
mv tmp/$IPSW.ipsw . mv tmp/$IPSW.ipsw .
fi fi
Log "Verifying IPSW..." Log "Verifying IPSW..."
SHA1IPSW=$(cat $Firmware/sha1sum) SHA1IPSW=$(cat $Firmware/$BuildVer/sha1sum)
SHA1IPSWL=$(sha1sum "$IPSW.ipsw" | awk '{print $1}') SHA1IPSWL=$(sha1sum "$IPSW.ipsw" | awk '{print $1}')
[ $SHA1IPSW != $SHA1IPSWL ] && Error "SHA1 of IPSW does not match. Please run the script again" [ $SHA1IPSW != $SHA1IPSWL ] && Error "SHA1 of IPSW does not match. Please run the script again"
if [ ! $kDFUManual ]; then if [ ! $kDFUManual ]; then
@ -270,8 +270,8 @@ function Downgrade {
else else
cp saved/$ProductType/*.bbfw saved/$ProductType/BuildManifest.plist . cp saved/$ProductType/*.bbfw saved/$ProductType/BuildManifest.plist .
fi fi
if [ ! -e *.bbfw ]; then if [ ! -e *.bbfw ] && [ $(sha1sum $Baseband | awk '{print $1}') != $BasebandSHA1 ]; then
echo "[Error] Downloading baseband failed!" echo "[Error] Downloading/verifying baseband failed!"
echo "Your device is still in kDFU mode, you may run the script again" echo "Your device is still in kDFU mode, you may run the script again"
echo "If you continue, futurerestore can attempt to download the baseband again" echo "If you continue, futurerestore can attempt to download the baseband again"
read -p "[Input] Continue anyway? (y/N)" Continue read -p "[Input] Continue anyway? (y/N)" Continue