2021-05-29 13:26:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SaveOTABlobs() {
|
2022-05-29 16:57:53 +02:00
|
|
|
local APNonce=$1
|
2021-07-12 07:39:48 +02:00
|
|
|
local ExtraArgs
|
2022-07-18 13:53:45 +02:00
|
|
|
local SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh*
|
|
|
|
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
|
|
|
|
|
2022-07-21 07:14:03 +02:00
|
|
|
if [[ $(ls saved/shsh/$SHSHChk 2>/dev/null) && -z $APNonce ]]; then
|
2022-07-21 01:45:13 +02:00
|
|
|
SHSH=$(ls saved/shsh/$SHSHChk)
|
2022-07-21 07:14:03 +02:00
|
|
|
Log "Found existing saved $OSVer blobs: $SHSH"
|
2022-07-18 13:53:45 +02:00
|
|
|
return
|
|
|
|
fi
|
2021-11-18 11:33:15 +01:00
|
|
|
|
|
|
|
Log "Saving iOS $OSVer blobs with tsschecker..."
|
2022-05-29 16:57:53 +02:00
|
|
|
ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap -b "
|
|
|
|
[[ -n $APNonce ]] && ExtraArgs+="--apnonce $APNonce" || ExtraArgs+="-g 0x1111111111111111"
|
2021-07-12 07:39:48 +02:00
|
|
|
$tsschecker $ExtraArgs
|
2021-05-29 13:26:08 +02:00
|
|
|
SHSH=$(ls $SHSHChk)
|
2022-07-18 13:53:45 +02:00
|
|
|
if [[ -n $SHSH ]]; then
|
2021-05-29 13:26:08 +02:00
|
|
|
mkdir -p saved/shsh 2>/dev/null
|
2022-07-21 07:14:03 +02:00
|
|
|
if [[ -n $APNonce ]]; then
|
|
|
|
mv "$SHSH" tmp/
|
|
|
|
SHSH=$(ls tmp/$SHSHChk)
|
|
|
|
else
|
|
|
|
mv "$SHSH" saved/shsh/
|
|
|
|
SHSH=$(ls saved/shsh/$SHSHChk)
|
|
|
|
fi
|
|
|
|
Log "Successfully saved $OSVer blobs: $SHSH"
|
2022-07-18 13:53:45 +02:00
|
|
|
else
|
|
|
|
Error "Saving $OSVer blobs failed. Please run the script again" \
|
|
|
|
"It is also possible that $OSVer for $ProductType is no longer signed"
|
2021-05-29 13:26:08 +02:00
|
|
|
fi
|
|
|
|
}
|
2022-05-28 12:56:10 +02:00
|
|
|
|
|
|
|
Save712Blobs() {
|
2022-12-17 06:41:00 +01:00
|
|
|
local SHSHChk=${UniqueChipID}_${ProductType}_7.1.2-11D257_*.shsh2
|
2022-07-18 13:53:45 +02:00
|
|
|
BuildManifest="saved/$ProductType/BuildManifest.plist"
|
2022-06-08 17:04:56 +02:00
|
|
|
SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh"
|
2022-05-28 12:56:10 +02:00
|
|
|
|
2022-07-18 13:53:45 +02:00
|
|
|
if [[ -e $SHSH ]]; then
|
2022-07-21 07:14:03 +02:00
|
|
|
Log "Found existing saved 7.1.2 blobs: $SHSH"
|
2022-07-18 13:53:45 +02:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2022-07-21 07:14:03 +02:00
|
|
|
if [[ ! -e $BuildManifest ]]; then
|
|
|
|
if [[ -e $IPSW7.ipsw ]]; then
|
|
|
|
Log "Extracting BuildManifest from 7.1.2 IPSW..."
|
|
|
|
unzip -o -j $IPSW7.ipsw BuildManifest.plist -d .
|
|
|
|
else
|
|
|
|
Log "Downloading BuildManifest for 7.1.2..."
|
|
|
|
$partialzip $BasebandURL BuildManifest.plist BuildManifest.plist
|
|
|
|
fi
|
2022-07-18 13:53:45 +02:00
|
|
|
mkdir -p saved/$ProductType 2>/dev/null
|
2022-06-08 17:04:56 +02:00
|
|
|
mv BuildManifest.plist $BuildManifest
|
2022-05-28 12:56:10 +02:00
|
|
|
fi
|
|
|
|
|
2022-05-29 16:57:53 +02:00
|
|
|
Log "Saving 7.1.2 blobs with tsschecker..."
|
2022-06-08 17:04:56 +02:00
|
|
|
$tsschecker -d $ProductType -i 7.1.2 -e $UniqueChipID -m $BuildManifest -s -b
|
2022-12-17 06:41:00 +01:00
|
|
|
SHSHChk=$(ls $SHSHChk)
|
2022-09-24 15:16:41 +02:00
|
|
|
[[ -z $SHSHChk ]] && Error "Saving 7.1.2 blobs failed. Please run the script again"
|
2022-07-21 07:14:03 +02:00
|
|
|
mkdir -p saved/shsh 2>/dev/null
|
2022-05-30 16:17:56 +02:00
|
|
|
mv $SHSHChk $SHSH
|
2022-07-21 07:14:03 +02:00
|
|
|
Log "Successfully saved 7.1.2 blobs: $SHSH"
|
2022-05-28 12:56:10 +02:00
|
|
|
}
|
2022-12-17 06:41:00 +01:00
|
|
|
|
|
|
|
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"
|
|
|
|
}
|