Suspend macOS daemons, and other changes

This commit is contained in:
LukeZGD 2023-09-02 12:56:49 +08:00
parent 2dab9e476b
commit 6cae84483e
24 changed files with 77 additions and 14 deletions

View File

@ -104,7 +104,7 @@
- [**Debian**](https://www.debian.org/) 12 Bookworm and newer, Sid, and Debian-based distros - [**Debian**](https://www.debian.org/) 12 Bookworm and newer, Sid, and Debian-based distros
- [**openSUSE**](https://www.opensuse.org/) Tumbleweed - [**openSUSE**](https://www.opensuse.org/) Tumbleweed
- [**Gentoo**](https://www.gentoo.org/) and Gentoo-based distros - [**Gentoo**](https://www.gentoo.org/) and Gentoo-based distros
- **macOS** 10.13 and newer - **macOS** 10.13 and newer (10.15 and newer recommended)
## Tools and other stuff used ## Tools and other stuff used
- curl - curl

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/macos/idevicediagnostics Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -34,6 +34,9 @@ clean() {
kill $httpserver_pid $iproxy_pid 2>/dev/null kill $httpserver_pid $iproxy_pid 2>/dev/null
popd &>/dev/null popd &>/dev/null
rm -rf "$(dirname "$0")/tmp/"* "$(dirname "$0")/iP"*/ "$(dirname "$0")/tmp/" 2>/dev/null rm -rf "$(dirname "$0")/tmp/"* "$(dirname "$0")/iP"*/ "$(dirname "$0")/tmp/" 2>/dev/null
if [[ $platform == "macos" ]]; then
killall -CONT AMPDevicesAgent AMPDeviceDiscoveryAgent MobileDeviceUpdater
fi
} }
clean_sudo() { clean_sudo() {
@ -243,6 +246,9 @@ set_tool_paths() {
sha1sum="$(which shasum) -a 1" sha1sum="$(which shasum) -a 1"
sha256sum="$(which shasum) -a 256" sha256sum="$(which shasum) -a 256"
# kill macos daemons
killall -STOP AMPDevicesAgent AMPDeviceDiscoveryAgent MobileDeviceUpdater
else else
error "Your platform ($OSTYPE) is not supported." "* Supported platforms: Linux, macOS" error "Your platform ($OSTYPE) is not supported." "* Supported platforms: Linux, macOS"
fi fi
@ -694,6 +700,14 @@ device_get_info() {
echo echo
error "This device is not supported by Legacy iOS Kit." error "This device is not supported by Legacy iOS Kit."
fi fi
if [[ $device_mode == "DFU" && $device_proc == 1 ]]; then
warn "Your device $device_type seems to be on an incorrect mode for restoring."
print "* Force restart your device and place it in normal or recovery mode, then run the script again."
print "* Or proceed to do the DFU mode procedure below."
device_dfuhelper
fi
# set device_use_vers, device_use_build (where to get the baseband and manifest from for ota/other) # set device_use_vers, device_use_build (where to get the baseband and manifest from for ota/other)
# for a7/a8 other restores 11.3+, device_latest_vers and device_latest_build are used # for a7/a8 other restores 11.3+, device_latest_vers and device_latest_build are used
case $device_type in case $device_type in
@ -816,7 +830,9 @@ device_find_mode() {
local device_in local device_in
local mode="$1" local mode="$1"
if [[ $mode == "Recovery" ]]; then if [[ $mode == "Restore" ]]; then
:
elif [[ $mode == "Recovery" ]]; then
usb=1281 usb=1281
elif [[ $device_proc == 1 ]]; then elif [[ $device_proc == 1 ]]; then
usb=1222 usb=1222
@ -829,16 +845,19 @@ device_find_mode() {
if [[ -n $2 ]]; then if [[ -n $2 ]]; then
timeout=$2 timeout=$2
elif [[ $platform == "linux" ]]; then elif [[ $platform == "linux" || $mode == "Restore" ]]; then
timeout=24 timeout=24
fi fi
log "Finding device in $mode mode..." log "Finding device in $mode mode..."
while (( i < timeout )); do while (( i < timeout )); do
if [[ $platform == "linux" ]]; then if [[ $mode == "Restore" ]]; then
device_in=$(lsusb | grep -c "05ac:$usb") $ideviceinfo -s >/dev/null
elif [[ $mode == "Restore" && $($ideviceinfo -s) ]]; then if [[ $? == 0 ]]; then
device_in=1 device_in=1
fi
elif [[ $platform == "linux" ]]; then
device_in=$(lsusb | grep -c "05ac:$usb")
elif [[ $($irecovery -q 2>/dev/null | grep -w "MODE" | cut -c 7-) == "$mode" ]]; then elif [[ $($irecovery -q 2>/dev/null | grep -w "MODE" | cut -c 7-) == "$mode" ]]; then
device_in=1 device_in=1
fi fi
@ -874,6 +893,31 @@ device_sshpass() {
ssh="$dir/sshpass -p $pass $ssh2" ssh="$dir/sshpass -p $pass $ssh2"
} }
device_dfuhelper() {
print "* Get ready to enter DFU mode."
read -p "$(input 'Select Y to continue, N to exit (Y/n) ')" opt
if [[ $opt == 'N' || $opt == 'n' ]]; then
exit
fi
print "* Get ready..."
for i in {03..01}; do
echo -n "$i "
sleep 1
done
echo -e "\n$(print '* Hold TOP and HOME buttons.')"
for i in {10..01}; do
echo -n "$i "
sleep 1
done
echo -e "\n$(print '* Release TOP button and keep holding HOME button.')"
for i in {08..01}; do
echo -n "$i "
sleep 1
done
echo
device_find_mode DFU
}
device_enter_mode() { device_enter_mode() {
# usage: device_enter_mode {Recovery, DFU, kDFU, pwnDFU} # usage: device_enter_mode {Recovery, DFU, kDFU, pwnDFU}
# attempt to enter given mode, and device_find_mode function will then set device_mode variable # attempt to enter given mode, and device_find_mode function will then set device_mode variable
@ -898,7 +942,7 @@ device_enter_mode() {
"DFU" ) "DFU" )
if [[ $device_mode == "Normal" ]]; then if [[ $device_mode == "Normal" ]]; then
device_enter_mode Recovery device_enter_mode Recovery
elif [[ $device_mode == "DFU" ]]; then elif [[ $device_mode == "DFU" || $device_mode == "WTF" ]]; then
return return
fi fi
# DFU Helper for recovery mode # DFU Helper for recovery mode
@ -909,12 +953,20 @@ device_enter_mode() {
$irecovery -n $irecovery -n
exit exit
fi fi
print "* Hold TOP and HOME buttons for 10 seconds." print "* Get ready..."
for i in {10..01}; do for i in {03..01}; do
echo -n "$i " echo -n "$i "
sleep 1 sleep 1
done done
echo -e "\n$(print '* Release TOP button and hold HOME button for 8 seconds.')" echo -e "\n$(print '* Hold TOP and HOME buttons.')"
for i in {04..01}; do
echo -n "$i "
if (( i <= 1 )); then
$irecovery -n
fi
sleep 1
done
echo -e "\n$(print '* Release TOP button and keep holding HOME button.')"
for i in {08..01}; do for i in {08..01}; do
echo -n "$i " echo -n "$i "
sleep 1 sleep 1
@ -3100,7 +3152,7 @@ device_ramdisk() {
fi fi
log "Sending iBSS..." log "Sending iBSS..."
$irecovery -f $ramdisk_path/iBSS $irecovery -f $ramdisk_path/iBSS
if [[ $device_type != "iPod2,1" ]]; then if [[ $device_type != "iPod2,1" && $device_proc != 1 ]]; then
sleep 2 sleep 2
log "Sending iBEC..." log "Sending iBEC..."
$irecovery -f $ramdisk_path/iBEC $irecovery -f $ramdisk_path/iBEC
@ -3117,7 +3169,7 @@ device_ramdisk() {
$irecovery -f $ramdisk_path/Kernelcache.dec $irecovery -f $ramdisk_path/Kernelcache.dec
$irecovery -c bootx $irecovery -c bootx
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
sleep 20 device_find_mode Restore
fi fi
case $1 in case $1 in
@ -3421,7 +3473,7 @@ menu_print_info() {
print "* Stitching is supported in these restores/downgrades: 8.4.1/6.1.3, Other with SHSH (iOS 5+), powdersn0w" print "* Stitching is supported in these restores/downgrades: 8.4.1/6.1.3, Other with SHSH (iOS 5+), powdersn0w"
fi fi
print "* iOS Version: $device_vers" print "* iOS Version: $device_vers"
if [[ $device_vers == "Unknown" ]]; then if [[ $device_vers == "Unknown" && $device_proc != 1 ]]; then
print "* To get iOS version, go to: Other Utilities -> Get iOS Version" print "* To get iOS version, go to: Other Utilities -> Get iOS Version"
fi fi
print "* ECID: $device_ecid" print "* ECID: $device_ecid"
@ -4064,7 +4116,7 @@ menu_other() {
if [[ $device_mode != "none" ]]; then if [[ $device_mode != "none" ]]; then
menu_items+=("SSH Ramdisk") menu_items+=("SSH Ramdisk")
case $device_mode in case $device_mode in
"Normal" ) menu_items+=("Attempt Activation" "Enter Recovery Mode");; "Normal" ) menu_items+=("Attempt Activation" "Shutdown Device" "Restart Device" "Enter Recovery Mode");;
"Recovery" ) menu_items+=("Exit Recovery Mode");; "Recovery" ) menu_items+=("Exit Recovery Mode");;
esac esac
if [[ $device_mode != "DFU" ]]; then if [[ $device_mode != "DFU" ]]; then
@ -4099,6 +4151,8 @@ menu_other() {
"Enter DFU Mode" ) mode="enterdfu";; "Enter DFU Mode" ) mode="enterdfu";;
"Just Boot" ) mode="justboot";; "Just Boot" ) mode="justboot";;
"Get iOS Version" ) mode="getversion";; "Get iOS Version" ) mode="getversion";;
"Shutdown Device" ) mode="shutdown";;
"Restart Device" ) mode="restart";;
"Go Back" ) back=1;; "Go Back" ) back=1;;
esac esac
done done
@ -4192,7 +4246,14 @@ device_dump() {
device_activate() { device_activate() {
log "Attempting to activate device with ideviceactivation" log "Attempting to activate device with ideviceactivation"
if (( device_proc <= 4 )) && [[ $device_type == "iPhone"* ]]; then
print "* For iPhone 4 and older devices, make sure to have a valid SIM card."
if [[ $device_proc == 1 || $device_type == "iPhone2,1" ]]; then
print "* For hacktivation, go to Restore/Downgrade instead."
fi
fi
$ideviceactivation activate $ideviceactivation activate
print "* If it returns an error, just try again."
} }
restore_customipsw() { restore_customipsw() {
@ -4354,6 +4415,8 @@ main() {
"dfuipswipsw" ) restore_dfuipsw ipsw;; "dfuipswipsw" ) restore_dfuipsw ipsw;;
"justboot" ) device_justboot;; "justboot" ) device_justboot;;
"getversion" ) device_ramdisk getversion;; "getversion" ) device_ramdisk getversion;;
"shutdown" ) "$dir/idevicediagnostics" shutdown;;
"restart" ) "$dir/idevicediagnostics" restart;;
* ) :;; * ) :;;
esac esac