From 7178ee484e43b55a39e5e0b61c35cc3da6f50ae4 Mon Sep 17 00:00:00 2001 From: LukeeGD <26163116+LukeZGD@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:31:20 +0800 Subject: [PATCH] Update restore.sh --- restore.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/restore.sh b/restore.sh index e703bfd..9e01a94 100755 --- a/restore.sh +++ b/restore.sh @@ -95,6 +95,7 @@ List of options: --ecid= Specify device ECID --entry-device Enable manual device type and ECID entry --exit-recovery Attempt to exit recovery mode + --kdfu Enter kDFU mode with the connected device --help Display this help message --no-color Disable colors for script output --no-device Enable no device mode @@ -1722,6 +1723,13 @@ device_enter_mode() { fi if [[ $device_proc == 5 ]]; then + local device_todfu + if [[ $device_mode != "DFU" ]]; then + device_todfu=1 + device_enter_mode DFU + log "Device is now in DFU mode. Now put your device in PWNED DFU mode using checkm8-a5." + fi + echo print "* DFU mode for A5(X) device - Make sure that your device is in PWNED DFU mode." print "* You need to have an Arduino and USB Host Shield for checkm8-a5." print "* Use my fork of checkm8-a5: https://github.com/LukeZGD/checkm8-a5" @@ -1729,6 +1737,11 @@ device_enter_mode() { print "* Also make sure that you have NOT sent a pwned iBSS yet." print "* If you do not know what you are doing, restart your device in normal mode." echo + if [[ $device_todfu == 1 ]]; then + log "* After putting your device in PWNED DFU, plug it back in your PC/Mac before pressing Enter/Return." + pause + fi + echo log "Checking for device" device_pwnd="$($irecovery -q | grep "PWND" | cut -c 7-)" if [[ -n $device_pwnd ]]; then @@ -1964,15 +1977,20 @@ device_ipwndfu() { echo "$ipwndfu_sha1" > ../saved/ipwndfu/sha1check rm -rf ../saved/ipwndfu-* fi + # create a lib symlink in the home directory for macos, needed by ipwndfu/pyusb + # no need to do this for homebrew x86_64 since /usr/local/lib is being checked along with ~/lib if [[ $platform == "macos" && ! -e "$HOME/lib/libusb-1.0.dylib" ]]; then if [[ -e "$HOME/lib" && -e "$HOME/lib.bak" ]]; then rm -rf "$HOME/lib" elif [[ -e "$HOME/lib" ]]; then mv "$HOME/lib" "$HOME/lib.bak" fi + # prioritize macports here since it has longer support if [[ -e /opt/local/lib/libusb-1.0.dylib ]]; then + log "Detected libusb installed via MacPorts" ln -sf /opt/local/lib "$HOME/lib" elif [[ -e /opt/homebrew/lib/libusb-1.0.dylib ]]; then + log "Detected libusb installed via Homebrew (arm64)" ln -sf /opt/homebrew/lib "$HOME/lib" fi fi @@ -4408,7 +4426,7 @@ ipsw_prepare_powder() { ipsw_powder_5c70=1 fi if [[ $device_type == "iPhone5"* && $ipsw_powder_5c70 != 1 ]]; then - # do this stuff because these use ramdiskH (jump to /boot/iBEC) instead of jump ibot to ibob + # do this stuff because these use ramdiskH (jump to /boot/iBEC) instead of ramdiskI (jump ibot to ibob) if [[ $device_target_vers == "9"* ]]; then ExtraArr[0]+="9" fi @@ -5627,6 +5645,10 @@ device_ramdisk64() { fi $irecovery -f $ramdisk_path/Kernelcache.img4 $irecovery -c bootx + if [[ $platform == "macos" ]]; then + print "* For some reason, macOS takes way too long to discover iOS devices on some Macs. You may need to wait for a while before it connects." + print "* If it still does not work/recognize your device, try restarting your Mac before trying again." + fi device_find_mode Restore 30 if [[ $ios8 == 1 ]]; then @@ -5882,6 +5904,10 @@ device_ramdisk() { device_iproxy else log "Booting, please wait..." + if [[ $platform == "macos" ]]; then + print "* For some reason, macOS takes way too long to discover iOS devices on some Macs. You may need to wait for a while before it connects." + print "* If it still does not work/recognize your device, try restarting your Mac before trying again." + fi device_find_mode Restore 30 device_iproxy no-logging fi @@ -9614,6 +9640,7 @@ case $1 in device_argmode="entry" main_argmode="device_enter_ramdisk_menu" ;; + "--kdfu" ) main_argmode="kdfu";; esac trap "clean" EXIT