diff --git a/README.md b/README.md index aad8dae..a8bab83 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ - [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice), [libirecovery](https://github.com/libimobiledevice/libirecovery) - libimobiledevice ([macOS/Windows builds](https://github.com/libimobiledevice-win32/imobiledevice-net)) - [tsschecker](https://github.com/tihmstar/tsschecker) - tihmstar ([1Conan fork](https://github.com/1Conan/tsschecker)) - [futurerestore](https://github.com/futurerestore/futurerestore) - futurerestore beta (and 194) -- [idevicerestore](https://github.com/LukeeGD/idevicerestore) - LukeZGD fork +- [idevicerestore](https://github.com/LukeZGD/idevicerestore) - LukeZGD fork - [kloader](https://www.youtube.com/watch?v=fh0tB6fp0Sc) - [kloader5 for iOS 5](https://www.pmbonneau.com/cydia/com.pmbonneau.kloader5_1.2_iphoneos-arm.deb) - [kloader_hgsp for iOS 10](https://twitter.com/nyan_satan/status/945203180522045440) diff --git a/resources/blobs.sh b/resources/blobs.sh index 9d06e32..a9c1d26 100755 --- a/resources/blobs.sh +++ b/resources/blobs.sh @@ -3,58 +3,55 @@ SaveOTABlobs() { local APNonce=$1 local ExtraArgs - local SHSHChk - local SHSHContinue - local SHSHLatest - local SHSHExisting + local SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh* + BuildManifest="resources/manifests/BuildManifest_${ProductType}_${OSVer}.plist" + + if [[ $(ls saved/shsh/$SHSHChk 2>/dev/null) ]]; then + Log "Found existing saved $OSVer blobs." + return + fi 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 -b " [[ -n $APNonce ]] && ExtraArgs+="--apnonce $APNonce" || ExtraArgs+="-g 0x1111111111111111" - SHSHChk=${UniqueChipID}_${ProductType}_${HWModel}ap_${OSVer}-${BuildVer}*.shsh* $tsschecker $ExtraArgs - SHSH=$(ls $SHSHChk) - SHSHExisting=$(ls saved/shsh/$SHSHChk 2>/dev/null) - if [[ ! -e $SHSH && ! -e $SHSHExisting ]]; then - Error "Saving $OSVer blobs failed. Please run the script again" \ - "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." - cp $SHSHExisting . - SHSH=$(ls $SHSHChk) - SHSHContinue=1 - fi - - if [[ -n $SHSH && $SHSHContinue != 1 ]]; then + if [[ -n $SHSH ]]; then mkdir -p saved/shsh 2>/dev/null [[ -z $APNonce ]] && cp "$SHSH" saved/shsh Log "Successfully saved $OSVer blobs." + else + Error "Saving $OSVer blobs failed. Please run the script again" \ + "It is also possible that $OSVer for $ProductType is no longer signed" fi } Save712Blobs() { local SHSHChk - BuildManifest="saved/iPhone3,1/BuildManifest.plist" + BuildManifest="saved/$ProductType/BuildManifest.plist" SHSH="saved/shsh/${UniqueChipID}-${ProductType}-7.1.2.shsh" - if [[ ! -e $BuildManifest ]]; then - Log "Extracting BuildManifest from 7.1.2 IPSW..." - unzip -o -j $IPSW7.ipsw BuildManifest.plist -d . - mkdir -p saved/iPhone3,1 2>/dev/null - mv BuildManifest.plist $BuildManifest - fi - if [[ -e $SHSH ]]; then Log "Found existing saved 7.1.2 blobs." return fi + + if [[ ! -e $BuildManifest && -e $IPSW7.ipsw ]]; then + Log "Extracting BuildManifest from 7.1.2 IPSW..." + unzip -o -j $IPSW7.ipsw BuildManifest.plist -d . + mkdir -p saved/$ProductType 2>/dev/null + mv BuildManifest.plist $BuildManifest + elif [[ ! -e $BuildManifest ]]; then + Log "Downloading BuildManifest for 7.1.2..." + $partialzip $BasebandURL BuildManifest.plist BuildManifest.plist + mkdir -p saved/$ProductType 2>/dev/null + mv BuildManifest.plist $BuildManifest + fi + Log "Saving 7.1.2 blobs with tsschecker..." $tsschecker -d $ProductType -i 7.1.2 -e $UniqueChipID -m $BuildManifest -s -b SHSHChk=$(ls ${UniqueChipID}_${ProductType}_7.1.2-11D257_*.shsh2) - [[ ! $SHSHChk ]] && Error "Saving $OSVer blobs failed. Please run the script again" + [[ -z $SHSHChk ]] && Error "Saving $OSVer blobs failed. Please run the script again" mkdir saved/shsh 2>/dev/null mv $SHSHChk $SHSH Log "Successfully saved 7.1.2 blobs." diff --git a/resources/depends.sh b/resources/depends.sh index 6c52f0d..070b6e9 100755 --- a/resources/depends.sh +++ b/resources/depends.sh @@ -224,4 +224,5 @@ InstallDepends() { cd .. Log "Install script done! Please run the script again to proceed" Log "If your iOS device is plugged in, unplug and replug your device" + ExitWin 0 } diff --git a/resources/downgrade.sh b/resources/downgrade.sh index d9202df..fc89ca2 100755 --- a/resources/downgrade.sh +++ b/resources/downgrade.sh @@ -136,6 +136,59 @@ DowngradeOther() { FutureRestore } + +iDeviceRestore() { + mkdir shsh + cp $SHSH shsh/${UniqueChipID}-${ProductType}-${OSVer}.shsh + Log "Proceeding to idevicerestore..." + [[ $1 == "latest" ]] && ExtraArgs="-e" || ExtraArgs="-e -w" + [[ $platform == "win" ]] && ExtraArgs="-ewy" + $idevicerestore $ExtraArgs "$IPSWRestore.ipsw" + if [[ $platform == "win" && $? != 0 ]]; then + Log "Restoring done! Read the message below if any error has occurred:" + Echo "* Windows users may encounter errors like \"Unable to send APTicket\" or \"Unable to send iBEC\" in the restore process." + Echo "* To fix this, follow troubleshooting steps from here: https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting#windows" + elif [[ $? != 0 ]]; then + Log "An error seems to have occurred in idevicerestore." + Echo "* Please read the \"Troubleshooting\" wiki page in GitHub before opening any issue!" + Echo "* Your problem may have already been addressed within the wiki page." + Echo "* If opening an issue in GitHub, please provide a FULL log. Otherwise, your issue may be dismissed." + else + echo + Log "Restoring done!" + fi + Log "Downgrade script done!" +} + +IPSWCustomA7() { + local fr194=() + if [[ $platform == "macos" ]]; then + fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-macOS.tar.xz" "d279423dd9a12d3a7eceaeb7e01beb332c306aaa") + elif [[ $platform == "linux" ]]; then + fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-ubuntu_20.04.2.tar.xz" "9f2b4b6cc6710d1d68880711001d2dc5b4cb9407") + fi + Input "Custom IPSW Option" + Echo "* When this option is enabled, a custom IPSW will be created/used for restoring." + Echo "* Only enable this when you encounter problems with futurerestore." + Echo "* This option is disabled by default (N)." + read -p "$(Input 'Enable this option? (y/N):')" IPSWA7 + if [[ $IPSWA7 != 'Y' && $IPSWA7 != 'y' ]]; then + return + fi + IPSWA7=1 + Log "Custom IPSW option enabled by user." + futurerestore="./resources/tools/futurerestore194_$platform" + if [[ ! -e $futurerestore ]]; then + cd tmp + SaveFile ${fr194[0]} futurerestore.tar.xz ${fr194[1]} + 7z x futurerestore.tar.xz + tar -xf futurerestore*.tar + chmod +x futurerestore-v194 + mv futurerestore-v194 ../$futurerestore + cd .. + fi + } + DowngradeOTA() { if [[ $DeviceProc != 7 ]]; then JailbreakOption @@ -177,35 +230,6 @@ DowngradeOTAWin() { iDeviceRestore } -IPSWCustomA7() { - local fr194=() - if [[ $platform == "macos" ]]; then - fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-macOS.tar.xz" "d279423dd9a12d3a7eceaeb7e01beb332c306aaa") - elif [[ $platform == "linux" ]]; then - fr194=("https://github.com/futurerestore/futurerestore/releases/download/194/futurerestore-v194-ubuntu_20.04.2.tar.xz" "9f2b4b6cc6710d1d68880711001d2dc5b4cb9407") - fi - Input "Custom IPSW Option" - Echo "* When this option is enabled, a custom IPSW will be created/used for restoring." - Echo "* Only enable this when you encounter problems with futurerestore." - Echo "* This option is disabled by default (N)." - read -p "$(Input 'Enable this option? (y/N):')" IPSWA7 - if [[ $IPSWA7 != 'Y' && $IPSWA7 != 'y' ]]; then - return - fi - IPSWA7=1 - Log "Custom IPSW option enabled by user." - futurerestore="./resources/tools/futurerestore194_$platform" - if [[ ! -e $futurerestore ]]; then - cd tmp - SaveFile ${fr194[0]} futurerestore.tar.xz ${fr194[1]} - 7z x futurerestore.tar.xz - tar -xf futurerestore*.tar - chmod +x futurerestore-v194 - mv futurerestore-v194 ../$futurerestore - cd .. - fi - } - Downgrade() { Log "Select your options when asked. If unsure, go for the defaults (press Enter/Return)." echo @@ -224,31 +248,6 @@ Downgrade() { DowngradeOTA } -iDeviceRestore() { - mkdir shsh - cp $SHSH shsh/${UniqueChipID}-${ProductType}-${OSVer}.shsh - Log "Proceeding to idevicerestore..." - [[ $platform == "macos" ]] && sudo codesign --sign - --force --deep $idevicerestore - [[ $1 == "latest" ]] && ExtraArgs="-e" || ExtraArgs="-e -w" - [[ $platform == "win" ]] && ExtraArgs="-ewy" - $idevicerestore $ExtraArgs "$IPSWRestore.ipsw" - if [[ $platform == "macos" && $? != 0 ]]; then - Log "Restoring done! Read the message below if any error has occurred:" - Echo "* If the \"Killed: 9\" or other similar error pops up, try these steps:" - Echo "* Using Terminal, cd to where the script is located, then run" - Echo "* sudo codesign --sign - --force --deep resources/tools/idevicerestore_macos" - Echo "* For more details, read the \"Troubleshooting\" wiki page in GitHub" - elif [[ $platform == "win" && $? != 0 ]]; then - Log "Restoring done! Read the message below if any error has occurred:" - Echo "* Windows users may encounter errors like \"Unable to send APTicket\" or \"Unable to send iBEC\" in the restore process." - Echo "* To fix this, follow troubleshooting steps from here: https://github.com/LukeZGD/iOS-OTA-Downgrader/wiki/Troubleshooting#windows" - else - echo - Log "Restoring done!" - fi - Log "Downgrade script done!" -} - Downgrade4() { JailbreakOption IPSWFindVerify diff --git a/resources/firmware/iPhone3,1/10A403/sha1sum b/resources/firmware/iPhone3,1/10A403/sha1sum index 8ad5653..0a1dd27 100644 --- a/resources/firmware/iPhone3,1/10A403/sha1sum +++ b/resources/firmware/iPhone3,1/10A403/sha1sum @@ -1 +1 @@ -c98ac468d86c4d8aaaf878c6ba97db79659d48cc \ No newline at end of file +4553077c61fd9c487c906ee419d2159f807a00fb diff --git a/resources/firmware/iPhone3,1/10A523/sha1sum b/resources/firmware/iPhone3,1/10A523/sha1sum index 3d9f334..b079f96 100644 --- a/resources/firmware/iPhone3,1/10A523/sha1sum +++ b/resources/firmware/iPhone3,1/10A523/sha1sum @@ -1 +1 @@ -04bba84a98b248400c159164a8ea247f12eeb5ea \ No newline at end of file +3d123107c71588fef6f03bd1fc8ca42bda400621 diff --git a/resources/ipsw.sh b/resources/ipsw.sh index 0bfb2ed..48db7c5 100755 --- a/resources/ipsw.sh +++ b/resources/ipsw.sh @@ -44,6 +44,7 @@ JailbreakSet() { } JailbreakOption() { + echo 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 diff --git a/restore.sh b/restore.sh index e5ba97c..7643f76 100755 --- a/restore.sh +++ b/restore.sh @@ -20,7 +20,7 @@ fi Clean() { rm -rf iP*/ shsh/ tmp/ *.im4p *.bbfw ${UniqueChipID}_${ProductType}_*.shsh2 \ - ${UniqueChipID}_${ProductType}_${HWModel}ap_*.shsh BuildManifest.plist + ${UniqueChipID}_${ProductType}_${HWModel}ap_*.shsh BuildManifest.plist version.xml kill $iproxyPID $ServerPID 2>/dev/null } @@ -104,7 +104,6 @@ Main() { fi Clean InstallDepends - ExitWin 0 fi GetDeviceValues $1 @@ -163,7 +162,7 @@ Main() { if [[ $DeviceProc == 4 && $OSVer == "7.1.2" ]]; then Log "Creating custom IPSW is not needed for non-jailbroken 7.1.2 restores." ExitWin 0 - elif [[ $ProductType != "iPad2,3" ]]; then + elif [[ $ProductType != "iPhone3"* && $ProductType != "iPad2,3" ]]; then Log "Creating custom IPSW is not needed for non-jailbroken restores on your device." ExitWin 0 fi