Add dump bb/actrec as option in sshrd, and other stuff

This commit is contained in:
LukeZGD 2024-02-17 10:11:10 +08:00
parent b0f5ada3a7
commit 853a698d83

View File

@ -4443,21 +4443,9 @@ device_ramdisk() {
local vers local vers
local build local build
local untether local untether
log "Mounting root filesystem" device_ramdisk_iosvers
$ssh -p $ssh_port root@127.0.0.1 "mount.sh root" vers=$device_vers
sleep 1 build=$device_build
log "Getting iOS version"
$scp -P $ssh_port root@127.0.0.1:/mnt1/System/Library/CoreServices/SystemVersion.plist .
if [[ $platform == "macos" ]]; then
rm -f BuildVer Version
plutil -extract 'ProductVersion' xml1 SystemVersion.plist -o Version
vers=$(cat Version | sed -ne '/<string>/,/<\/string>/p' | sed -e "s/<string>//" | sed "s/<\/string>//" | sed '2d')
plutil -extract 'ProductBuildVersion' xml1 SystemVersion.plist -o BuildVer
build=$(cat BuildVer | sed -ne '/<string>/,/<\/string>/p' | sed -e "s/<string>//" | sed "s/<\/string>//" | sed '2d')
else
vers=$(cat SystemVersion.plist | grep -i ProductVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+")
build=$(cat SystemVersion.plist | grep -i ProductBuildVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+")
fi
if [[ $1 == "getversion" && -n $vers ]]; then if [[ $1 == "getversion" && -n $vers ]]; then
log "Retrieved the current iOS version, rebooting device" log "Retrieved the current iOS version, rebooting device"
print "* iOS Version: $vers ($build)" print "* iOS Version: $vers ($build)"
@ -4591,6 +4579,26 @@ device_ramdisk() {
menu_ramdisk menu_ramdisk
} }
device_ramdisk_iosvers() {
device_vers=
device_build=
log "Mounting root filesystem"
$ssh -p $ssh_port root@127.0.0.1 "mount.sh root"
sleep 1
log "Getting iOS version"
$scp -P $ssh_port root@127.0.0.1:/mnt1/System/Library/CoreServices/SystemVersion.plist .
if [[ $platform == "macos" ]]; then
rm -f BuildVer Version
plutil -extract 'ProductVersion' xml1 SystemVersion.plist -o Version
device_vers=$(cat Version | sed -ne '/<string>/,/<\/string>/p' | sed -e "s/<string>//" | sed "s/<\/string>//" | sed '2d')
plutil -extract 'ProductBuildVersion' xml1 SystemVersion.plist -o BuildVer
device_build=$(cat BuildVer | sed -ne '/<string>/,/<\/string>/p' | sed -e "s/<string>//" | sed "s/<\/string>//" | sed '2d')
else
device_vers=$(cat SystemVersion.plist | grep -i ProductVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+")
device_build=$(cat SystemVersion.plist | grep -i ProductBuildVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+")
fi
}
menu_ramdisk() { menu_ramdisk() {
local loop local loop
local mode local mode
@ -4599,18 +4607,25 @@ menu_ramdisk() {
if (( device_proc >= 7 )); then if (( device_proc >= 7 )); then
menu_items+=("Dump Blobs") menu_items+=("Dump Blobs")
reboot="/sbin/reboot" reboot="/sbin/reboot"
else
menu_items+=("Get iOS Version" "Dump Baseband/Activation")
fi fi
if [[ $1 == "18C66" ]]; then if [[ $1 == "18C66" ]]; then
menu_items+=("Install TrollStore") menu_items+=("Install TrollStore")
fi fi
menu_items+=("Reboot Device" "Exit") menu_items+=("Reboot Device" "Exit")
print "* For accessing data, note the following:"
print "* Host: sftp://127.0.0.1 | User: root | Password: alpine | Port: $ssh_port"
echo
print "* Other Useful SSH Ramdisk commands:"
print "* Clear NVRAM with this command:" print "* Clear NVRAM with this command:"
print " nvram -c" print " nvram -c"
print "* Erase All Content and Settings with this command (iOS 9+ only):" print "* Erase All Content and Settings with this command (iOS 9+ only):"
print " nvram oblit-inprogress=5" print " nvram oblit-inprogress=5"
print "* To reboot, use this command:" print "* To reboot, use this command:"
print " $reboot" print " $reboot"
echo
while [[ $loop != 1 ]]; do while [[ $loop != 1 ]]; do
print "* SSH Ramdisk Menu" print "* SSH Ramdisk Menu"
@ -4624,6 +4639,8 @@ menu_ramdisk() {
"Connect to SSH" ) mode="ssh";; "Connect to SSH" ) mode="ssh";;
"Reboot Device" ) mode="reboot";; "Reboot Device" ) mode="reboot";;
"Dump Blobs" ) mode="dump-blobs";; "Dump Blobs" ) mode="dump-blobs";;
"Get iOS Version" ) mode="iosvers";;
"Dump Baseband/Activation" ) mode="dump-bbactrec";;
"Install TrollStore" ) mode="trollstore";; "Install TrollStore" ) mode="trollstore";;
"Exit" ) mode="exit";; "Exit" ) mode="exit";;
esac esac
@ -4640,8 +4657,17 @@ menu_ramdisk() {
$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"
pause
;; ;;
"iosvers" )
device_ramdisk_iosvers
if [[ -n $device_vers ]]; then
log "Retrieved the current iOS version"
print "* iOS Version: $device_vers ($device_build)"
else
warn "Something wrong happened. Failed to get iOS version."
fi
;;
"dump-bbactrec" ) device_dumprd;;
"trollstore" ) "trollstore" )
print "* Make sure that your device is on iOS 14 or 15 before continuing." print "* Make sure that your device is on iOS 14 or 15 before continuing."
print "* If your device is on iOS 13 or below, TrollStore will NOT work." print "* If your device is on iOS 13 or below, TrollStore will NOT work."
@ -5633,10 +5659,6 @@ menu_ipsw_browse() {
print "* You need iOS $base_vers IPSW and SHSH blobs for this device to use powdersn0w." print "* You need iOS $base_vers IPSW and SHSH blobs for this device to use powdersn0w."
pause pause
return return
elif [[ $device_target_build == "$device_base_build" ]]; then
log "The base version and the target version must not be the same."
pause
return
fi fi
ipsw_verify "$newpath" "$device_base_build" ipsw_verify "$newpath" "$device_base_build"
ipsw_base_path="$newpath" ipsw_base_path="$newpath"
@ -5930,33 +5952,45 @@ device_dump() {
log "This operation requires an SSH ramdisk, proceeding" log "This operation requires an SSH ramdisk, proceeding"
print "* I recommend dumping baseband/activation on Normal mode instead of Recovery/DFU mode if possible" print "* I recommend dumping baseband/activation on Normal mode instead of Recovery/DFU mode if possible"
device_enter_ramdisk $arg device_enter_ramdisk $arg
dump="../saved/$device_type" device_dumprd
log "Mounting filesystems" $ssh -p $ssh_port root@127.0.0.1 "nvram auto-boot=0; reboot_bak"
$ssh -p $ssh_port root@127.0.0.1 "mount.sh pv" log "Done, device should reboot to recovery mode now"
sleep 1 if [[ $mode != "baseband" && $mode != "actrec" ]]; then
log "Getting iOS version" log "Put your device back in kDFU/pwnDFU mode to proceed"
$scp -P $ssh_port root@127.0.0.1:/mnt1/System/Library/CoreServices/SystemVersion.plist . device_find_mode Recovery
if [[ $platform == "macos" ]]; then device_enter_mode DFU
rm -f BuildVer Version device_enter_mode pwnDFU
plutil -extract 'ProductVersion' xml1 SystemVersion.plist -o Version
vers=$(cat Version | sed -ne '/<string>/,/<\/string>/p' | sed -e "s/<string>//" | sed "s/<\/string>//" | sed '2d')
plutil -extract 'ProductBuildVersion' xml1 SystemVersion.plist -o BuildVer
build=$(cat BuildVer | sed -ne '/<string>/,/<\/string>/p' | sed -e "s/<string>//" | sed "s/<\/string>//" | sed '2d')
else else
vers=$(cat SystemVersion.plist | grep -i ProductVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+") log "Just exit recovery mode if needed: Other Utilities -> Exit Recovery Mode"
build=$(cat SystemVersion.plist | grep -i ProductBuildVersion -A 1 | grep -oPm1 "(?<=<string>)[^<]+")
fi fi
fi
kill $iproxy_pid
if [[ ! -e $dump ]]; then
error "Failed to dump $arg from device. Please run the script again"
fi
log "Dumping $arg done: $dump"
}
device_dumprd() {
local dump="../saved/$device_type"
local vers
device_ramdisk_iosvers
vers=$device_vers
if [[ -z $vers ]]; then if [[ -z $vers ]]; then
warn "Something wrong happened. Failed to get iOS version." warn "Something wrong happened. Failed to get iOS version."
print "* Please reboot the device into normal operating mode, then perform a clean \"slide to power off\", then try again." print "* Please reboot the device into normal operating mode, then perform a clean \"slide to power off\", then try again."
$ssh -p $ssh_port root@127.0.0.1 "reboot_bak" $ssh -p $ssh_port root@127.0.0.1 "reboot_bak"
return return
fi fi
log "Mounting filesystems"
$ssh -p $ssh_port root@127.0.0.1 "mount.sh pv"
sleep 1
local tmp="/mnt1/private/var/tmp" local tmp="/mnt1/private/var/tmp"
log "Dumping both baseband and activation tars" log "Dumping both baseband and activation tars"
log "Creating baseband.tar" log "Creating baseband.tar"
$ssh -p $ssh_port root@127.0.0.1 "cd /mnt1; tar -cvf $tmp/baseband.tar usr/local/standalone" $ssh -p $ssh_port root@127.0.0.1 "cd /mnt1; tar -cvf $tmp/baseband.tar usr/local/standalone"
dmp2="private/var/root/Library/Lockdown" local dmps
local dmp2="private/var/root/Library/Lockdown"
case $vers in case $vers in
[34567]* ) dmps="$dmp2";; [34567]* ) dmps="$dmp2";;
8* ) dmps="private/var/mobile/Library/mad";; 8* ) dmps="private/var/mobile/Library/mad";;
@ -5994,22 +6028,7 @@ device_dump() {
else else
cp activation.tar $dump cp activation.tar $dump
fi fi
$ssh -p $ssh_port root@127.0.0.1 "rm -f $tmp/*.tar; nvram auto-boot=0; reboot_bak" $ssh -p $ssh_port root@127.0.0.1 "rm -f $tmp/*.tar"
log "Done, device should reboot to recovery mode now"
if [[ $mode != "baseband" && $mode != "actrec" ]]; then
log "Put your device back in kDFU/pwnDFU mode to proceed"
device_find_mode Recovery
device_enter_mode DFU
device_enter_mode pwnDFU
else
log "Just exit recovery mode if needed: Other Utilities -> Exit Recovery Mode"
fi
fi
kill $iproxy_pid
if [[ ! -e $dump ]]; then
error "Failed to dump $arg from device. Please run the script again"
fi
log "Dumping $arg done: $dump"
} }
device_activate() { device_activate() {