Update restore.sh

This commit is contained in:
LukeZGD 2023-01-13 23:02:51 +08:00
parent 8b1fbf1cba
commit ae2bfe3bb5

View File

@ -392,6 +392,7 @@ device_get_info() {
"Normal" ) "Normal" )
device_type=$($ideviceinfo -s -k ProductType) device_type=$($ideviceinfo -s -k ProductType)
[[ -z $device_type ]] && device_type=$($ideviceinfo -k ProductType)
device_ecid=$($ideviceinfo -s -k UniqueChipID) device_ecid=$($ideviceinfo -s -k UniqueChipID)
device_vers=$($ideviceinfo -s -k ProductVersion) device_vers=$($ideviceinfo -s -k ProductVersion)
device_udid=$($ideviceinfo -s -k UniqueDeviceID) device_udid=$($ideviceinfo -s -k UniqueDeviceID)
@ -794,22 +795,31 @@ device_enter_mode() {
device_ipwndfu() { device_ipwndfu() {
local tool_pwned=0 local tool_pwned=0
local python2=$(which python2 2>/dev/null)
print "* Make sure to have python2 installed to use ipwndfu" print "* Make sure to have python2 installed to use ipwndfu"
print "* You may install python2 from pyenv: pyenv install 2.7.18"
if [[ -e ~/.pyenv/shims/python2 ]]; then
print "* python2 from pyenv detected"
python2=~/.pyenv/shims/python2
fi
device_enter_mode DFU device_enter_mode DFU
if [[ ! -d ../resources/ipwndfu ]]; then if [[ ! -d ../resources/ipwndfu ]]; then
download_file https://github.com/LukeZGD/ipwndfu/archive/6e67c9e28a5f7f63f179dea670f7f858712350a0.zip ipwndfu.zip 61333249eb58faebbb380c4709384034ce0e019a download_file https://github.com/LukeZGD/ipwndfu/archive/6e67c9e28a5f7f63f179dea670f7f858712350a0.zip ipwndfu.zip 61333249eb58faebbb380c4709384034ce0e019a
unzip -q ipwndfu.zip -d ../resources unzip -q ipwndfu.zip -d ../resources
mv ../resources/ipwndfu*/ ../resources/ipwndfu/ mv ../resources/ipwndfu*/ ../resources/ipwndfu/
fi fi
if [[ $1 == "send-ibss" ]]; then if [[ $1 == "send-ibss" ]]; then
patch_ibss patch_ibss
cp pwnediBSS ../resources/ipwndfu/ 2>/dev/null cp pwnediBSS ../resources/ipwndfu/ 2>/dev/null
fi fi
pushd ../resources/ipwndfu/ pushd ../resources/ipwndfu/
case $1 in case $1 in
"send_ibss" ) "send_ibss" )
log "Sending iBSS..." log "Sending iBSS..."
$(which python2) ipwndfu -f pwnediBSS $python2 ipwndfu -l pwnediBSS
tool_pwned=$? tool_pwned=$?
rm pwnediBSS rm pwnediBSS
if [[ $tool_pwned != 0 ]]; then if [[ $tool_pwned != 0 ]]; then
@ -820,7 +830,7 @@ device_ipwndfu() {
"pwn" ) "pwn" )
log "Placing device to pwnDFU Mode using ipwndfu" log "Placing device to pwnDFU Mode using ipwndfu"
$(which python2) ipwndfu -p $python2 ipwndfu -p
tool_pwned=$? tool_pwned=$?
if [[ $tool_pwned != 0 ]]; then if [[ $tool_pwned != 0 ]]; then
error "Failed to enter pwnDFU mode. Please run the script again." \ error "Failed to enter pwnDFU mode. Please run the script again." \
@ -830,7 +840,7 @@ device_ipwndfu() {
"rmsigchks" ) "rmsigchks" )
log "Running rmsigchks..." log "Running rmsigchks..."
$(which python2) rmsigchks.py $python2 rmsigchks.py
;; ;;
esac esac
popd popd
@ -1035,6 +1045,8 @@ patch_ibss() {
fi fi
log "Patching iBSS..." log "Patching iBSS..."
$bspatch iBSS pwnediBSS "../resources/patch/$targetfile.patch" $bspatch iBSS pwnediBSS "../resources/patch/$targetfile.patch"
cp pwnediBSS ../saved/$device_type
log "Pwned iBSS saved at: saved/$device_type/pwnediBSS"
} }
ipsw_path_set() { ipsw_path_set() {
@ -1288,13 +1300,13 @@ shsh_save() {
return return
fi fi
log "Saving iOS $version blobs with tsschecker..."
ExtraArgs="-d $device_type -i $version -e $device_ecid -m $buildmanifest -o -s -B ${device_model}ap -b " ExtraArgs="-d $device_type -i $version -e $device_ecid -m $buildmanifest -o -s -B ${device_model}ap -b "
if [[ -n $apnonce ]]; then if [[ -n $apnonce ]]; then
ExtraArgs+="--apnonce $apnonce" ExtraArgs+="--apnonce $apnonce"
else else
ExtraArgs+="-g 0x1111111111111111" ExtraArgs+="-g 0x1111111111111111"
fi fi
log "Running tsschecker with command: $dir/tsschecker $ExtraArgs"
"$dir/tsschecker" $ExtraArgs "$dir/tsschecker" $ExtraArgs
shsh_path="$(ls $shsh_check)" shsh_path="$(ls $shsh_check)"
if [[ -n "$shsh_path" ]]; then if [[ -n "$shsh_path" ]]; then
@ -1374,7 +1386,11 @@ ipsw_prepare_1033() {
mv $iBECb.im4p $iBECb.orig mv $iBECb.im4p $iBECb.orig
$bspatch $iBSSb.orig $iBSSb.im4p ../resources/patch/$iBSSb.patch $bspatch $iBSSb.orig $iBSSb.im4p ../resources/patch/$iBSSb.patch
$bspatch $iBECb.orig $iBECb.im4p ../resources/patch/$iBECb.patch $bspatch $iBECb.orig $iBECb.im4p ../resources/patch/$iBECb.patch
cp $iBSSb.im4p $iBECb.im4p ../saved/$device_type
else
cp $iBSS.im4p $iBEC.im4p ../saved/$device_type
fi fi
log "Pwned iBSS and iBEC saved at: saved/$device_type"
} }
ipsw_prepare_jailbreak() { ipsw_prepare_jailbreak() {
@ -1740,7 +1756,7 @@ restore_download_bbsep() {
mkdir tmp mkdir tmp
# BuildManifest # BuildManifest
if [[ ! -e ../saved/$device_type/$build_id.plist ]]; then if [[ ! -e ../saved/$device_type/$build_id.plist ]]; then
if [[ $device_proc == 7 && $build_id == "14G60" ]]; then if [[ $device_proc == 7 && $device_target_vers == "10"* ]]; then
cp ../resources/manifest/BuildManifest_${device_type}_10.3.3.plist $build_id.plist cp ../resources/manifest/BuildManifest_${device_type}_10.3.3.plist $build_id.plist
else else
log "Downloading $build_id BuildManifest" log "Downloading $build_id BuildManifest"