From 8942de72ea761c02fb5e5c812cd38d85899ffafe Mon Sep 17 00:00:00 2001 From: LukeZGD Date: Thu, 7 Jul 2022 14:21:53 +0800 Subject: [PATCH] Some changes --- resources/depends.sh | 30 ++++++++++++++++++++---------- resources/device.sh | 32 ++++++++++++++++++-------------- resources/downgrade.sh | 4 ++++ restore.sh | 4 ++-- 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/resources/depends.sh b/resources/depends.sh index b2d6a05..a709438 100755 --- a/resources/depends.sh +++ b/resources/depends.sh @@ -79,8 +79,7 @@ SetToolPaths() { if [[ $platform == "linux" ]]; then irecovery="env LD_LIBRARY_PATH=./resources/lib $irecovery" - irecovery2="env LD_LIBRARY_PATH=./resources/lib $irecovery2" - # openssl + irecovery2="env LD_LIBRARY_PATH=../lib $irecovery2" opensslver=$(openssl version | awk '{print $2}' | cut -c -3) if [[ $opensslver == "3"* ]]; then cherrybin="env LD_LIBRARY_PATH=../resources/lib $cherrybin" @@ -103,14 +102,26 @@ SetToolPaths() { } SaveExternal() { - if [[ -d ./resources/$2 ]]; then + local Link + local Name + local SHA1 + if [[ $1 == "ipwndfu" ]]; then + Link=https://github.com/LukeZGD/ipwndfu/archive/6e67c9e28a5f7f63f179dea670f7f858712350a0.zip + Name=ipwndfu + SHA1=61333249eb58faebbb380c4709384034ce0e019a + elif [[ $1 == "ch3rryflower" ]]; then + Link=https://web.archive.org/web/20210529174714if_/https://codeload.github.com/dora2-iOS/ch3rryflower/zip/316d2cdc5351c918e9db9650247b91632af3f11f + Name=ch3rryflower + SHA1=790d56db354151b9740c929e52c097ba57f2929d + fi + if [[ -d ./resources/$Name ]]; then return fi cd tmp - SaveFile $1 $2.zip $3 + SaveFile $Link $Name.zip $SHA1 cd ../resources - unzip -q ../tmp/$2.zip -d . - mv $2* $2 + unzip -q ../tmp/$Name.zip -d . + mv $Name* $Name cd .. } @@ -130,7 +141,7 @@ InstallDepends() { mkdir resources/lib tmp 2>/dev/null cd resources cp lib/*.so.1.1 ../tmp 2>/dev/null - rm -rf ipwndfu lib/* + rm -rf lib/* cp ../tmp/*.so.1.1 lib/ 2>/dev/null cd ../tmp @@ -173,9 +184,8 @@ InstallDepends() { xcode-select --install 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" - Echo "* Install using this command: 'brew install libimobiledevice libirecovery'" + Echo "* In case that problems occur, try installing them from Homebrew or MacPorts" + Echo "* The script will detect this automatically and will use the Homebrew/MacPorts versions of the tools" elif [[ $platform == "win" ]]; then pacman -Sy --noconfirm --needed ca-certificates curl openssh unzip zip diff --git a/resources/device.sh b/resources/device.sh index a76b329..06f9683 100755 --- a/resources/device.sh +++ b/resources/device.sh @@ -137,10 +137,6 @@ GetDeviceValues() { BasebandURL=$(cat $Firmware/11D257/url) Baseband="ICE3_04.12.09_BOOT_02.13.Release.bbfw" BasebandSHA1="007365a5655ac2f9fbd1e5b6dba8f4be0513e364" - if [[ $ProductType == "iPhone3,1" ]]; then - Log "iPhone 4 GSM detected. iPhone4Down functions enabled." - Echo "* This script uses ch3rryflower by dora2iOS" - fi elif [[ $ProductType == "iPad2"* || $ProductType == "iPad3"* || $ProductType == "iPad4,1" || $ProductType == "iPad4,4" || $ProductType == "iPod5,1" ]]; then @@ -151,7 +147,10 @@ GetDeviceValues() { if [[ $ProductType == "iPhone3"* ]]; then DeviceProc=4 - if [[ $ProductType != "iPhone3,1" ]]; then + if [[ $ProductType == "iPhone3,1" ]]; then + Log "iPhone 4 GSM detected. iPhone4Down functions enabled." + Echo "* This script uses ch3rryflower by dora2iOS" + else Log "$ProductType detected. Your device is not supported by ch3rryflower." Echo "* Functions will be limited to entering kDFU and restoring with blobs." fi @@ -220,7 +219,7 @@ EnterPwnDFU() { done else pwnDFUTool="ipwndfu" - SaveExternal https://github.com/LukeZGD/ipwndfu/archive/6e67c9e28a5f7f63f179dea670f7f858712350a0.zip ipwndfu 61333249eb58faebbb380c4709384034ce0e019a + SaveExternal ipwndfu fi Log "Entering pwnDFU mode with: $pwnDFUTool" @@ -232,10 +231,11 @@ EnterPwnDFU() { Log "Running rmsigchks.py..." $rmsigchks pwnDFUDevice=$? + cd ../.. else - SendiBSS=1 + cd ../.. + SendPwnediBSS fi - cd ../.. else $pwnDFUTool -p pwnDFUDevice=$? @@ -268,6 +268,8 @@ EnterPwnDFU() { Log "Warning - Failed to detect device in pwnDFU mode." Echo "* If the device entered pwnDFU mode successfully, you may continue" Echo "* If entering pwnDFU failed, you may have to force restart your device and start over" + Input "Press Enter/Return to continue (or press Ctrl+C to cancel)" + read -s fi } @@ -285,7 +287,7 @@ Recovery() { if [[ $RecoveryDFU == 'N' || $RecoveryDFU == 'n' ]]; then Log "Exiting recovery mode." $irecovery -n - exit 0 + ExitWin 0 fi Echo "* Hold TOP and HOME buttons for 10 seconds." @@ -310,7 +312,7 @@ RecoveryExit() { Log "Exiting recovery mode." $irecovery -n fi - exit 0 + ExitWin 0 } PatchiBSS() { @@ -335,7 +337,7 @@ PatchiBSS() { $bspatch saved/$ProductType/$iBSS.dfu tmp/pwnediBSS resources/patches/$iBSS.patch } -SendPwnediBSS() { +SendPwnediBSSA5() { 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)" @@ -348,12 +350,11 @@ SendPwnediBSS() { Log "No iBSS option enabled by user." return fi - echo Input "Send iBSS Option" Echo "* To send pwned iBSS using ipwndfu, select Y. (does not work on ARM Macs)" Echo "* To let futurerestore send iBSS, select N. (likely does not work)" - Echo "* For macOS >=12.3, install python2 first before selecting ipwndfu." + Echo "* For macOS 12 and newer, install python2 first before selecting ipwndfu." Echo "* This option is enabled by default (Y)." read -p "$(Input 'Enable this option? (Y/n):')" SendiBSS if [[ $SendiBSS == 'N' || $SendiBSS == 'n' ]]; then @@ -361,8 +362,11 @@ SendPwnediBSS() { SendiBSS=1 return fi + SendPwnediBSS +} - SaveExternal https://github.com/LukeZGD/ipwndfu/archive/6e67c9e28a5f7f63f179dea670f7f858712350a0.zip ipwndfu 61333249eb58faebbb380c4709384034ce0e019a +SendPwnediBSS() { + SaveExternal ipwndfu PatchiBSS cd resources/ipwndfu Log "Sending iBSS..." diff --git a/resources/downgrade.sh b/resources/downgrade.sh index a7049af..6aad810 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -98,6 +98,10 @@ DowngradeOther() { 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 + if [[ $(cat tmp/index.html | grep -c "$BuildVer") != 1 ]]; then + curl -L https://api.m1sta.xyz/wikiproxy/$ProductType/$BuildVer -o tmp/index.html + [[ $(cat tmp/index.html | grep -c "$BuildVer") != 1 ]] && Error "Failed to download firmware keys, cannot proceed." + fi mv tmp/index.html resources/firmware/$ProductType/$BuildVer fi diff --git a/restore.sh b/restore.sh index 4447e95..e91a3ce 100755 --- a/restore.sh +++ b/restore.sh @@ -112,7 +112,7 @@ Main() { mkdir tmp if [[ $ProductType == "iPhone3,1" ]]; then - SaveExternal https://web.archive.org/web/20210529174714if_/https://codeload.github.com/dora2-iOS/ch3rryflower/zip/316d2cdc5351c918e9db9650247b91632af3f11f ch3rryflower 790d56db354151b9740c929e52c097ba57f2929d + SaveExternal ch3rryflower fi if [[ -n $1 && $1 != "NoColor" && $1 != "NoDevice" && $1 != "PwnedDevice" ]]; then @@ -258,7 +258,7 @@ Main() { case $opt in "kDFU mode" ) break;; "DFU mode (A4/A6)" ) EnterPwnDFU; break;; - "pwnDFU mode (A5)" ) SendPwnediBSS; break;; + "pwnDFU mode (A5)" ) SendPwnediBSSA5; break;; * ) exit 0;; esac done