Check files for downloads, add sideloader option, other stuff

also add device type selection when iphone1,1 is detected in dfu/recovery
This commit is contained in:
LukeZGD 2024-05-02 10:53:02 +08:00
parent 04c0b80510
commit 9161a667f7
2 changed files with 76 additions and 40 deletions

View File

@ -138,6 +138,7 @@
- [ideviceinstaller](https://github.com/libimobiledevice/ideviceinstaller) - libimobiledevice - [ideviceinstaller](https://github.com/libimobiledevice/ideviceinstaller) - libimobiledevice
- [anisette-server](https://github.com/Dadoum/Provision) from Provision - Dadoum (used for sideloading on Linux) - [anisette-server](https://github.com/Dadoum/Provision) from Provision - Dadoum (used for sideloading on Linux)
- [AltServer-Linux](https://github.com/NyaMisty/AltServer-Linux) - NyaMisty (used for sideloading on Linux) - [AltServer-Linux](https://github.com/NyaMisty/AltServer-Linux) - NyaMisty (used for sideloading on Linux)
- [Sideloader](https://github.com/Dadoum/Sideloader) - Dadoum (used for sideloading on Linux)
- [tsschecker](https://github.com/tihmstar/tsschecker) - tihmstar; [1Conan fork](https://github.com/1Conan/tsschecker) v413 - [tsschecker](https://github.com/tihmstar/tsschecker) - tihmstar; [1Conan fork](https://github.com/1Conan/tsschecker) v413
- [futurerestore](https://github.com/tihmstar/futurerestore) - tihmstar - [futurerestore](https://github.com/tihmstar/futurerestore) - tihmstar
- [LukeZGD fork](https://github.com/LukeZGD/futurerestore) used for restoring 32-bit devices - [LukeZGD fork](https://github.com/LukeZGD/futurerestore) used for restoring 32-bit devices

View File

@ -637,6 +637,14 @@ device_get_info() {
device_type=$(echo "$device_type" | cut -c -$ProdCut) device_type=$(echo "$device_type" | cut -c -$ProdCut)
device_ecid=$(printf "%d" $($irecovery -q | grep "ECID" | cut -c 7-)) # converts hex ecid to dec device_ecid=$(printf "%d" $($irecovery -q | grep "ECID" | cut -c 7-)) # converts hex ecid to dec
fi fi
if [[ $device_type == "iPhone1,1" && -z $device_argmode ]]; then
print "* Device type selection"
print "* Select Y if the device is an iPhone 2G, or N if it is an iPod touch 1"
read -p "$(input 'Is this device an iPhone 2G? (Y/n): ')" opt
if [[ $opt == 'n' || $opt == 'N' ]]; then
device_type="iPod1,1"
fi
fi
device_model=$($irecovery -q | grep "MODEL" | cut -c 8-) device_model=$($irecovery -q | grep "MODEL" | cut -c 8-)
device_vers=$(echo "/exit" | $irecovery -s | grep -a "iBoot-") device_vers=$(echo "/exit" | $irecovery -s | grep -a "iBoot-")
[[ -z $device_vers ]] && device_vers="Unknown" [[ -z $device_vers ]] && device_vers="Unknown"
@ -753,7 +761,7 @@ device_get_info() {
iPhone1,[12] | iPod1,1 ) iPhone1,[12] | iPod1,1 )
device_proc=1;; # S5L8900 device_proc=1;; # S5L8900
iPhone3,[123] | iPhone2,1 | iPad1,1 | iPod[234],1 ) iPhone3,[123] | iPhone2,1 | iPad1,1 | iPod[234],1 )
device_proc=4;; # A4/S5L8920/8922/8720 device_proc=4;; # A4/S5L8720/8920/8922
iPad2,[1234567] | iPad3,[123] | iPhone4,1 | iPod5,1 ) iPad2,[1234567] | iPad3,[123] | iPhone4,1 | iPod5,1 )
device_proc=5;; # A5 device_proc=5;; # A5
iPad3,[456] | iPhone5,[1234] ) iPad3,[456] | iPhone5,[1234] )
@ -765,7 +773,7 @@ device_get_info() {
iPhone8,[124] ) iPhone8,[124] )
device_proc=9;; # A9 device_proc=9;; # A9
iPhone9,[1234] | iPhone10* | iPad6* | iPod9,1 ) iPhone9,[1234] | iPhone10* | iPad6* | iPod9,1 )
device_proc=10;; # A10 (or A9/A11 iOS 16 device) device_proc=10;; # A10 (or A9 iPad/A11 device)
iPhone* | iPad* ) iPhone* | iPad* )
device_proc=11;; # Newer devices device_proc=11;; # Newer devices
esac esac
@ -1559,6 +1567,12 @@ download_file() {
local filename="$(basename $2)" local filename="$(basename $2)"
log "Downloading $filename..." log "Downloading $filename..."
curl -L $1 -o $2 curl -L $1 -o $2
if [[ ! -s $2 ]]; then
error "Downloading $2 failed. Please run the script again"
fi
if [[ -z $3 ]]; then
return
fi
local sha1=$($sha1sum $2 | awk '{print $1}') local sha1=$($sha1sum $2 | awk '{print $1}')
if [[ $sha1 != "$3" ]]; then if [[ $sha1 != "$3" ]]; then
error "Verifying $filename failed. The downloaded file may be corrupted or incomplete. Please run the script again" \ error "Verifying $filename failed. The downloaded file may be corrupted or incomplete. Please run the script again" \
@ -3853,11 +3867,7 @@ restore_futurerestore() {
"linux" ) file+="Linux-x86_64-RELEASE.zip";; "linux" ) file+="Linux-x86_64-RELEASE.zip";;
esac esac
url+="$file" url+="$file"
log "Downloading futurerestore: $url" download_file $url $file
curl -LO "$url"
if [[ ! -s "$file" ]]; then
error "Downloading futurerestore failed. Please run the script again"
fi
unzip -q "$file" -d . unzip -q "$file" -d .
tar -xJvf futurerestore*.xz tar -xJvf futurerestore*.xz
mv futurerestore $futurerestore2 mv futurerestore $futurerestore2
@ -4106,10 +4116,8 @@ restore_prepare() {
fi fi
;; ;;
[78] ) 7 )
if [[ $device_proc == 8 || $device_latest_vers == "15"* ]]; then if [[ $device_target_other != 1 && $device_target_vers == "10.3.3" ]]; then
:
elif [[ $device_target_other != 1 && $device_target_vers == "10.3.3" ]]; then
# A7 devices 10.3.3 # A7 devices 10.3.3
shsh_save shsh_save
if [[ $device_type == "iPad4,4" || $device_type == "iPad4,5" ]]; then if [[ $device_type == "iPad4,4" || $device_type == "iPad4,5" ]]; then
@ -4133,25 +4141,23 @@ restore_prepare() {
restore_futurerestore restore_futurerestore
fi fi
;; ;;
esac
if [[ $device_proc == 8 || $device_latest_vers == "15"* || $device_latest_vers == "16"* ]]; then [89] | 10 )
if [[ $device_target_vers == "$device_latest_vers" ]]; then if [[ $device_target_vers == "$device_latest_vers" ]]; then
restore_latest restore_latest
return return
fi
device_enter_mode pwnDFU
if [[ -s ../saved/firmwares.json ]]; then
cp ../saved/firmwares.json /tmp
else
log "Downloading firmwares.json from ipsw.me"
curl -L https://api.ipsw.me/v2.1/firmwares.json/condensed -o firmwares.json
if [[ ! -s firmwares.json ]]; then
error "Downloading firmwares.json failed. Please run the script again"
fi fi
cp firmwares.json ../saved /tmp device_enter_mode pwnDFU
fi if [[ -s ../saved/firmwares.json ]]; then
restore_futurerestore --use-pwndfu cp ../saved/firmwares.json /tmp
fi else
log "Downloading firmwares.json from ipsw.me"
download_file https://api.ipsw.me/v2.1/firmwares.json/condensed firmwares.json
cp firmwares.json ../saved /tmp
fi
restore_futurerestore --use-pwndfu
;;
esac
} }
ipsw_prepare() { ipsw_prepare() {
@ -4274,7 +4280,7 @@ device_ramdisk64() {
sshtar="../saved/iram.tar" sshtar="../saved/iram.tar"
if [[ ! -e $sshtar ]]; then if [[ ! -e $sshtar ]]; then
log "Downloading iram.tar from iarchive.app..." log "Downloading iram.tar from iarchive.app..."
curl -LO https://github.com/LukeZGD/Legacy-iOS-Kit/files/14952123/iram.zip download_file https://github.com/LukeZGD/Legacy-iOS-Kit/files/14952123/iram.zip iram.zip
unzip iram.zip unzip iram.zip
mv iram.tar $sshtar mv iram.tar $sshtar
fi fi
@ -4282,7 +4288,7 @@ device_ramdisk64() {
comps+=("Trustcache") comps+=("Trustcache")
if [[ ! -e $sshtar ]]; then if [[ ! -e $sshtar ]]; then
log "Downloading ssh.tar from SSHRD_Script..." log "Downloading ssh.tar from SSHRD_Script..."
curl -LO https://github.com/LukeZGD/sshtars/raw/cbaf9f826ca994452beb9e99a3a4ffb496f918fb/ssh.tar.gz download_file https://github.com/LukeZGD/sshtars/raw/cbaf9f826ca994452beb9e99a3a4ffb496f918fb/ssh.tar.gz ssh.tar.gz
mv ssh.tar.gz $sshtar.gz mv ssh.tar.gz $sshtar.gz
gzip -d $sshtar.gz gzip -d $sshtar.gz
fi fi
@ -4912,9 +4918,9 @@ menu_ramdisk() {
cp ../saved/TrollStore.tar ../saved/PersistenceHelper_Embedded . cp ../saved/TrollStore.tar ../saved/PersistenceHelper_Embedded .
else else
rm ../saved/TrollStore.tar ../saved/PersistenceHelper_Embedded 2>/dev/null rm ../saved/TrollStore.tar ../saved/PersistenceHelper_Embedded 2>/dev/null
log "Downloading latest TrollStore" log "Downloading files for latest TrollStore"
curl -LO $(echo "$troll" | $jq -r ".assets[] | select(.name|test(\"PersistenceHelper_Embedded\")) | .browser_download_url") download_file $(echo "$troll" | $jq -r ".assets[] | select(.name|test(\"PersistenceHelper_Embedded\")) | .browser_download_url") PersistenceHelper_Embedded
curl -LO $(echo "$troll" | $jq -r ".assets[] | select(.name|test(\"TrollStore.tar\")) | .browser_download_url") download_file $(echo "$troll" | $jq -r ".assets[] | select(.name|test(\"TrollStore.tar\")) | .browser_download_url") TrollStore.tar
cp TrollStore.tar PersistenceHelper_Embedded ../saved cp TrollStore.tar PersistenceHelper_Embedded ../saved
echo "$latest" > ../saved/TrollStore_version echo "$latest" > ../saved/TrollStore_version
fi fi
@ -5133,7 +5139,7 @@ menu_main() {
if [[ $device_mode == "Normal" ]]; then if [[ $device_mode == "Normal" ]]; then
if [[ $platform == "linux" ]]; then if [[ $platform == "linux" ]]; then
case $device_vers in case $device_vers in
9* | 1* ) menu_items+=("Sideload IPA");; [89]* | 1* ) menu_items+=("Sideload IPA");;
esac esac
fi fi
menu_items+=("Install IPA (AppSync)") menu_items+=("Install IPA (AppSync)")
@ -5169,13 +5175,17 @@ menu_ipa() {
print "* Sideload IPA is for iOS 9 and newer." print "* Sideload IPA is for iOS 9 and newer."
print "* Sideloading will require an Apple ID." print "* Sideloading will require an Apple ID."
print "* Your Apple ID and password will only be sent to Apple servers." print "* Your Apple ID and password will only be sent to Apple servers."
print "* There is also the option to use Dadoum Sideloader: https://github.com/Dadoum/Sideloader"
fi fi
echo echo
if [[ -n $ipa_path ]]; then if [[ -n $ipa_path ]]; then
print "* Selected IPA: $ipa_path" print "* Selected IPA: $ipa_path"
menu_items+=("Install IPA") menu_items+=("Install IPA")
else elif [[ $1 == "Install"* ]]; then
print "* Select IPA files to install (multiple selection)" print "* Select IPA files to install (multiple selection)"
else
print "* Select IPA file to install (or select Use Dadoum Sideloader)"
menu_items+=("Use Dadoum Sideloader")
fi fi
menu_items+=("Go Back") menu_items+=("Go Back")
echo echo
@ -5194,6 +5204,33 @@ menu_ipa() {
mode="altserver_linux" mode="altserver_linux"
fi fi
;; ;;
"Use Dadoum Sideloader" )
arch="$platform_arch"
case $arch in
"armhf" )
warn "Dadoum Sideloader does not support armhf/armv7. arm64 or x86_64 only."
pause
continue
;;
"arm64" ) arch="aarch64";;
esac
local sideloader="sideloader-gtk-linux-$arch"
log "Checking for latest Sideloader"
local troll=$(curl https://api.github.com/repos/Dadoum/Sideloader/releases/latest)
local latest="$(echo "$troll" | $jq -r ".tag_name")"
local current="$(cat ../saved/Sideloader_version)"
if [[ $current != "$latest" ]]; then
rm ../saved/$sideloader
fi
if [[ ! -e ../saved/$sideloader ]]; then
download_file https://github.com/Dadoum/Sideloader/releases/download/1.0-pre3/$sideloader.zip $sideloader.zip
unzip -o -j $sideloader.zip $sideloader -d ../saved
fi
echo "$latest" > ../saved/Sideloader_version
log "Launching Dadoum Sideloader"
chmod +x ../saved/$sideloader
../saved/$sideloader
;;
"Go Back" ) back=1;; "Go Back" ) back=1;;
esac esac
done done
@ -6729,13 +6766,11 @@ device_altserver_linux() {
anisette+="_$arch" anisette+="_$arch"
fi fi
if [[ ! -e $altserver ]]; then if [[ ! -e $altserver ]]; then
log "Downloading AltServer-Linux..." download_file https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-$arch AltServer-$arch
curl -LO https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-$arch
mv AltServer-$arch $altserver mv AltServer-$arch $altserver
fi fi
if [[ ! -e $anisette ]]; then if [[ ! -e $anisette ]]; then
log "Downloading Anisette server..." download_file https://github.com/Dadoum/Provision/releases/download/2.2.0/anisette-server-$arch anisette-server-$arch
curl -LO https://github.com/Dadoum/Provision/releases/download/2.2.0/anisette-server-$arch
mv anisette-server-$arch $anisette mv anisette-server-$arch $anisette
fi fi
chmod +x $altserver $anisette chmod +x $altserver $anisette