Add Windows support (#138)

- Tested on Windows 10 64-bit 1809, iTunes 12.10.something (I don't remember the specific version), and the latest MSYS2
- To run iOS-OTA-Downgrader on Windows, MSYS2 and iTunes are needed to be installed
This commit is contained in:
LukeeGD 2021-09-29 13:33:34 +08:00 committed by GitHub
parent b3990bcfe5
commit ec7adc51a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 27 deletions

View File

@ -1,7 +1,8 @@
# iOS-OTA-Downgrader
### Downgrade/restore and jailbreak iOS devices to signed OTA firmwares
- **Linux and macOS** are supported
- Windows users can create a Linux live USB (see Requirements)
- **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 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
- 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
@ -13,6 +14,8 @@
- You can identify your device [here](https://ipsw.me/device-finder)
- **iPhone 5C and iPad mini 3 devices are NOT supported** (OTA versions for them are not signed)
- iPhone 5C can still be restored to versions that you have SHSH blobs for
- **A7 devices are not supported on Windows.**
- **Restoring to other versions with SHSH blobs is not supported on Windows.**
<table>
<thead>
@ -70,6 +73,7 @@
3. Open a Terminal window
4. `cd` to where the extracted files are located, and run `./restore.sh`
- You can also drag `restore.sh` to the Terminal window and press Enter/Return
- For Windows users, click `restore.cmd` to run the script
5. Select options to be used
6. Follow instructions
@ -80,6 +84,7 @@
- [**Debian**](https://www.debian.org/) 11 Bullseye, Testing and Unstable
- [**openSUSE**](https://www.opensuse.org/) Tumbleweed and Leap 15.3
- **macOS** 10.13 and newer
- Windows 10 (8.1 and lower may also work but this is untested)
## Other notes:
- **If something in the process does not work for you:** try unplugging/replugging the device, switching between different USB ports/cables, also try USB 2.0 ports

View File

@ -41,6 +41,13 @@ SetToolPaths() {
ipwndfu="$python ipwndfu"
rmsigchks="$python rmsigchks.py"
SimpleHTTPServer="$python -m SimpleHTTPServer 80"
elif [[ $OSTYPE == "msys" ]]; then
platform="win"
MPath+="$platform"
bspatch="./resources/tools/bspatch_win"
idevicerestore="./resources/tools/idevicerestore_win"
python=/
fi
git="$(which git)"
ideviceenterrecovery="$MPath/ideviceenterrecovery"
@ -152,6 +159,12 @@ InstallDepends() {
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'"
elif [[ $platform == "win" ]]; then
pacman -Sy --noconfirm --needed git openssh unzip
SaveFile https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/tools_win.zip tools_win.zip a7de26af8f2e94ebd44f5080d973c03035cf91f8
unzip tools_win.zip -d ../resources/tools
libimobiledevice=("https://github.com/LukeZGD/iOS-OTA-Downgrader-Keys/releases/download/tools/libimobiledevice_win.zip" "669dec0d0c257066f22a0664dcef2f58cebbcadf")
else
Error "Distro not detected/supported by the install script." "See the repo README for supported OS versions/distros"
fi
@ -173,5 +186,10 @@ InstallDepends() {
cd ..
Log "Install script done! Please run the script again to proceed"
if [[ $platform == "win" ]]; then
Input "Press Enter/Return to exit."
read -s
fi
exit 0
}

View File

@ -10,8 +10,11 @@ FindDevice() {
Log "Finding device in $1 mode..."
while (( $i < $Timeout )); do
[[ $platform == "linux" ]] && DeviceIn=$(lsusb | grep -c "05ac:$USB")
[[ $platform == "macos" && $($irecovery -q 2>/dev/null | grep -w "MODE" | cut -c 7-) == "$1" ]] && DeviceIn=1
if [[ $platform == "linux" ]]; then
DeviceIn=$(lsusb | grep -c "05ac:$USB")
else
[[ $($irecovery -q 2>/dev/null | grep -w "MODE" | cut -c 7-) == "$1" ]] && DeviceIn=1
fi
if [[ $DeviceIn == 1 ]]; then
Log "Found device in $1 mode."
DeviceState="$1"
@ -42,7 +45,7 @@ GetDeviceValues() {
if [[ $DeviceState == "DFU" || $DeviceState == "Recovery" ]]; then
local ProdCut=7
ProductType=$($irecovery -qv 2>&1 | grep "iP" | cut -c 14-)
ProductType=$($irecovery -qv 2>&1 | grep "Connected to iP" | cut -c 14-)
[[ $(echo $ProductType | cut -c 3) == 'h' ]] && ProdCut=9
ProductType=$(echo $ProductType | cut -c -$ProdCut)
if [[ ! $ProductType ]]; then
@ -286,7 +289,7 @@ kDFU() {
Echo "* The default password is \"alpine\""
$SCP -P 2222 resources/tools/$kloader tmp/pwnediBSS root@127.0.0.1:/tmp
if [[ $? == 0 ]]; then
$SSH -p 2222 root@127.0.0.1 "/tmp/$kloader /tmp/pwnediBSS" &
$SSH -p 2222 root@127.0.0.1 "chmod +x /tmp/$kloader; /tmp/$kloader /tmp/pwnediBSS" &
else
Log "Cannot connect to device via USB SSH."
Echo "* Please try the steps above to make sure that SSH is successful"

View File

@ -121,7 +121,10 @@ Downgrade() {
IPSW="${IPSWType}_${OSVer}_${BuildVer}_Restore"
IPSWCustom="${IPSWType}_${OSVer}_${BuildVer}_Custom"
if [[ $Jailbreak != 1 && $DeviceProc != 7 ]]; then
if [[ $Jailbreak != 1 && $platform == "win" ]]; then
IPSWCustom="${IPSWCustom}W"
IPSWCustomW=1
elif [[ $Jailbreak != 1 && $DeviceProc != 7 ]]; then
Selection=("futurerestore" "idevicerestore")
Echo "* Select 1 (futurerestore) if unsure"
Echo "* Select 2 (idevicerestore) if you experience issues with futurerestore"

View File

@ -70,12 +70,14 @@ IPSW32() {
ExtraArgs+="-bbupdate"
if [[ ! -e $IPSWCustom.ipsw ]]; then
if [[ $platform != "win" ]]; then
Echo "* By default, memory option is set to Y."
Echo "* Make sure that you have at least 8GB of RAM for it to work!"
Echo "* If it freezes or fails, this may mean that you do not have enough RAM."
Echo "* You may select N if this happens, but make sure that you have enough storage space."
read -p "$(Input 'Memory option? (press Enter/Return if unsure) (Y/n):')" JBMemory
[[ $JBMemory != 'N' && $JBMemory != 'n' ]] && ExtraArgs+=" -memory"
fi
Log "Preparing custom IPSW..."
cd resources
rm -rf FirmwareBundles

2
restore.cmd Normal file
View File

@ -0,0 +1,2 @@
@echo off
C:\msys64\msys2.exe "./restore.sh"

View File

@ -40,6 +40,10 @@ Error() {
echo -e "\n${Color_R}[Error] $1 ${Color_N}"
[[ ! -z $2 ]] && echo "${Color_R}* $2 ${Color_N}"
echo
if [[ $platform == "win" ]]; then
Input "Press Enter/Return to exit."
read -s
fi
exit 1
}
@ -103,6 +107,9 @@ Main() {
mkdir tmp
if [[ $DeviceProc == 7 ]]; then
if [[ $platform == "win" ]]; then
Error "A7 devices are not supported in Windows."
fi
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
@ -183,6 +190,11 @@ Main() {
Log "Option: $Mode"
$Mode
if [[ $platform == "win" ]]; then
Input "Press Enter/Return to exit."
read -s
fi
exit 0
}
@ -206,7 +218,7 @@ SelectVersion() {
Selection+=("iOS 6.1.3")
fi
[[ $Mode == "Downgrade" ]] && Selection+=("Other (use SHSH blobs)")
[[ $Mode == "Downgrade" && $platform != "win" ]] && Selection+=("Other (use SHSH blobs)")
Selection+=("(Any other key to exit)")
Input "Select iOS version:"