Skip to content

Commit 2f03b8e

Browse files
committed
Add baseband signing check option, messages and update regarding unsigned baseband issue #1097
1 parent 0992aee commit 2f03b8e

1 file changed

Lines changed: 44 additions & 22 deletions

File tree

restore.sh

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,10 @@ device_manufacturing() {
11351135
case $device_type in
11361136
iPhone4,1 | iPhone5,2 | iPad2,7 | iPad3,[26] ) device_9900candidate=1;;
11371137
esac
1138+
case $device_type in
1139+
iPhone4,1 | iPhone5,* | iPad2,[67] | iPad3,[23] ) device_unsignedbb=1;;
1140+
iPad2,3 | iPad3,[23] ) device_unsignedbb=2;;
1141+
esac
11381142
if [[ $device_type == "DFU" ]]; then
11391143
print "* Cannot check for manufacturing date in DFU mode"
11401144
return
@@ -2833,7 +2837,7 @@ ipsw_preference_set() {
28332837
ipsw_gasgauge_patch=1
28342838
fi
28352839
case $device_type in
2836-
iPad2,[367] | iPhone5,[1234] ) ipsw_gasgauge_patch=1;;
2840+
iPad2,[367] | iPad3,[23] | iPhone4,1 | iPhone5,[1234] ) ipsw_gasgauge_patch=1;;
28372841
esac
28382842
if [[ $device_target_tethered == 1 && $ipsw_gasgauge_patch == 1 &&
28392843
$device_proc == 6 && $target_vers_maj == 10 ]]; then
@@ -2875,7 +2879,7 @@ ipsw_preference_set() {
28752879
# ipsw_nskip being 1 means that it will always create/use a custom ipsw.
28762880
# useful for disabling baseband update, or in the case of macos arm64, not having to use futurerestore for 32-bit.
28772881
case $device_type in
2878-
iPad[23],[23] | iPad2,[67] | iPhone5,[1234] | "$device_disable_bbupdate" ) ipsw_nskip=1;;
2882+
iPad[23],[23] | iPad2,[67] | iPhone4,1 | iPhone5,[1234] | "$device_disable_bbupdate" ) ipsw_nskip=1;;
28792883
esac
28802884
if [[ $ipsw_gasgauge_patch != 1 && $ipsw_jailbreak != 1 && $device_target_vers == "$device_latest_vers" ]]; then
28812885
ipsw_nskip=
@@ -3047,12 +3051,13 @@ shsh_save() {
30473051
local shsh_check
30483052
local buildmanifest="../resources/manifest/BuildManifest_${device_type}_${version}.plist"
30493053
local ExtraArgs=
3054+
local bbcheck
30503055

3051-
if [[ $1 == "apnonce" ]]; then
3052-
apnonce=$2
3053-
elif [[ $1 == "version" ]]; then
3054-
version=$2
3055-
fi
3056+
case $1 in
3057+
"apnonce" ) apnonce=$2;;
3058+
"version" ) version=$2;;
3059+
"bbcheck" ) bbcheck=1;;
3060+
esac
30563061

