Add fallback tsschecker (for #81)

This commit is contained in:
LukeZGD 2021-07-12 13:39:48 +08:00
parent adcb0a19ef
commit d3d27a0c4f
4 changed files with 21 additions and 5 deletions

View File

@ -1,30 +1,44 @@
#!/bin/bash
SaveOTABlobs() {
local ExtraArgs
local SHSHChk
local SHSHContinue
local SHSHExisting
Log "Saving $OSVer blobs with tsschecker..."
BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist"
ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s"
if [[ $DeviceProc == 7 ]]; then
local APNonce=$($irecovery -q | grep "NONC" | cut -c 7-)
Log "APNonce: $APNonce"
$tsschecker -d $ProductType -B ${HWModel}ap -i $OSVer -e $UniqueChipID -m $BuildManifest --apnonce $APNonce -o -s
ExtraArgs+=" -B ${HWModel}ap --apnonce $APNonce"
SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}_${APNonce}.shsh*
else
$tsschecker -d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s
SHSHChk=${UniqueChipID}_${ProductType}_${OSVer}-${BuildVer}*.shsh*
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 tsschecker..."
$tsschecker2 $ExtraArgs
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
Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs. Continuing..."
cp $SHSHExisting .
SHSH=$(ls $SHSHChk)
else
SHSHContinue=1
fi
if [[ ! -z $SHSH && $SHSHContinue != 1 ]]; then
mkdir -p saved/shsh 2>/dev/null
[[ ! $SHSHExisting ]] && cp "$SHSH" saved/shsh
Log "Successfully saved $OSVer blobs."

View File

@ -14,6 +14,7 @@ SetToolPaths() {
ipwndfu="sudo $python ipwndfu"
rmsigchks="sudo $python rmsigchks.py"
SimpleHTTPServer="sudo -b $python -m SimpleHTTPServer 80"
tsschecker2="env LD_PRELOAD=./resources/lib/libcurl.so.3 LD_LIBRARY_PATH=./resources/lib ./resources/tools/tsschecker2_linux"
elif [[ $OSTYPE == "darwin"* ]]; then
platform="macos"
@ -28,6 +29,7 @@ SetToolPaths() {
ipwndfu="$python ipwndfu"
rmsigchks="$python rmsigchks.py"
SimpleHTTPServer="$python -m SimpleHTTPServer 80"
tsschecker2="./resources/tools/tsschecker2_macos"
fi
git="$(which git)"
ideviceenterrecovery="./resources/libimobiledevice_$platform/ideviceenterrecovery"

BIN
resources/tools/tsschecker2_linux Executable file

Binary file not shown.

BIN
resources/tools/tsschecker2_macos Executable file

Binary file not shown.