mirror of
https://github.com/LukeZGD/Legacy-iOS-Kit.git
synced 2025-01-26 06:55:28 +01:00
Save raw dump for onboard on fail, add option to convert them
this is untested, but should work just fine i think
This commit is contained in:
parent
f91195b276
commit
5cc36784a1
101
restore.sh
101
restore.sh
@ -4685,7 +4685,7 @@ menu_ramdisk() {
|
|||||||
"reboot" ) $ssh -p $ssh_port root@127.0.0.1 "$reboot"; loop=1;;
|
"reboot" ) $ssh -p $ssh_port root@127.0.0.1 "$reboot"; loop=1;;
|
||||||
"exit" ) loop=1;;
|
"exit" ) loop=1;;
|
||||||
"dump-blobs" )
|
"dump-blobs" )
|
||||||
local shsh="../saved/shsh/$device_ecid-$device_type-$(date +%Y-%m-%d-%H%M).shsh2"
|
local shsh="../saved/shsh/$device_ecid-$device_type-$(date +%Y-%m-%d-%H%M).shsh"
|
||||||
$ssh -p $ssh_port root@127.0.0.1 "cat /dev/rdisk1" | dd of=dump.raw bs=256 count=$((0x4000))
|
$ssh -p $ssh_port root@127.0.0.1 "cat /dev/rdisk1" | dd of=dump.raw bs=256 count=$((0x4000))
|
||||||
"$dir/img4tool" --convert -s $shsh dump.raw
|
"$dir/img4tool" --convert -s $shsh dump.raw
|
||||||
log "Onboard blobs should be dumped to $shsh"
|
log "Onboard blobs should be dumped to $shsh"
|
||||||
@ -4766,10 +4766,17 @@ shsh_save_onboard64() {
|
|||||||
print "* The default root password is: alpine"
|
print "* The default root password is: alpine"
|
||||||
device_iproxy
|
device_iproxy
|
||||||
device_sshpass
|
device_sshpass
|
||||||
local shsh="../saved/shsh/$device_ecid-$device_type-$device_vers-$device_build.shsh2"
|
local shsh="../saved/shsh/$device_ecid-$device_type-$device_vers-$device_build.shsh"
|
||||||
$ssh -p $ssh_port root@127.0.0.1 "cat /dev/disk1" | dd of=dump.raw bs=256 count=$((0x4000))
|
$ssh -p $ssh_port root@127.0.0.1 "cat /dev/disk1" | dd of=dump.raw bs=256 count=$((0x4000))
|
||||||
"$dir/img4tool" --convert -s $shsh dump.raw
|
"$dir/img4tool" --convert -s $shsh dump.raw
|
||||||
if [[ ! -s $shsh ]]; then
|
if [[ ! -s $shsh ]]; then
|
||||||
|
warn "Failed to convert raw dump to SHSH."
|
||||||
|
if [[ -s dump.raw ]]; then
|
||||||
|
mv dump.raw ../saved/rawdump_$device_ecid-$device_type-$device_target_vers.raw
|
||||||
|
log "Raw dump saved at: ../saved/rawdump_$device_ecid-$device_type-$device_target_vers-$(date +%Y-%m-%d-%H%M).raw"
|
||||||
|
warn "This raw dump is not usable for restoring, you need to convert it first."
|
||||||
|
print "* If unable to be converted, this dump is likely not usable for restoring."
|
||||||
|
fi
|
||||||
error "Saving onboard SHSH blobs failed."
|
error "Saving onboard SHSH blobs failed."
|
||||||
fi
|
fi
|
||||||
log "Successfully saved $device_vers blobs: $shsh"
|
log "Successfully saved $device_vers blobs: $shsh"
|
||||||
@ -4796,18 +4803,43 @@ shsh_save_onboard() {
|
|||||||
device_find_mode Recovery
|
device_find_mode Recovery
|
||||||
log "Dumping blobs now"
|
log "Dumping blobs now"
|
||||||
(echo -e "/send ../resources/payload\ngo blobs\n/exit") | $irecovery2 -s
|
(echo -e "/send ../resources/payload\ngo blobs\n/exit") | $irecovery2 -s
|
||||||
$irecovery2 -g myblob.dump
|
$irecovery2 -g dump.raw
|
||||||
$irecovery -n
|
$irecovery -n
|
||||||
"$dir/ticket" myblob.dump myblob.shsh "$ipsw_path.ipsw" -z
|
"$dir/ticket" dump.raw dump.shsh "$ipsw_path.ipsw" -z
|
||||||
"$dir/validate" myblob.shsh "$ipsw_path.ipsw" -z
|
"$dir/validate" dump.shsh "$ipsw_path.ipsw" -z
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
warn "Saved SHSH blobs might be invalid. Did you select the correct IPSW?"
|
warn "Saved SHSH blobs might be invalid. Did you select the correct IPSW?"
|
||||||
|
if [[ -s dump.raw ]]; then
|
||||||
|
mv dump.raw ../saved/rawdump_$device_ecid-$device_type-$device_target_vers.raw
|
||||||
|
log "Raw dump saved at: ../saved/rawdump_$device_ecid-$device_type-$device_target_vers-$(date +%Y-%m-%d-%H%M).raw"
|
||||||
|
warn "This raw dump is not usable for restoring, you need to convert it first."
|
||||||
|
print "* If unable to be converted, this dump is likely not usable for restoring."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ ! -s myblob.shsh ]]; then
|
if [[ ! -s dump.shsh ]]; then
|
||||||
error "Saving onboard SHSH blobs failed."
|
error "Saving onboard SHSH blobs failed."
|
||||||
fi
|
fi
|
||||||
local shsh="../saved/shsh/$device_ecid-$device_type-$device_target_vers-$device_target_build.shsh"
|
local shsh="../saved/shsh/$device_ecid-$device_type-$device_target_vers-$device_target_build.shsh"
|
||||||
mv myblob.shsh $shsh
|
mv dump.shsh $shsh
|
||||||
|
log "Successfully saved $device_target_vers blobs: $shsh"
|
||||||
|
}
|
||||||
|
|
||||||
|
shsh_convert_onboard() {
|
||||||
|
cp "$shsh_path" dump.raw
|
||||||
|
if (( device_proc < 7 )); then
|
||||||
|
"$dir/ticket" dump.raw dump.shsh "$ipsw_path.ipsw" -z
|
||||||
|
"$dir/validate" dump.shsh "$ipsw_path.ipsw" -z
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
warn "Saved SHSH blobs might be invalid. Did you select the correct IPSW?"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
"$dir/img4tool" --convert -s dump.shsh dump.raw
|
||||||
|
fi
|
||||||
|
if [[ ! -s dump.shsh ]]; then
|
||||||
|
error "Converting onboard SHSH blobs failed."
|
||||||
|
fi
|
||||||
|
local shsh="../saved/shsh/converted-$device_ecid-$device_type-$(date +%Y-%m-%d-%H%M).shsh"
|
||||||
|
mv dump.shsh $shsh
|
||||||
log "Successfully saved $device_target_vers blobs: $shsh"
|
log "Successfully saved $device_target_vers blobs: $shsh"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5005,7 +5037,7 @@ menu_shsh() {
|
|||||||
if (( device_proc < 7 )); then
|
if (( device_proc < 7 )); then
|
||||||
menu_items+=("Cydia Blobs")
|
menu_items+=("Cydia Blobs")
|
||||||
fi
|
fi
|
||||||
menu_items+=("Go Back")
|
menu_items+=("Convert Raw Dump" "Go Back")
|
||||||
menu_print_info
|
menu_print_info
|
||||||
if [[ $device_mode != "none" && $device_proc == 4 ]]; then
|
if [[ $device_mode != "none" && $device_proc == 4 ]]; then
|
||||||
print "* Dumping onboard blobs might not work for this device, proceed with caution"
|
print "* Dumping onboard blobs might not work for this device, proceed with caution"
|
||||||
@ -5036,6 +5068,7 @@ menu_shsh() {
|
|||||||
"iOS"* ) mode="save-ota-blobs";;
|
"iOS"* ) mode="save-ota-blobs";;
|
||||||
"Onboard Blobs" ) menu_shsh_onboard;;
|
"Onboard Blobs" ) menu_shsh_onboard;;
|
||||||
"Cydia Blobs" ) mode="save-cydia-blobs";;
|
"Cydia Blobs" ) mode="save-cydia-blobs";;
|
||||||
|
"Convert Raw Dump" ) menu_shsh_convert;;
|
||||||
"Go Back" ) back=1;;
|
"Go Back" ) back=1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -5084,6 +5117,47 @@ menu_shsh_onboard() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu_shsh_convert() {
|
||||||
|
local menu_items
|
||||||
|
local selected
|
||||||
|
local back
|
||||||
|
|
||||||
|
ipsw_path=
|
||||||
|
while [[ -z "$mode" && -z "$back" ]]; do
|
||||||
|
if (( device_proc < 7 )); then
|
||||||
|
menu_items=("Select IPSW")
|
||||||
|
else
|
||||||
|
menu_items=("Select Raw Dump")
|
||||||
|
fi
|
||||||
|
menu_print_info
|
||||||
|
if [[ -n $ipsw_path ]]; then
|
||||||
|
print "* Selected IPSW: $ipsw_path.ipsw"
|
||||||
|
print "* IPSW Version: $device_target_vers-$device_target_build"
|
||||||
|
menu_items+=("Select Raw Dump")
|
||||||
|
else
|
||||||
|
print "* Select IPSW of your current iOS version to continue"
|
||||||
|
fi
|
||||||
|
if [[ -n $shsh_path ]]; then
|
||||||
|
print "* Selected dump: $shsh_path"
|
||||||
|
menu_items+=("Convert Raw Dump")
|
||||||
|
fi
|
||||||
|
menu_items+=("Go Back")
|
||||||
|
echo
|
||||||
|
print " > Main Menu > Save SHSH Blobs > Convert Raw Dump"
|
||||||
|
input "Select an option:"
|
||||||
|
select opt in "${menu_items[@]}"; do
|
||||||
|
selected="$opt"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
case $selected in
|
||||||
|
"Select IPSW" ) menu_ipsw_browse;;
|
||||||
|
"Select Raw Dump" ) menu_shshdump_browse;;
|
||||||
|
"Convert Raw Dump" ) mode="convert-onboard-blobs";;
|
||||||
|
"Go Back" ) back=1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
menu_restore() {
|
menu_restore() {
|
||||||
local menu_items
|
local menu_items
|
||||||
local selected
|
local selected
|
||||||
@ -5764,6 +5838,16 @@ menu_shsh_browse() {
|
|||||||
shsh_path="$newpath"
|
shsh_path="$newpath"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu_shshdump_browse() {
|
||||||
|
local newpath
|
||||||
|
input "Select your raw dump file in the file selection window."
|
||||||
|
newpath="$($zenity --file-selection --file-filter='Raw Dump | *.raw' --title="Select Raw Dump")"
|
||||||
|
[[ ! -s "$newpath" ]] && read -p "$(input "Enter path to raw dump file (or press Ctrl+C to cancel): ")" newpath
|
||||||
|
[[ ! -s "$newpath" ]] && return
|
||||||
|
log "Selected raw dump file: $newpath"
|
||||||
|
shsh_path="$newpath"
|
||||||
|
}
|
||||||
|
|
||||||
menu_other() {
|
menu_other() {
|
||||||
local menu_items
|
local menu_items
|
||||||
local selected
|
local selected
|
||||||
@ -6512,6 +6596,7 @@ main() {
|
|||||||
"altserver_linux" ) device_altserver_linux;;
|
"altserver_linux" ) device_altserver_linux;;
|
||||||
"hacktivate" ) device_hacktivate;;
|
"hacktivate" ) device_hacktivate;;
|
||||||
"restore-latest" ) restore_latest64;;
|
"restore-latest" ) restore_latest64;;
|
||||||
|
"convert-onboard-blobs" ) shsh_convert_onboard;;
|
||||||
* ) :;;
|
* ) :;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user