30573062
if [[ $version == "$device_latest_vers" || $version == "4.1" ]]; then
30583063
if [[ $version != "4.1" ]]; then
@@ -3073,23 +3078,30 @@ shsh_save() {
30733078
fi
30743079
shsh_check=${device_ecid}_${device_type}_${device_model}ap_${version}-${build_id}_${apnonce}*.shsh*
30753080

3076-
if [[ $(ls ../saved/shsh/$shsh_check 2>/dev/null) && -z $apnonce ]]; then
3081+
if [[ $(ls ../saved/shsh/$shsh_check 2>/dev/null) && -z $apnonce && $bbcheck != 1 ]]; then
30773082
shsh_path="$(ls ../saved/shsh/$shsh_check)"
30783083
log "Found existing saved $version blobs: $shsh_path"
30793084
return
30803085
fi
30813086
rm -f *.shsh*
30823087

3083-
ExtraArgs="-d $device_type -i $version -e $device_ecid -m $buildmanifest -o -s -B ${device_model}ap -b "
3088+
ExtraArgs="-d $device_type -i $version -e $device_ecid -m $buildmanifest -o -s -B ${device_model}ap "
3089+
if [[ $bbcheck != 1 ]]; then
3090+
ExtraArgs+="-b "
3091+
fi
30843092
if [[ -n $apnonce ]]; then
30853093
ExtraArgs+="--apnonce $apnonce"
30863094
else
30873095
ExtraArgs+="-g 0x1111111111111111"
30883096
fi
30893097
log "Running tsschecker with command: $tsschecker $ExtraArgs"
30903098
$tsschecker $ExtraArgs
3099+
30913100
shsh_path="$(ls $shsh_check)"
3092-
if [[ -z "$shsh_path" ]]; then
3101+
if [[ -z "$shsh_path" && $bbcheck == 1 ]]; then
3102+
warn "Saving $version blobs failed."
3103+
return
3104+
elif [[ -z "$shsh_path" ]]; then
30933105
error "Saving $version blobs failed. Please run the script again"
30943106
fi
30953107
if [[ -z $apnonce ]]; then
@@ -4285,7 +4297,8 @@ ipsw_bbreplace() {
42854297
local sbl_latest
42864298
local loc_sub="Manifest:BasebandFirmware"
42874299
local ubid
4288-
if [[ $device_type == "iPad2,6" || $device_type == "iPad2,7" || $device_type == "iPhone5,"* ]] &&
4300+
if [[ $device_type == "iPad2,6" || $device_type == "iPad2,7" ||
4301+
$device_type == "iPhone4,1" || $device_type == "iPhone5,"* ]] &&
42894302
[[ $device_target_vers == "$device_latest_vers" ]]; then
42904303
:
42914304
elif [[ $device_use_bb == 0 || $device_target_vers == "$device_latest_vers" ||
@@ -8245,16 +8258,24 @@ menu_print_info() {
82458258
if [[ $device_proc != 1 ]] && (( device_proc < 7 )); then
82468259
case $device_proc in
82478260
[56] )
8248-
if [[ $device_imei == "9900"* ]]; then
8249-
warn "Your device's IMEI starts with 9900. These devices are affected by an activation issue."
8250-
elif [[ $device_9900candidate == 1 && $device_mode == "Normal" && -n $device_imei ]]; then
8251-
print "* Your device's IMEI does not start with 9900. Your device should be safe from the activation issue."
8252-
elif [[ $device_9900candidate == 1 && $device_mode != "Normal" ]]; then
8253-
warn "Your device is possibly affected by an activation issue. Please check your device's IMEI."
8254-
print "* If it starts with 9900, enable Activation Records stitching in Misc Utilities"
8255-
elif [[ $device_type == "iPad3,3" ]]; then
8256-
warn "Your device is an iPad3,3. These devices are affected by an activation issue."
8257-
[[ $device_unactivated != 2 ]] && print "* If you haven't already, dump activation by selecting Activation Records in Misc Utilities"
8261+
if [[ $device_unsignedbb == 1 ]]; then
8262+
warn "Latest baseband firmware is currently unsigned for your device. It is not recommended to restore until further notice."
8263+
print "* For more details about this issue, see issue #1097: https://github.com/LukeZGD/Legacy-iOS-Kit/issues/1097"
8264+
elif [[ $device_unsignedbb == 2 ]]; then
8265+
warn "Latest baseband firmware is currently unsigned for your device. All restores require kDFU/pwned DFU mode."
8266+
print "* For more details about this issue, see issue #1097: https://github.com/LukeZGD/Legacy-iOS-Kit/issues/1097"
8267+
else
8268+
if [[ $device_imei == "9900"* ]]; then
8269+
warn "Your device's IMEI starts with 9900. These devices are affected by an activation issue."
8270+
elif [[ $device_9900candidate == 1 && $device_mode == "Normal" && -n $device_imei ]]; then
8271+
print "* Your device's IMEI does not start with 9900. Your device should be safe from the activation issue."
8272+
elif [[ $device_9900candidate == 1 && $device_mode != "Normal" ]]; then
8273+
warn "Your device is possibly affected by an activation issue. Please check your device's IMEI."
8274+
print "* If it starts with 9900, enable Activation Records stitching in Misc Utilities"
8275+
elif [[ $device_type == "iPad3,3" ]]; then
8276+
warn "Your device is an iPad3,3. These devices are affected by an activation issue."
8277+
[[ $device_unactivated != 2 ]] && print "* If you haven't already, dump activation by selecting Activation Records in Misc Utilities"
8278+
fi
82588279
fi
82598280
;;
82608281
esac
@@ -8815,7 +8836,7 @@ menu_shsh() {
88158836
device_target_vers=
88168837
device_target_build=
88178838
while [[ -z "$mode" && -z "$back" ]]; do
8818-
menu_items=("Latest iOS ($device_latest_vers)")
8839+
menu_items=("Latest iOS ($device_latest_vers)" "Latest iOS ($device_latest_vers) (Baseband Check)")
88198840
case $device_type in
88208841
iPad4,[12345] | iPhone6,[12] )
88218842
menu_items+=("iOS 10.3.3");;
@@ -8871,6 +8892,7 @@ menu_shsh() {
88718892
target_vers_maj=$(echo "$device_target_vers" | cut -d. -f1)
88728893
target_vers_min=$(echo "$device_target_vers" | cut -d. -f2)
88738894
case $selected in
8895+
*"Baseband Check"* ) shsh_save bbcheck; pause;;
88748896
*"iOS"* ) shsh_save; pause;;
88758897
"Onboard Blobs" ) menu_shsh_onboard;;
88768898
"Onboard Blobs (Raw Dump)" )

0 commit comments

Comments
 (0)