diff --git a/.gitignore b/.gitignore index 965b1d0..208381d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ resources/jailbreak/bin.tar resources/jailbreak/cydia.tar resources/jailbreak/untether.tar resources/libimobiledevice*/ +resources/powdersn0w/ resources/ramdisk/ saved/ sshdeb.tar diff --git a/README.md b/README.md index 31390ed..64c83a1 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ - **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 -- **iPhone4Down supports the iPhone 4 GSM (iPhone3,1) only** +- **iPhone4Down supports iPhone 4 GSM and CDMA (iPhone3,1 and iPhone3,3)** @@ -48,10 +48,11 @@ - + + diff --git a/resources/depends.sh b/resources/depends.sh index b36f93e..ac90fb9 100755 --- a/resources/depends.sh +++ b/resources/depends.sh @@ -118,6 +118,10 @@ SaveExternal() { Link=https://web.archive.org/web/20210529174714if_/https://codeload.github.com/dora2-iOS/ch3rryflower/zip/316d2cdc5351c918e9db9650247b91632af3f11f Name=ch3rryflower SHA1=790d56db354151b9740c929e52c097ba57f2929d + elif [[ $1 == "powdersn0w" ]]; then + Link=https://dora2ios.github.io/download/konayuki/powdersn0w_v2.0b3.zip + Name=powdersn0w + SHA1=c733aac4a0833558ef9f5517f2a11ca547110b6e fi if [[ -d ./resources/$Name ]]; then return diff --git a/resources/device.sh b/resources/device.sh index 115daff..29b4394 100755 --- a/resources/device.sh +++ b/resources/device.sh @@ -158,7 +158,7 @@ GetDeviceValues() { if [[ $ProductType == "iPhone3"* ]]; then DeviceProc=4 - if [[ $ProductType == "iPhone3,1" ]]; then + if [[ $ProductType != "iPhone3,2" ]]; then Log "$ProductType detected. iPhone4Down functions enabled." Echo "* This script uses powdersn0w by dora2ios" else diff --git a/resources/ipsw.sh b/resources/ipsw.sh index 941baf4..b0d503a 100755 --- a/resources/ipsw.sh +++ b/resources/ipsw.sh @@ -42,6 +42,11 @@ JailbreakSet() { } JailbreakOption() { + if [[ $ProductType == "iPhone3,3" && $OSVer != "7.1.2" ]]; then + IPSWCustom="${ProductType}_${OSVer}_${BuildVer}_Custom" + return + fi + Input "Jailbreak Option" Echo "* When this option is enabled, your device will be jailbroken on restore." if [[ $OSVer == "6.1.3" ]]; then @@ -257,6 +262,9 @@ IPSW4() { if [[ $OSVer == "4.3"* ]]; then IPSW4Cherry return + elif [[ $ProductType == "iPhone3,3" && $OSVer != "7.1.2" ]]; then + IPSW4Powder + return else local JBURL2="https://github.com/LukeZGD/powdersn0w_pub/raw/main/xpwn/src/target/n90/11D257/exploit" JailbreakFiles $JBURL2 exploit bedd10a96ba0f305a0af74a15e1eee88946070a1 @@ -416,6 +424,46 @@ IPSW4Cherry() { cd ../../.. } +IPSW4Powder() { + Log "powdersn0w v2.0b3 will be used instead of powdersn0w_pub for iPhone3,3" # powdersn0w_pub doesn't have n92 exploit + SaveExternal powdersn0w # downloads powdersn0w from https://dora2ios.github.io/download/konayuki/powdersn0w_v2.0b3.zip + + powderdir="../resources/powdersn0w/macosx_x86_64" + cd tmp + cp -rf $powderdir/FirmwareBundles $powderdir/src . + powdersn0w="$powderdir/ipsw" + + if [[ $platform != "macos" ]]; then + echo "QlNESUZGNDA2AAAAAAAAAEkAAAAAAAAA4HscAAAAAABCWmg5MUFZJlNZcLcTFwAAB+DBQKAABAAIQCBCACAAIjEaNCDJiDaAhcW9PF3JFOFCQcLcTFxCWmg5MUFZJlNZidWPbQAOTMKswAAAAJAAEAAACKAAAAigAFCDJiBNUpoPU+qqe5IkMxAqd8VISW223BKUbv4u5IpwoSETqx7aQlpoORdyRThQkAAAAAA=" | base64 -d | tee ipsw.patch >/dev/null + $bspatch $powderdir/ipsw $powderdir/ipsw_patched ipsw.patch + powdersn0w="darling $(pwd)/$powderdir/ipsw_patched" + if [[ ! $(which darling) ]]; then + Error "Cannot find darling. darling is required to create custom IPSW." + fi + fi +# above patch changes temp path from /tmp to ././ (current dir) +# only modifies xpwn part, hopefully doesn't violate nbsk license. here is the equivalent diff (based on gpl code released): +: ' +main.c: +187c188 +< strcpy(tmpFileBuffer, "/tmp/rootXXXXXX"); +--- +> strcpy(tmpFileBuffer, "././/rootXXXXXX"); +outputstate.c: +292c292 +< strcpy(tmpFileBuffer, "/tmp/pwnXXXXXX"); +--- +> strcpy(tmpFileBuffer, "././/pwnXXXXXX"); +' + Log "Preparing custom IPSW with powdersn0w..." + $powdersn0w ../$IPSW.ipsw ../$IPSWCustom.ipsw -useDRA ../$IPSW7.ipsw + cd .. + + if [[ ! -e $IPSWCustom.ipsw ]]; then + Error "Failed to find custom IPSW. Please run the script again" + fi +} + IPSW64() { if [[ -e $IPSWCustom.ipsw ]]; then Log "Found existing Custom IPSW. Skipping IPSW creation." diff --git a/restore.sh b/restore.sh index a755427..f398b5d 100755 --- a/restore.sh +++ b/restore.sh @@ -321,9 +321,10 @@ SelectVersion() { if [[ $ProductType == "iPhone3"* ]]; then [[ $Mode == "IPSW32" ]] && Selection+=("7.1.2") + [[ $ProductType != "iPhone3,2" ]] && Selection+=("6.1.3") if [[ $ProductType == "iPhone3,1" ]]; then - Selection+=("6.1.3 ""5.1.1 (9B208)" "5.1.1 (9B206)") + Selection+=("5.1.1 (9B208)" "5.1.1 (9B206)") Selection2=("6.1.2" "6.1" "6.0.1" "6.0" "5.1" "5.0.1" "5.0") if [[ $platform != "linux" ]]; then Echo "* iOS 4.3.x downgrades are supported on Linux only" @@ -334,6 +335,12 @@ SelectVersion() { Selection2+=("4.3.3" "4.3") fi Selection+=("More versions") + + elif [[ $ProductType == "iPhone3,3" && $platform != "macos" && $Mode != "Restore712" ]]; then + Echo "* For creating 6.1.3 custom IPSW, make sure to have darling installed: https://github.com/darlinghq/darling" + Echo "* For Ubuntu/Debian, you may install the .deb from releases." + Echo "* For Arch, you may install darling-bin from AUR." + Echo "* For other distros, you might need to build darling yourself." fi if [[ $Mode == "Restore712" ]]; then
iPad mini 1
iPod touch 5
iOS 6.1.3iOS 6.1.3 iPhone 4S
iPad 2 (except iPad2,4)
iPhone 4 GSM, CDMA
iOS 7.1.2 iPhone 4 (all models)