A bit of code restructure

This commit is contained in:
LukeZGD 2022-05-28 18:21:26 +08:00
parent d703ab0157
commit e74fe5f03b
17 changed files with 211 additions and 193 deletions

View File

@ -15,6 +15,7 @@
- [Identify your device here](https://ipsw.me/device-finder)
- **iPhone 5C and iPad mini 3 devices are NOT supported!**
- iPhone 5C can still be restored to versions that you have SHSH blobs for
- iPhone 4 devices also support restoring with SHSH blobs (iOS 5 and newer only)
<table>
<thead>

View File

@ -30,7 +30,7 @@ SaveOTABlobs() {
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 --generator 0x1111111111111111 --no-baseband"
ExtraArgs="-d $ProductType -i $OSVer -e $UniqueChipID -m $BuildManifest -o -s -B ${HWModel}ap -g 0x1111111111111111 -b"
SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}_3a88b7c3802f2f0510abc432104a15ebd8bd7154.shsh*
$tsschecker $ExtraArgs
@ -41,7 +41,7 @@ SaveOTABlobs() {
"It is also possible that $OSVer for $ProductType is no longer signed"
elif [[ ! -e $SHSH ]]; then
Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs. Continuing..."
Log "Saving $OSVer blobs failed, but found existing saved SHSH blobs."
cp $SHSHExisting .
SHSH=$(ls $SHSHChk)
SHSHContinue=1

View File

@ -44,11 +44,12 @@ SetToolPaths() {
ideviceenterrecovery="$MPath/ideviceenterrecovery"
ideviceinfo="$MPath/ideviceinfo"
iproxy="$MPath/iproxy"
ipsw="./tools/ipsw_$platform"
ipsw="../resources/tools/ipsw_$platform"
ipwndfu="$python ipwndfu"
irecoverychk="$MPath/irecovery"
irecovery="$irecoverychk"
partialzip="./resources/tools/partialzip_$platform"
ping="ping -c1"
rmsigchks="$python rmsigchks.py"
SimpleHTTPServer="$python -m SimpleHTTPServer 8888"
SSH="-F ./resources/ssh_config"
@ -78,7 +79,6 @@ SetToolPaths() {
SaveExternal() {
local ExternalURL="https://github.com/$1/$2.git"
local External=$2
[[ $2 == "iOS-OTA-Downgrader-Keys" ]] && External="firmware"
cd resources
if [[ ! -d $External || ! -d $External/.git ]]; then
Log "Downloading $External..."
@ -150,7 +150,7 @@ InstallDepends() {
elif [[ $platform == "macos" ]]; then
xcode-select --install
libimobiledevice=("https://github.com/libimobiledevice-win32/imobiledevice-net/releases/download/v1.3.14/libimobiledevice.1.2.1-r1116-osx-x64.zip" "328e809dea350ae68fb644225bbf8469c0f0634b")
libimobiledevice=("https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/libimobiledevice_macos.zip" "66a49e4f69757a3d9dc51109a8e4651020bfacb8")
Echo "* iOS-OTA-Downgrader provides a copy of libimobiledevice and libirecovery by default"
Echo "* In case that problems occur, try installing them from Homebrew"
Echo "* The script will detect this automatically and will use the Homebrew versions of the tools"

View File

@ -5,8 +5,12 @@ FindDevice() {
local i=0
local Timeout=999
local USB
[[ $1 == "DFU" ]] && USB=1227 || USB=1281
[[ -n $2 ]] && Timeout=3
if [[ $1 == "DFU" ]]; then
USB=1227
elif [[ $1 == "Recovery" ]]; then
USB=1281
fi
[[ -n $2 ]] && Timeout=5
Log "Finding device in $1 mode..."
while (( i < Timeout )); do
@ -92,7 +96,7 @@ GetDeviceValues() {
BasebandSHA1="e6f54acc5d5652d39a0ef9af5589681df39e0aca"
LatestVer="9.3.5"
elif [[ $ProductType == "iPad2,3" ]]; then
elif [[ $ProductType == "iPad2,3" || $ProductType == "iPhone3,3" ]]; then
Baseband="Phoenix-3.6.03.Release.bbfw"
BasebandSHA1="8d4efb2214344ea8e7c9305392068ab0a7168ba4"
@ -116,20 +120,32 @@ GetDeviceValues() {
LatestVer="10.3.4"
elif [[ $ProductType == "iPad4,2" || $ProductType == "iPad4,3" || $ProductType == "iPad4,5" ||
$ProductType == "iPhone6,1" || $ProductType == "iPhone6,2" ||
$ProductType == "iPhone5,3" || $ProductType == "iPhone5,4" ]]; then
$ProductType == "iPhone5"* || $ProductType == "iPhone6"* ]]; then
BasebandURL=$(cat $Firmware/14G60/url)
Baseband="Mav7Mav8-7.60.00.Release.bbfw"
BasebandSHA1="f397724367f6bed459cf8f3d523553c13e8ae12c"
if [[ $ProductType == "iPhone5"* ]]; then
Log "iPhone 5C detected. Your device does not support OTA downgrades."
Echo "* Functions will be limited to entering kDFU and restoring with blobs."
fi
elif [[ $ProductType != "iPad2"* && $ProductType != "iPad3"* && $ProductType != "iPad4,1" &&
$ProductType != "iPad4,4" && $ProductType != "iPod5,1" ]]; then
Error "Your device $ProductType ${version}is not supported."
else
elif [[ $ProductType == "iPhone3"* ]]; then
BasebandURL=$(cat $Firmware/11D257/url)
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
BasebandURL=0
else
Error "Your device $ProductType ${version}is not supported."
fi
if [[ $ProductType == "iPad2"* || $ProductType == "iPad3,1" || $ProductType == "iPad3,2" ||
if [[ $ProductType == "iPhone3"* ]]; then
DeviceProc=4
Log "$ProductType detected. Your device does not support OTA downgrades."
Echo "* Functions will be limited to entering kDFU and restoring with blobs."
elif [[ $ProductType == "iPad2"* || $ProductType == "iPad3,1" || $ProductType == "iPad3,2" ||
$ProductType == "iPad3,3" || $ProductType == "iPhone4,1" || $ProductType == "iPod5,1" ]]; then
DeviceProc=5
elif [[ $ProductType == "iPhone5"* || $ProductType == "iPad3"* ]]; then
@ -148,7 +164,7 @@ GetDeviceValues() {
if [[ $ProductType == "iPod5,1" ]]; then
iBSS="${HWModel}ap"
iBSSBuildVer="10B329"
elif [[ $ProductType == "iPad3,1" ]]; then
elif [[ $ProductType == "iPad3,1" || $ProductType == "iPhone3"* ]]; then
iBSS="${HWModel}ap"
iBSSBuildVer="11D257"
elif [[ $ProductType == "iPhone6"* ]]; then
@ -169,23 +185,22 @@ GetDeviceValues() {
Log "ECID: $UniqueChipID"
}
CheckM8() {
EnterPwnDFU() {
local pwnDFUTool
local pwnDFUDevice
local pwnD=1
if [[ $platform == "macos" ]]; then
Selection=("iPwnder32" "ipwnder_lite")
Selection=("ipwnder_lite" "iPwnder32")
Input "PwnDFU Tool Option"
Echo "* This option selects what tool to use to put your device in pwnDFU mode."
Echo "* If unsure, select 1 for Intel Macs, select 2 for Apple Silicon (M1) Macs."
Echo "* This option is set to iPwnder32 by default (1)."
Echo "* If unsure, select 1. Select 2 if 1 does not work."
Echo "* This option is set to ${Selection[0]} by default (1)."
Input "Select your option:"
select opt in "${Selection[@]}"; do
case $opt in
"ipwnder_lite" ) pwnDFUTool="$ipwnder_lite"; break;;
"ipwndfu" ) pwnDFUTool="ipwndfu"; break;;
* ) pwnDFUTool="$ipwnder32"; break;;
"iPwnder32" ) pwnDFUTool="$ipwnder32"; break;;
esac
done
else
@ -197,21 +212,21 @@ CheckM8() {
cd resources/ipwndfu
Echo "* Enter your user password when prompted"
$ipwndfu -p
if [[ $DeviceProc == 7 ]]; then
pwnDFUDevice=$?
if [[ $DeviceProc == 7 ]]; then
Log "Running rmsigchks.py..."
$rmsigchks
pwnDFUDevice=$?
cd ../..
else
cd ../..
kDFU iBSS || echo
pwnDFUDevice=$?
SendiBSS=1
fi
cd ../..
else
$pwnDFUTool -p
pwnDFUDevice=$?
fi
[[ $DeviceProc == 7 ]] && pwnD=$($irecovery -q | grep -c "PWND")
[[ $DeviceProc == 4 ]] && SendiBSS=1
if [[ $pwnDFUDevice != 0 && $pwnD != 1 ]]; then
echo -e "\n${Color_R}[Error] Failed to enter pwnDFU mode. Please run the script again ${Color_N}"
@ -246,8 +261,8 @@ Recovery() {
exit 0
fi
Echo "* Hold TOP and HOME buttons for 8 seconds."
for i in {08..01}; do
Echo "* Hold TOP and HOME buttons for 10 seconds."
for i in {10..01}; do
echo -n "$i "
sleep 1
done
@ -259,7 +274,7 @@ Recovery() {
echo
FindDevice "DFU" error
CheckM8
EnterPwnDFU
}
RecoveryExit() {
@ -275,6 +290,17 @@ kDFU() {
local kloader
local VerDetect=$(echo $ProductVer | cut -c 1)
if [[ $DeviceState != "Normal" ]]; then
Log "Device is already in $DeviceState mode"
return
fi
if [[ $iBSSBuildVer == $BuildVer && -e "$IPSW.ipsw" ]]; then
Log "Extracting iBSS from IPSW..."
mkdir -p saved/$ProductType 2>/dev/null
unzip -o -j $IPSW.ipsw Firmware/dfu/$iBSS.dfu -d saved/$ProductType
fi
if [[ ! -e saved/$ProductType/$iBSS.dfu ]]; then
Log "Downloading iBSS..."
$partialzip "$(cat $Firmware/$iBSSBuildVer/url)" Firmware/dfu/$iBSS.dfu $iBSS.dfu
@ -289,21 +315,6 @@ kDFU() {
Log "Patching iBSS..."
$bspatch saved/$ProductType/$iBSS.dfu tmp/pwnediBSS resources/patches/$iBSS.patch
if [[ $1 == iBSS ]]; then
cd resources/ipwndfu
if [[ $platform == "macos" ]]; then
Echo "* Attempting to send pwned iBSS."
Echo "* This will fail on Apple Silicon Macs, as well as on macOS 12.3 and later."
Echo "* If this is the case, you need to send pwned iBSS yourself before continuing."
Echo "* For more details, read the \"Troubleshooting\" wiki page in GitHub"
fi
Log "Sending iBSS..."
$ipwndfu -l ../../tmp/pwnediBSS
local ret=$?
cd ../..
return $ret
fi
[[ $VerDetect == 1 ]] && kloader="kloader_hgsp"
[[ $VerDetect == 5 ]] && kloader="kloader5"
[[ ! $kloader ]] && kloader="kloader"

View File

@ -32,91 +32,8 @@ FRBaseband() {
fi
}
Downgrade() {
FutureRestore() {
local ExtraArgs=("--use-pwndfu")
local IPSWExtract
Verify=1
Log "Select your options when asked. If unsure, go for the defaults (press Enter/Return)."
echo
if [[ $OSVer == "Other" ]]; then
Input "Select your IPSW file in the file selection window."
IPSW="$($zenity --file-selection --file-filter='IPSW | *.ipsw' --title="Select IPSW file")"
[[ ! -s "$IPSW" ]] && Error "No IPSW selected, or IPSW file not found."
IPSW="${IPSW%?????}"
Log "Selected IPSW file: $IPSW.ipsw"
Input "Select your SHSH file in the file selection window."
SHSH="$($zenity --file-selection --file-filter='SHSH | *.shsh *.shsh2' --title="Select SHSH file")"
[[ ! -s "$SHSH" ]] && Error "No SHSH selected, or SHSH file not found."
Log "Selected SHSH file: $SHSH"
unzip -o -j "$IPSW.ipsw" Restore.plist -d tmp
BuildVer=$(cat tmp/Restore.plist | grep -i ProductBuildVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+")
Log "Getting firmware keys for $ProductType-$BuildVer"
mkdir resources/firmware/$ProductType/$BuildVer 2>/dev/null
curl -L https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/raw/master/$ProductType/$BuildVer/index.html -o tmp/index.html
mv tmp/index.html resources/firmware/$ProductType/$BuildVer
elif [[ $DeviceProc != 7 ]]; then
Input "Jailbreak Option"
Echo "* When this option is enabled, your device will be jailbroken on restore."
if [[ $ProductType == "iPad2,5" || $ProductType == "iPad2,6" || $ProductType == "iPad2,7" ]]; then
Echo "* Based on some reported issues, Jailbreak Option might be broken for iPad mini 1 devices."
Echo "* I recommend to disable the option for these devices and sideload EtasonJB, HomeDepot, or daibutsu manually."
fi
Echo "* This option is enabled by default (Y)."
read -p "$(Input 'Enable this option? (Y/n):')" Jailbreak
if [[ $Jailbreak != 'N' && $Jailbreak != 'n' ]]; then
JailbreakSet
Log "Jailbreak option enabled."
else
Log "Jailbreak option disabled by user."
fi
echo
fi
if [[ $OSVer != "Other" ]]; then
[[ -z $IPSWCustom ]] && IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_Custom"
MemoryOption
SaveOTABlobs
IPSWFind
if [[ $Verify == 1 ]]; then
IPSWVerify
elif [[ -e "$IPSWCustom.ipsw" ]]; then
Log "Found existing Custom IPSW. Skipping IPSW verification."
Log "Setting restore IPSW to: $IPSWCustom.ipsw"
IPSWRestore=$IPSWCustom
fi
if [[ $DeviceState == "Normal" && $iBSSBuildVer == $BuildVer && -e "$IPSW.ipsw" ]]; then
Log "Extracting iBSS from IPSW..."
mkdir -p saved/$ProductType 2>/dev/null
unzip -o -j $IPSW.ipsw Firmware/dfu/$iBSS.dfu -d saved/$ProductType
fi
else
IPSWCustom=0
fi
[[ $DeviceState == "Normal" ]] && kDFU
if [[ $Jailbreak == 1 ]]; then
IPSW32
IPSWExtract="$IPSWCustom"
else
IPSWExtract="$IPSW"
fi
Log "Extracting IPSW: $IPSWExtract.ipsw"
unzip -oq "$IPSWExtract.ipsw" -d "$IPSWExtract"/
if [[ ! $IPSWRestore ]]; then
Log "Setting restore IPSW to: $IPSW.ipsw"
IPSWRestore="$IPSW"
fi
Log "Proceeding to futurerestore..."
[[ $platform == "linux" ]] && Echo "* Enter your user password when prompted"
@ -130,7 +47,7 @@ Downgrade() {
$irecovery -f README.md
sleep 2
ExtraArgs+=("-s" "$IPSWRestore/Firmware/all_flash/$SEP" "-m" "$BuildManifest")
else
elif [[ $SendiBSS != 1 ]]; then
ExtraArgs+=("--no-ibss")
fi
@ -159,3 +76,48 @@ Downgrade() {
fi
Log "Downgrade script done!"
}
DowngradeOther() {
Input "Select your IPSW file in the file selection window."
IPSW="$($zenity --file-selection --file-filter='IPSW | *.ipsw' --title="Select IPSW file")"
[[ ! -s "$IPSW" ]] && Error "No IPSW selected, or IPSW file not found."
IPSW="${IPSW%?????}"
Log "Selected IPSW file: $IPSW.ipsw"
Input "Select your SHSH file in the file selection window."
SHSH="$($zenity --file-selection --file-filter='SHSH | *.shsh *.shsh2' --title="Select SHSH file")"
[[ ! -s "$SHSH" ]] && Error "No SHSH selected, or SHSH file not found."
Log "Selected SHSH file: $SHSH"
if [[ ! -e resources/firmware/$ProductType/$BuildVer/index.html ]]; then
unzip -o -j "$IPSW.ipsw" Restore.plist -d tmp
BuildVer=$(cat tmp/Restore.plist | grep -i ProductBuildVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+")
Log "Getting firmware keys for $ProductType-$BuildVer"
mkdir -p resources/firmware/$ProductType/$BuildVer 2>/dev/null
curl -L https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/raw/master/$ProductType/$BuildVer/index.html -o tmp/index.html
mv tmp/index.html resources/firmware/$ProductType/$BuildVer
fi
kDFU
IPSWSetExtract
FutureRestore
}
DowngradeOTA() {
[[ $DeviceProc != 7 ]] && JailbreakOption
SaveOTABlobs
IPSWFindVerify
kDFU
[[ $Jailbreak == 1 ]] && IPSW32
IPSWSetExtract
FutureRestore
}
Downgrade() {
Log "Select your options when asked. If unsure, go for the defaults (press Enter/Return)."
echo
if [[ $OSVer == "Other" ]]; then
DowngradeOther
return
fi
DowngradeOTA
}

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS7.1/031-4812.20140627.cq6y8/iPhone3,1_7.1.2_11D257_Restore.ipsw

View File

@ -0,0 +1 @@
n90

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS7.1/031-4785.20140627.zZ42j/iPhone3,2_7.1.2_11D257_Restore.ipsw

View File

@ -0,0 +1 @@
n90b

View File

@ -0,0 +1 @@
http://appldnld.apple.com/iOS7.1/031-4768.20140627.DXmmp/iPhone3,3_7.1.2_11D257_Restore.ipsw

View File

@ -0,0 +1 @@
http://updates-http.cdn-apple.com/2019/ios/041-80042-20190722-68F07B91-8EA1-4A3B-A930-35314A006ECB/iPad2,3_9.3.6_13G37_Restore.ipsw

View File

@ -0,0 +1 @@
n92

View File

@ -3,7 +3,6 @@
JailbreakSet() {
Jailbreak=1
IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_Custom"
[[ -e "$IPSWCustom.ipsw" ]] && Verify=
if [[ $ProductType == "iPhone4,1" || $ProductType == "iPhone5,2" ]] && [[ $OSVer == "8.4.1" ]]; then
Input "Jailbreak Tool Option"
@ -34,40 +33,68 @@ JailbreakSet() {
Log "Using $JBName for the jailbreak"
}
MemoryOption() {
if [[ $Jailbreak == 1 && $Verify == 1 ]]; then
Input "Memory Option for creating custom IPSW"
Echo "* This option makes creating the custom IPSW faster, but it requires at least 8GB of RAM."
Echo "* If you do not have enough RAM, disable this option and make sure that you have enough storage space."
Echo "* This option is enabled by default (Y)."
read -p "$(Input 'Enable this option? (Y/n):')" JBMemory
if [[ $JBMemory == 'N' || $JBMemory == 'n' ]]; then
Log "Memory option disabled by user."
else
Log "Memory option enabled."
fi
echo
JailbreakOption() {
Input "Jailbreak Option"
Echo "* When this option is enabled, your device will be jailbroken on restore."
if [[ $ProductType == "iPad2,5" || $ProductType == "iPad2,6" || $ProductType == "iPad2,7" ]]; then
Echo "* Based on some reported issues, Jailbreak Option might be broken for iPad mini 1 devices."
Echo "* I recommend to disable the option for these devices and sideload EtasonJB, HomeDepot, or daibutsu manually."
fi
Echo "* This option is enabled by default (Y)."
read -p "$(Input 'Enable this option? (Y/n):')" Jailbreak
if [[ $Jailbreak != 'N' && $Jailbreak != 'n' ]]; then
JailbreakSet
Log "Jailbreak option enabled."
else
Log "Jailbreak option disabled by user."
fi
[[ -z $IPSWCustom ]] && IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_Custom"
echo
if [[ $Jailbreak != 1 ]]; then
return
fi
Input "Memory Option for creating custom IPSW"
Echo "* This option makes creating the custom IPSW faster, but it requires at least 8GB of RAM."
Echo "* If you do not have enough RAM, disable this option and make sure that you have enough storage space."
Echo "* This option is enabled by default (Y)."
read -p "$(Input 'Enable this option? (Y/n):')" JBMemory
if [[ $JBMemory == 'N' || $JBMemory == 'n' ]]; then
Log "Memory option disabled by user."
JBMemory=
else
Log "Memory option enabled."
JBMemory="-memory"
fi
echo
}
IPSWFind() {
IPSWFindVerify() {
IPSW="${IPSWType}_${OSVer}_${BuildVer}_Restore"
if [[ ! -e "$IPSW.ipsw" && $Verify == 1 ]]; then
Log "iOS $OSVer IPSW for $ProductType cannot be found."
local IPSWDL=$IPSW
local OSVerDL=$OSVer
local BuildVerDL=$BuildVer
if [[ -e "$IPSWCustom.ipsw" ]]; then
Log "Found existing Custom IPSW. Skipping $OSVerDL IPSW verification."
return
fi
if [[ ! -e "$IPSW.ipsw" ]]; then
Log "iOS $OSVerDL IPSW for $ProductType cannot be found."
Echo "* If you already downloaded the IPSW, move/copy it to the directory where the script is located."
Echo "* Do NOT rename the IPSW as the script will fail to detect it."
Echo "* The script will now proceed to download it for you. If you want to download it yourself, here is the link: $(cat $Firmware/$BuildVer/url)"
Echo "* The script will now proceed to download it for you. If you want to download it yourself, here is the link: $(cat $Firmware/$BuildVerDL/url)"
Log "Downloading IPSW... (Press Ctrl+C to cancel)"
curl -L $(cat $Firmware/$BuildVer/url) -o tmp/$IPSW.ipsw
mv tmp/$IPSW.ipsw .
curl -L $(cat $Firmware/$BuildVerDL/url) -o tmp/$IPSWDL.ipsw
mv tmp/$IPSWDL.ipsw .
fi
}
IPSWVerify() {
Log "Verifying IPSW..."
IPSWSHA1=$(cat $Firmware/$BuildVer/sha1sum)
Log "Verifying $IPSWDL.ipsw..."
IPSWSHA1=$(cat $Firmware/$BuildVerDL/sha1sum)
Log "Expected SHA1sum: $IPSWSHA1"
IPSWSHA1L=$(shasum $IPSW.ipsw | awk '{print $1}')
IPSWSHA1L=$(shasum $IPSWDL.ipsw | awk '{print $1}')
Log "Actual SHA1sum: $IPSWSHA1L"
if [[ $IPSWSHA1L != $IPSWSHA1 ]]; then
Error "Verifying IPSW failed. Your IPSW may be corrupted or incomplete. Delete/replace the IPSW and run the script again" \
@ -76,13 +103,27 @@ IPSWVerify() {
Log "IPSW SHA1sum matches."
}
IPSWSetExtract() {
if [[ -e "$IPSWCustom.ipsw" ]]; then
Log "Setting restore IPSW to: $IPSWCustom.ipsw"
IPSWRestore="$IPSWCustom"
elif [[ -z $IPSWRestore ]]; then
Log "Setting restore IPSW to: $IPSW.ipsw"
IPSWRestore="$IPSW"
fi
Log "Extracting IPSW: $IPSWRestore.ipsw"
unzip -oq "$IPSWRestore.ipsw" -d "$IPSWRestore"/
}
IPSW32() {
local Bundle="Down_${ProductType}_${OSVer}_${BuildVer}.bundle"
local ExtraArgs
local JBFiles
local JBFiles2
local JBSHA1
if [[ $IPSWRestore == $IPSWCustom ]]; then
if [[ -e $IPSWCustom.ipsw ]]; then
Log "Found existing Custom IPSW. Skipping IPSW creation."
return
fi
@ -96,6 +137,7 @@ IPSW32() {
JBFiles2=("bin.tar" "cydia.tar" "untether.tar")
JBSHA1=("98034227c68610f4c7dd48ca9e622314a1e649e7" "2e9e662afe890e50ccf06d05429ca12ce2c0a3a3" "f88ec9a1b3011c4065733249363e9850af5f57c8")
cd tmp
mkdir jailbreak
for i in {0..2}; do
local URL="https://github.com/dora2-iOS/daibutsuCFW/raw/main/build/src/"
(( i > 0 )) && URL+="daibutsu/${JBFiles2[$i]}" || URL+="${JBFiles2[$i]}"
@ -104,7 +146,7 @@ IPSW32() {
SaveFile $URL ${JBFiles2[$i]} ${JBSHA1[$i]}
mv ${JBFiles2[$i]} ../resources/jailbreak
fi
JBFiles2[$i]=jailbreak/${JBFiles2[$i]}
cp ../resources/jailbreak/${JBFiles2[$i]} jailbreak/
done
cd ..
@ -112,13 +154,11 @@ IPSW32() {
if [[ $OSVer == "8.4.1" ]]; then
JBFiles=("fstab.tar" "etasonJB-untether.tar" "Cydia8.tar")
JBSHA1="6459dbcbfe871056e6244d23b33c9b99aaeca970"
ExtraArgs+="-s 2305 "
ExtraArgs+="-s 2305"
elif [[ $OSVer == "6.1.3" ]]; then
JBFiles=("fstab_rw.tar" "p0sixspwn.tar" "Cydia6.tar")
JBSHA1="1d5a351016d2546aa9558bc86ce39186054dc281"
ExtraArgs+="-s 1260 "
else
Error "No OSVer selected?"
ExtraArgs+="-s 1260"
fi
if [[ ! -e resources/jailbreak/${JBFiles[2]} ]]; then
cd tmp
@ -128,29 +168,25 @@ IPSW32() {
cd ..
fi
for i in {0..2}; do
JBFiles[$i]=jailbreak/${JBFiles[$i]}
JBFiles[$i]=../resources/jailbreak/${JBFiles[$i]}
done
fi
ExtraArgs+="-bbupdate"
if [[ ! -e $IPSWCustom.ipsw ]]; then
[[ $JBMemory != 'N' && $JBMemory != 'n' ]] && ExtraArgs+=" -memory"
Log "Preparing custom IPSW..."
cd resources
rm -rf FirmwareBundles
if [[ $JBDaibutsu == 1 && -d firmware/JailbreakBundles/$Bundle ]]; then
cp -R firmware/JailbreakBundles FirmwareBundles
cd tmp
if [[ $JBDaibutsu == 1 ]]; then
cp -R ../resources/firmware/JailbreakBundles FirmwareBundles
else
cp -R firmware/FirmwareBundles FirmwareBundles
cp -R ../resources/firmware/FirmwareBundles FirmwareBundles
fi
$ipsw ./../$IPSW.ipsw ./../$IPSWCustom.ipsw $ExtraArgs ${JBFiles[@]}
$ipsw ./../$IPSW.ipsw ./../$IPSWCustom.ipsw $ExtraArgs $JBMemory ${JBFiles[@]}
cd ..
fi
if [[ ! -e $IPSWCustom.ipsw ]]; then
Error "Failed to find custom IPSW. Please run the script again" \
"You may try selecting N for memory option"
fi
Log "Setting restore IPSW to: $IPSWCustom.ipsw"
IPSWRestore=$IPSWCustom
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -75,7 +75,7 @@ Main() {
fi
Log "Checking Internet connection..."
ping -c1 8.8.8.8 >/dev/null
$ping 8.8.8.8 >/dev/null
if [[ $? != 0 ]]; then
Error "Please check your Internet connection before proceeding."
fi
@ -106,11 +106,13 @@ Main() {
Mode="$1"
else
[[ $1 != "NoDevice" ]] && Selection+=("Downgrade Device")
Selection+=("Save OTA Blobs")
[[ $DeviceProc != 4 ]] && Selection+=("Save OTA Blobs")
if [[ $DeviceProc != 7 ]]; then
Selection+=("Create Custom IPSW")
[[ $DeviceProc != 4 ]] && Selection+=("Create Custom IPSW")
[[ $DeviceState == "Normal" ]] && Selection+=("Put Device in kDFU Mode")
fi
Selection+=("(Re-)Install Dependencies" "(Any other key to exit)")
Echo "*** Main Menu ***"
Input "Select an option:"
@ -129,18 +131,18 @@ Main() {
SelectVersion
if [[ $Mode == "IPSW32" ]]; then
Verify=1
echo
JailbreakSet
MemoryOption
IPSWFind
if [[ $Verify == 1 ]]; then
IPSWVerify
elif [[ -e "$IPSWCustom.ipsw" ]]; then
JailbreakOption
if [[ -e "$IPSWCustom.ipsw" ]]; then
Log "Found existing Custom IPSW, stopping here."
Echo "* If you want to re-create the custom IPSW, move/delete the existing one first."
exit 0
elif [[ $Jailbreak != 1 ]]; then
Log "Creating custom IPSW is not needed for non-jailbroken restores on your device."
exit 0
fi
IPSWFindVerify
IPSW32
Log "Custom IPSW has been created: $IPSWCustom.ipsw"
Echo "* This custom IPSW has a jailbreak built in ($JBName)"
@ -161,7 +163,7 @@ Main() {
elif [[ $DeviceState == "Recovery" ]]; then
Recovery
elif [[ $DeviceState == "DFU" ]]; then
CheckM8
EnterPwnDFU
fi
elif [[ $DeviceState == "DFU" ]]; then
@ -179,26 +181,25 @@ Main() {
Echo "* If you do not know what you are doing, EXIT NOW by pressing Ctrl+C and restart your device in normal mode."
Input "Select the mode that your device is currently in:"
Selection=("kDFU mode")
[[ $DeviceProc == 5 ]] && Selection+=("pwnDFU mode (A5)")
[[ $DeviceProc == 6 ]] && Selection+=("DFU mode (A6)")
[[ $DeviceProc == 5 ]] && Selection+=("pwnDFU mode (A5)") || Selection+=("DFU mode (A6)")
Selection+=("Any other key to exit")
select opt in "${Selection[@]}"; do
case $opt in
"kDFU mode" ) break;;
"DFU mode (A6)" ) CheckM8; break;;
"DFU mode (A6)" ) EnterPwnDFU; break;;
"pwnDFU mode (A5)" )
Echo "* Make sure that your device is in pwnDFU mode using an Arduino+USB Host Shield!";
Echo "* This option will not work if your device is not in pwnDFU mode.";
Input "Press Enter/Return to continue (or press Ctrl+C to cancel)";
read -s;
kDFU iBSS; break;;
SendiBSS=1; break;;
* ) exit 0;;
esac
done
Log "Downgrading $ProductType in kDFU/pwnDFU mode..."
elif [[ $DeviceState == "Recovery" ]]; then
if [[ $DeviceProc == 6 ]]; then
if [[ $DeviceProc == 4 || $DeviceProc == 6 ]]; then
Recovery
else
Log "32-bit A${DeviceProc} device detected in recovery mode."
@ -222,7 +223,7 @@ SelectVersion() {
return
fi
if [[ $ProductType == "iPhone5,3" || $ProductType == "iPhone5,4" ]]; then
if [[ $ProductType == "iPhone5,3" || $ProductType == "iPhone5,4" || $ProductType == "iPhone3"* ]]; then
Selection=()
else
Selection=("iOS 8.4.1")