From cf0c9e472ca02eb434bda5c6cd7d4c2e929b73c3 Mon Sep 17 00:00:00 2001 From: LukeZGD Date: Thu, 30 Sep 2021 11:49:41 +0800 Subject: [PATCH] Update tools on Windows also allow a7 restores, which is not tested --- README.md | 9 +++++---- resources/depends.sh | 7 ++++--- resources/device.sh | 9 +++++++++ resources/downgrade.sh | 2 +- restore.sh | 27 ++++++++++++++++++--------- 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 2c31be5..b53d9cf 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # iOS-OTA-Downgrader ### Downgrade/restore and jailbreak iOS devices to signed OTA firmwares - **Linux, macOS, and Windows** are supported - - Windows support is limited. [MSYS2](https://www.msys2.org/#installation) and iTunes 64-bit are required. To run the script, click `restore.cmd` + - Windows support is limited to iOS 6.1.3 and 8.4.1 downgrades only - Windows users can also create a Linux live USB (see Requirements) -- iOS 8.4.1 and 6.1.3 downgrades have the option to **jailbreak** the install +- iOS 6.1.3 and 8.4.1 downgrades have the option to **jailbreak** the install - For iOS 10.3.3, use [TotallyNotSpyware](https://totally-not.spyware.lol) or [sockH3lix](https://github.com/SongXiaoXi/sockH3lix) to jailbreak - **You do NOT need blobs to use this**, the script will get them for you - This script can also restore your device to other iOS versions that you have SHSH blobs for (32-bit devices only, listed under Supported devices) @@ -54,9 +54,10 @@ - The IPSW firmware for the version you want to downgrade to - Links: [iOS 10.3.3](https://ipsw.me/10.3.3), [iOS 8.4.1](https://ipsw.me/8.4.1), [iOS 6.1.3](https://ipsw.me/6.1.3) (ignore the signing statuses in the site) - The script can also download it for you -- A **64-bit Linux install/live USB** or a supported **macOS** version +- A **64-bit Linux install/live USB** or a supported **macOS/Windows** version - See supported OS versions and Linux distros below - A Linux live USB can be easily created with tools like [Ventoy](https://www.ventoy.net/en/index.html) +- **Windows** users need to install [MSYS2](https://www.msys2.org/#installation) and iTunes 64-bit - **32-bit devices** - The device needs to be put in kDFU/pwnDFU mode as part of the process. There are a few options: - Normal method - **Jailbreak is required**. Users must install [OpenSSH](https://cydia.saurik.com/package/openssh/). Users in iOS 10 (A6/A6X) must also install Dropbear from my Cydia repo: https://lukezgd.github.io/repo/ - DFU method - For alternatives, the DFU advanced menu can also be used. See "Other notes" for more details @@ -138,7 +139,7 @@ - ipsw tool from [xpwn](https://github.com/LukeZGD/xpwn) - LukeZGD fork - Python 2 (for ipwndfu, rmsigchks, SimpleHTTPServer) - [tsschecker](https://github.com/tihmstar/tsschecker) - tihmstar -- [tsschecker](https://github.com/DanTheMann15/tsschecker) - DanTheMann15 fork (Windows build) +- [tsschecker](https://github.com/1Conan/tsschecker) - 1Conan fork (Windows build) - [futurerestore](http://api.tihmstar.net/builds/futurerestore/futurerestore-latest.zip) used for 32-bit devices - tihmstar - [futurerestore](https://github.com/m1stadev/futurerestore) used for A7 devices - m1stadev fork - [kloader](https://www.youtube.com/watch?v=fh0tB6fp0Sc) diff --git a/resources/depends.sh b/resources/depends.sh index f2cafa0..4e94eaa 100755 --- a/resources/depends.sh +++ b/resources/depends.sh @@ -46,6 +46,7 @@ SetToolPaths() { platform="win" MPath+="$platform" bspatch="./resources/tools/bspatch_win" + futurerestore2="./resources/tools/futurerestore2_win" idevicerestore="./resources/tools/idevicerestore_win" python=/ fi @@ -162,12 +163,12 @@ InstallDepends() { Echo "* Install using this command: 'brew install libimobiledevice libirecovery'" elif [[ $platform == "win" ]]; then - pacman -Sy --noconfirm --needed ca-certificates curl git openssh unzip + pacman -Sy --noconfirm --needed ca-certificates curl git openssh unzip zip Log "Downloading Windows tools..." - SaveFile https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/tools_win.zip tools_win.zip a7de26af8f2e94ebd44f5080d973c03035cf91f8 + SaveFile https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/tools2_win.zip tools_win.zip 1929c04f6f699f5e423bd9ca7ecc855a9b4f8f7c Log "Extracting Windows tools..." unzip -oq tools_win.zip -d ../resources/tools - libimobiledevice=("https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/libimobiledevice_win.zip" "669dec0d0c257066f22a0664dcef2f58cebbcadf") + libimobiledevice=("https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/libimobiledevice2_win.zip" "3ed553415cc669b5c467a5f3cd78f692f7149adb") else Error "Distro not detected/supported by the install script." "See the repo README for supported OS versions/distros" diff --git a/resources/device.sh b/resources/device.sh index dff798b..193436f 100755 --- a/resources/device.sh +++ b/resources/device.sh @@ -245,6 +245,15 @@ Recovery() { CheckM8 } +RecoveryExit() { + read -p "$(Input 'Attempt to exit recovery mode? (Y/n)')" Selection + if [[ $Selection != 'N' && $Selection != 'n' ]]; then + Log "Exiting recovery mode." + $irecovery -n + fi + exit 0 +} + kDFU() { local kloader local VerDetect=$(echo $ProductVer | cut -c 1) diff --git a/resources/downgrade.sh b/resources/downgrade.sh index fa72dd7..15db87a 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -121,7 +121,7 @@ Downgrade() { IPSW="${IPSWType}_${OSVer}_${BuildVer}_Restore" IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_Custom" - if [[ $Jailbreak != 1 && $platform == "win" ]]; then + if [[ $Jailbreak != 1 && $DeviceProc != 7 && $platform == "win" ]]; then IPSWCustom="${IPSWCustom}W" IPSWCustomW=1 elif [[ $Jailbreak != 1 && $DeviceProc != 7 ]]; then diff --git a/restore.sh b/restore.sh index af2f3a3..2ab8176 100755 --- a/restore.sh +++ b/restore.sh @@ -107,10 +107,24 @@ Main() { Clean mkdir tmp - if [[ $DeviceProc == 7 ]]; then - if [[ $platform == "win" ]]; then - Error "A7 devices are not supported in Windows." + if [[ $DeviceProc == 7 && $platform == "win" ]]; then + local Message="If you want to restore your A7 device on Windows, put the iOS device in pwnDFU mode." + if [[ $DeviceState == "Normal" ]]; then + Error "$Message" + elif [[ $DeviceState == "Recovery" ]]; then + Log "A7 device detected in recovery mode." + Log "$Message" + RecoveryExit + elif [[ $DeviceState == "DFU" ]]; then + Log "A7 device detected in DFU mode." + Echo "* Make sure that your device is already in pwnDFU mode with signature checks disabled." + Echo "* If your device is not in pwnDFU mode, the restore will NOT proceed!" + Echo "* Entering pwnDFU mode is not supported on Windows. You need to use a Mac/Linux machine or another iOS device to do so." + Input "Press Enter/Return to continue (or press Ctrl+C to cancel)" + read -s fi + + elif [[ $DeviceProc == 7 ]]; then if [[ $DeviceState == "Normal" ]]; then Echo "* The device needs to be in recovery/DFU mode before proceeding." read -p "$(Input 'Send device to recovery mode? (y/N):')" Selection @@ -153,12 +167,7 @@ Main() { Log "32-bit A5 device detected in recovery mode." Echo "* Please put the device in normal mode and jailbroken before proceeding." Echo "* For usage of advanced DFU options, put the device in kDFU mode (or pwnDFU mode using Arduino + USB Host Shield)" - read -p "$(Input 'Attempt to exit recovery mode? (Y/n)')" Selection - if [[ $Selection != 'N' && $Selection != 'n' ]]; then - Log "Exiting recovery mode." - $irecovery -n - fi - exit 0 + RecoveryExit fi Log "Downgrading $ProductType in pwnDFU mode..." Mode="Downgrade"