@@ -530,6 +530,7 @@ set_tool_paths() {
530530 fi
531531 if [[ $( xcode-select -p 1> /dev/null; echo $? ) != 0 ]]; then
532532 local error_msg=" * You need to install Xcode Command Line Tools with this command: xcode-select --install"
533+ error_msg+=$' \n * If the above command does not work, try this: sudo xcode-select --reset'
533534 error_msg+=$' \n * Please read the wiki and install the requirements needed: https://github.com/LukeZGD/Legacy-iOS-Kit/wiki/How-to-Use'
534535 xcode-select --install
535536 error " Xcode Command Line Tools not installed, cannot continue." " $error_msg "
@@ -719,6 +720,7 @@ version_update() {
719720 local error_msg=$' \n * If you have not installed/updated git, please install git from your package manager.'
720721 if [[ $platform == " macos" ]]; then
721722 error_msg+=$' \n * On macOS, you may just need to install Xcode Command Line Tools with this command: xcode-select --install'
723+ error_msg+=$' \n * If the above command does not work, try this: sudo xcode-select --reset'
722724 xcode-select --install
723725 fi
724726 error " git clone failed. Please run the script again" " $error_msg "
@@ -1000,15 +1002,11 @@ device_manufacturing() {
10001002 if [[ $device_type == " iPhone2,1" && $device_mode != " DFU" ]]; then
10011003 local week=$( echo " $device_serial " | cut -c 2-)
10021004 local year=$( echo " $device_serial " | cut -c 1)
1003- case $year in
1004- 9 ) year=" 2009" ;;
1005- 0 ) year=" 2010" ;;
1006- 1 ) year=" 2011" ;;
1007- 2 ) year=" 2012" ;;
1008- esac
1009- if [[ $year != " 2009" ]] || (( week >= 46 )) ; then
1005+ year=$(( year+ 2010 ))
1006+ [[ $year == 2019 ]] && year=2009
1007+ if [[ $year != 2009 ]] || (( week >= 46 )) ; then
10101008 device_newbr=1
1011- elif [[ $year == " 2009" ]] && (( week >= 40 )) ; then
1009+ elif [[ $year == 2009 ]] && (( week >= 40 )) ; then
10121010 device_newbr=2 # gray area
10131011 else
10141012 device_newbr=0
@@ -1058,7 +1056,7 @@ device_manufacturing() {
10581056 if [[ $device_type == " iPhone2,1" && $device_mode == " DFU" ]]; then
10591057 print " * Cannot check for manufacturing date in DFU mode"
10601058 elif [[ $device_type == " iPhone2,1" ]]; then
1061- print " * Manufactured in Week $week $year "
1059+ print " * Manufactured in Week $week - $year "
10621060 fi
10631061}
10641062
@@ -4279,7 +4277,7 @@ ipsw_prepare_ios7touch4() {
42794277 fi
42804278
42814279 log " Preparing custom IPSW..."
4282- mkdir -p $ipsw_custom /Firmware/dfu $ipsw_custom /Downgrade $all_flash2 $saves /$device_type_special
4280+ mkdir -p $ipsw_custom /Firmware/dfu $ipsw_custom /Downgrade $all_flash2 $saves /$device_target_build 2> /dev/null
42834281
42844282 local comps=(" iBSS" " iBEC" " DeviceTree" " Kernelcache" " RestoreRamdisk"
42854283 " AppleLogo" " BatteryCharging0" " BatteryCharging1" " BatteryFull" " BatteryLow0" " BatteryLow1"
@@ -4330,7 +4328,7 @@ ipsw_prepare_ios7touch4() {
43304328 $bspatch iBEC.dec iBEC.patched $patches /iBEC.${device_model} ap.RELEASE.patch
43314329 " $dir /xpwntool" iBEC.patched $ipsw_custom /Firmware/dfu/iBEC.${device_model} ap.RELEASE.dfu -t iBEC.orig
43324330 " $dir /iBoot32Patcher" iBEC.dec iBEC.patched --rsa --debug --ticket -b " -v amfi=0xff cs_enforcement_disable=1"
4333- " $dir /xpwntool" iBEC.patched $saves /$device_type_special / pwnediBEC.dfu -t iBEC.orig
4331+ " $dir /xpwntool" iBEC.patched $saves /pwnediBEC.dfu -t iBEC.orig
43344332
43354333 log " Base manifest plist"
43364334 file_extract_from_archive " $ipsw_base_path .ipsw" BuildManifest.plist
@@ -4388,17 +4386,17 @@ ipsw_prepare_ios7touch4() {
43884386 file_extract_from_archive " $ipsw_path .ipsw" kernelcache.release.$device_model_special
43894387 mv kernelcache.release.$device_model_special kc
43904388 " $dir /xpwntool" kc kc.dec -iv $kc_iv -k $kc_key
4391- $bspatch kc.dec kc.patched $patches /kc$ipsw_jailbreak .$device_model_special .patch # kc for non-jb, kc1 for jb
4389+ $bspatch kc.dec kc.patched $patches /$device_target_build / kc$ipsw_jailbreak .$device_model_special .patch # kc for non-jb, kc1 for jb
43924390 " $dir /xpwntool" kc.patched kc.new -t kc -iv $kc_iv -k $kc_key
4393- " $dir /xpwntool" kc.new $saves /$device_type_special /kernelcache$ipsw_jailbreak -iv $kc_iv -k $kc_key -decrypt
4391+ " $dir /xpwntool" kc.new $saves /$device_target_build /kernelcache$ipsw_jailbreak -iv $kc_iv -k $kc_key -decrypt
43944392 cp kc.new $ipsw_custom /kernelcache.release.$device_model # wont be used, but needed for restore
43954393
43964394 log " Target devicetree"
43974395 file_extract_from_archive " $ipsw_path .ipsw" $all_flash_special /DeviceTree.${device_model_special} ap.img3
43984396 mv DeviceTree.${device_model_special} ap.img3 dt
43994397 " $dir /xpwntool" dt dt.dec -iv $dt_iv -k $dt_key -decrypt
44004398 echo " 0000006d: 38 31" | xxd -r - dt.dec
4401- cp dt.dec $saves /$device_type_special /devicetree
4399+ cp dt.dec $saves /$device_target_build /devicetree
44024400
44034401 log " Target RootFS: extracting dmg from ipsw"
44044402 file_extract_from_archive " $ipsw_path .ipsw" $rootfs_target_name
@@ -4442,7 +4440,7 @@ ipsw_prepare_ios7touch4() {
44424440 zip -r0 $ipsw_custom .ipsw *
44434441 popd > /dev/null
44444442
4445- echo " device_type_special= $device_type_special
4443+ echo " device_target_build= $device_target_build
44464444 ipsw_jailbreak=$ipsw_jailbreak " > $saves /$device_ecid
44474445}
44484446
@@ -4740,7 +4738,7 @@ ipsw_prepare_multipatch() {
47404738
47414739 # 3.2.x ipad/4.2.x cdma fs workaround
47424740 case $device_target_vers in
4743- 4.2.10 | 4.2.9 | 4.2.[876] | 3.2* | 3.1.3 )
4741+ 4.2.10 | 4.2.9 | 4.2.[876] | 3.2* )
47444742 local ipsw_name=" ../${device_type} _${device_target_vers} _${device_target_build} _FS"
47454743 local type=" iPad1.1"
47464744 [[ $device_type == " iPhone3,3" ]] && type=" iPhone3.3"
@@ -7035,18 +7033,17 @@ device_ramdisk_ios3exploit() {
70357033 if [[ $device_type == " iPad1,1" ]]; then
70367034 $scp -P
$ssh_port ../saved/iPad1,1/iBoot3_
$device_ecid [email protected] :/mnt1/iBEC
70377035 fi
7038- log " fstab"
7039- $scp -P
$ssh_port $jelbrek /fstab_new
[email protected] :/mnt1/private/etc/fstab
7040- case $device_vers in
7041- 3.1.3 | 3.2* ) opt=' y' ;;
7042- esac
7043- if [[ $opt == ' y' ]]; then
7036+ if [[
-n $( $ssh -p $ssh_port [email protected] " ls /mnt1/bin/bash 2>/dev/null" ) ]]
; then 7037+ log " fstab"
7038+ $scp -P
$ssh_port $jelbrek /fstab_new
[email protected] :/mnt1/private/etc/fstab
70447039 untether=" ${device_type} _${device_build} .tar"
70457040 log " Sending $untether "
70467041 $scp -P
$ssh_port $jelbrek /greenpois0n/
$untether [email protected] :/mnt1
70477042 log " Extracting $untether "
70487043 $ssh -p
$ssh_port [email protected] " tar -xvf /mnt1/$untether -C /mnt1; rm /mnt1/$untether " 70497044 fi
7045+ log " Fixing autoboot and disks, please wait..."
7046+ $ssh -p
$ssh_port [email protected] " nvram auto-boot=1; fsck_hfs -f /dev/rdisk0s1; fsck_hfs -f /dev/rdisk0s2s1" 70507047}
70517048
70527049device_datetime_cmd () {
@@ -8672,13 +8669,13 @@ menu_ipsw() {
86728669 case $device_type in
86738670 iPhone3,1 ) lo=4.0; hi=7.1.1;;
86748671 iPhone3,2 ) lo=6.0; hi=7.1.1;; # lol
8675- iPhone3,3 ) lo=5.0 ; hi=7.1.1;; # lo=4.2.6 if 4.2.x didnt have issues
8672+ iPhone3,3 ) lo=4.2.6 ; hi=7.1.1;;
86768673 iPhone4,1 | iPad2,[123] ) lo=5.0; hi=9.3.5;;
86778674 iPad2* | iPad3,[123] ) lo=5.1; hi=9.3.5;;
86788675 iPhone5,[12] | iPad3,* ) lo=6.0; hi=9.3.5;;
86798676 iPhone5,[34] ) lo=7.0; hi=9.3.5;;
86808677 iPad1,1 ) lo=3.2; hi=5.1;;
8681- iPod3,1 ) lo=4.0 ; hi=5.1;; # lo=3.1.1 if 3.1.x didnt have issues
8678+ iPod3,1 ) lo=3.1.1 ; hi=5.1;;
86828679 esac
86838680 print " * Any iOS version from $lo to $hi is supported"
86848681 fi
@@ -9051,31 +9048,21 @@ ipsw_print_warnings() {
90519048 if [[ $1 == " powder" ]]; then
90529049 case $device_target_build in
90539050 8[ABC]* ) warn " iOS 4.2.1 and lower are hit or miss. It may not restore/boot properly" ;;
9054- # 7[CD]* ) warn "Jailbreak option is not supported for this version. It is recommended to select 3.1.3 instead";;
9055- 8E* ) warn " iOS 4.2.x for the CDMA 4 is not supported. It may not restore/boot properly" ;;
9056- 8* ) warn " Not all devices support iOS 4 versions. It may not restore/boot properly" ;;
9057- 7B* ) : ;;
9058- 7* ) warn " iOS 3.1.x for the touch 3 is not supported. It will get stuck at the activation screen" ;;
9051+ 8* ) [[ $device_type == " iPhone3," * ]] && warn " Not all devices support iOS 4 versions. It may not restore/boot properly" ;;
90599052 esac
90609053 return
90619054 fi
90629055 case $device_type in
9063- " iPhone3," * )
9064- if [[ $device_target_vers == " 4.2" * ]]; then
9065- warn " iOS 4.2.x for $device_type might fail to boot after the restore/jailbreak."
9066- print " * It is recommended to select another version instead."
9067- fi
9068- ;;
9069- " iPod4,1" )
9056+ iPhone3,1 | iPod4,1 )
90709057 if [[ $device_target_vers == " 4.2.1" ]]; then
9071- warn " iOS 4.2.1 for iPod4,1 might fail to boot after the restore/jailbreak."
9058+ warn " iOS 4.2.1 for $device_type might fail to boot after the restore/jailbreak."
90729059 print " * It is recommended to select another version instead."
90739060 elif [[ $device_target_build == " 8B118" ]]; then
90749061 warn " iOS 4.1 (8B118) for iPod4,1 might fail to boot after the restore/jailbreak."
90759062 print " * It is recommended to select 8B117 or another version instead."
90769063 fi
90779064 ;;
9078- " iPhone2,1" )
9065+ iPhone2,1 )
90799066 if [[ $device_target_vers == " 3.0" * && $device_newbr != 0 ]]; then
90809067 warn " 3.0.x versions are for old bootrom devices only. It will fail to restore/boot if your device is not compatible."
90819068 print " * It is recommended to select 3.1 or newer instead."
@@ -9441,7 +9428,7 @@ menu_ipsw_browse() {
94419428 if [[ $device_target_build == " 14" * ]]; then
94429429 log " Selected IPSW ($device_target_vers ) is not supported as target version."
94439430 case $device_type in
9444- iPhone5,[12] ) print " * If you want untethered iOS 10, use p0insettia plus: https://github.com/LukeZGD/p0insettia-plus" ;;
9431+ iPhone5,[12] ) print " * If you want to jailbreak iOS 10 untethered , use p0insettia plus: https://github.com/LukeZGD/p0insettia-plus" ;;
94459432 esac
94469433 pause
94479434 return
@@ -9567,7 +9554,7 @@ menu_flags() {
95679554 warn " This will enable the --disable-bbupdate flag."
95689555 print " * This will disable baseband update for custom IPSWs."
95699556 print " * This will enable usage of dumped baseband and stitch to IPSW."
9570- print " * This applies to the following: iPhone 4S, 5, 5C, iPad 4, mini 1"
9557+ print " * This supports the following: iPhone 4S, 5, 5C, iPad 4, mini 1"
95719558 print " * Do not enable this if you do not know what you are doing."
95729559 local opt
95739560 select_yesno " Do you want to enable the disable-bbupdate flag?" 0
@@ -9614,7 +9601,7 @@ menu_flags() {
96149601 " Enable jailbreak flag" )
96159602 warn " This will enable the --jailbreak flag."
96169603 print " * This will enable the jailbreak option for the custom IPSW."
9617- print " * This is only useful for 4.1 and lower, where jailbreak option is disabled in most cases."
9604+ print " * This is mostly useful for 4.1 and lower, where jailbreak option is disabled in most cases."
96189605 print " * It is disabled for those versions by default because of issues with the custom IPSW jailbreak."
96199606 print " * The recommended method is to jailbreak after the restore instead."
96209607 print " * Do not enable this if you do not know what you are doing."
@@ -9628,7 +9615,7 @@ menu_flags() {
96289615 " Enable multipatch flag" )
96299616 warn " This will enable the --multipatch flag."
96309617 print " * This will enable \" multipatch\" for the custom IPSW."
9631- print " * This is especially useful for iPhone 4S devices that have issues restoring due to battery replacement ."
9618+ print " * This is especially useful for iPhone 4S devices that have issues restoring due to third party battery ."
96329619 print " * This issue is called \" gas gauge\" error, also known as error 29 in iTunes."
96339620 print " * By enabling this, firmware components for 6.1.3 or lower will be used for restoring to get past the error."
96349621 print " * This also attempts to get past \" invalid ticket\" error and other restore errors."
@@ -9664,8 +9651,8 @@ menu_flags() {
96649651 ;;
96659652 " Enable no-finder flag" )
96669653 warn " This will enable the --no-finder flag."
9667- print " * This will disable Finder device detection and keep it disabled after script exit ."
9668- print " * To re-enable it, run the script without this flag enabled and exit."
9654+ print " * This will disable Finder device detection and keep it disabled after the script exits ."
9655+ print " * To re-enable it, run the script without this flag enabled then exit."
96699656 local opt
96709657 select_yesno " Do you want to enable the no-finder flag?" 0
96719658 if [[ $? != 0 ]]; then
@@ -9950,29 +9937,27 @@ device_jailbreak_confirm() {
99509937 ;;
99519938 esac
99529939 elif [[ $device_proc == 1 ]]; then
9953- warn " If you jailbreak with this option (ramdisk method), you will not be able to Bootlace or potentially other similar tools."
9940+ warn " If you jailbreak with this option (ramdisk method), you will not be able to Bootlace or other similar tools."
99549941 print " * If you want to use the mentioned tools, go to \" Restore/Downgrade\" instead, and enable the jailbreak option."
9955- if [[ $device_vers == " 4.2.1" ]]; then
9956- warn " Jailbreaking using the ramdisk method is not supported for the iPhone 3G on iOS 4.2.1."
9957- print " * You will need to go to \" Restore/Downgrade\" instead."
9958- pause
9959- return
9960- fi
99619942 elif [[ $device_proc == 5 ]]; then
99629943 print " * Note: It would be better to jailbreak using sideload or custom IPSW methods for A5 devices."
99639944 print " * Especially since this method may require the usage of checkm8-a5."
99649945 elif [[ $device_proc == 6 && $platform == " linux" ]]; then
99659946 print " * Note: It would be better to jailbreak using sideload or custom IPSW methods for A6 devices on Linux."
9966- elif [[ $device_type == " iPod3,1" && $device_vers == " 6" * ]]; then
9967- warn " Jailbreaking the $device_name on iOS 6 is not supported."
9968- print " * Use the jailbreak option in SundanceInH2A for this."
9947+ fi
9948+ if [[ $device_proc == 1 && $device_vers == " 4.2.1" ]] ||
9949+ [[ $device_type == " iPod3,1" && $device_vers == " 6" * ]] ||
9950+ [[ $device_type == " iPod4,1" && $device_vers == " 7" * ]]; then
9951+ warn " Jailbreaking using the ramdisk method is not supported for the $device_type on iOS $device_vers ."
9952+ print " * You will need to go to \" Restore/Downgrade\" instead."
99699953 pause
99709954 return
99719955 fi
99729956 if [[ $device_vers == " 7" * ]]; then
99739957 warn " Jailbreaking using the ramdisk method is disabled for iOS 7.x."
99749958 print " * It is recommended to use evasi0n7/Lyncis instead, or dump blobs and restore with the jailbreak option enabled."
9975- [[ $ipsw_jailbreak == 1 ]] && warn " Jailbreak flag enabled. You may encounter issues when jailbreaking 7.x with ramdisk method, especially baseband issues."
9959+ warn " You will encounter issues when jailbreaking 7.x with ramdisk method, particularly baseband issues."
9960+ [[ $ipsw_jailbreak != 1 ]] && warn " You can bypass this by enabling the jailbreak flag, but only do this if you know what you are doing."
99769961 echo
99779962 fi
99789963 if [[ $device_proc == 5 || $device_proc == 6 ]]; then
@@ -10022,7 +10007,7 @@ device_jailbreak_confirm() {
1002210007 ;;
1002310008 10* )
1002410009 print " * For this version, you can use socket and sideload it to your device."
10025- print " * https://github.com/staturnzz /socket"
10010+ print " * https://github.com/LukeZGD /socket"
1002610011 pause
1002710012 return
1002810013 ;;
@@ -10080,10 +10065,11 @@ device_jailbreak_gilbert() {
1008010065device_ssh_message () {
1008110066 log " Please read the message below:"
1008210067 print " * Follow these instructions to connect to the device."
10083- print " 1. Install \" OpenSSH\" in Cydia or Zebra."
1008410068 if [[ $device_det == 10 ]] && (( device_proc < 7 )) ; then
10085- print " - Jailbreak with socket: https://github.com/staturnzz/socket"
10086- print " - Also install \" Dropbear\" from my repo: https://lukezgd.github.io/repo"
10069+ print " 1. Jailbreak with socket: https://github.com/LukeZGD/socket"
10070+ print " - And install \" Dropbear\" from my repo: https://lukezgd.github.io/repo"
10071+ else
10072+ print " 1. Install \" OpenSSH\" in Cydia or Zebra."
1008710073 fi
1008810074 print " 2. You will be prompted to enter the root/mobile password of your iOS device."
1008910075 print " - The default password is: alpine"
@@ -10767,27 +10753,43 @@ device_justboot() {
1076710753device_justboot_ios7touch4 () {
1076810754 local patches=" ../resources/patch/touch4-ios7"
1076910755 local saves=" ../saved/$device_type /touch4-ios7"
10770- if [[ -s $saves /$device_ecid ]]; then
10771- source $saves /$device_ecid
10772- log " device_type_special=$device_type_special "
10773- log " ipsw_jailbreak=$ipsw_jailbreak "
10774- else
10756+ device_type_special=" iPhone3,3"
10757+ if [[ ! -s $saves /$device_ecid ]]; then
1077510758 error " Cannot find device file for $device_ecid in saved. Need to restore to iOS 7.1.2 first."
1077610759 fi
10760+
10761+ source $saves /$device_ecid
10762+ [[ -z $device_target_build ]] && device_target_build=" 11D257"
10763+ log " device_target_build=$device_target_build "
10764+ log " ipsw_jailbreak=$ipsw_jailbreak "
10765+ if [[ -d " $saves /$device_type_special " ]]; then
10766+ # migrate from old location to new
10767+ local old=" $saves /$device_type_special "
10768+ local new=" $saves /$device_target_build "
10769+ mkdir -p " $new "
10770+ if [[ -s " $old /pwnediBEC.dfu" ]]; then
10771+ mv " $old /pwnediBEC.dfu" " $saves /"
10772+ fi
10773+ for f in devicetree " kernelcache$ipsw_jailbreak " ; do
10774+ [[ -s " $old /$f " ]] && mv " $old /$f " " $new /"
10775+ done
10776+ rm -r " $old "
10777+ fi
10778+
1077710779 device_enter_mode pwnDFU
1077810780 device_rd_build=
1077910781 patch_ibss
1078010782 log " Sending iBSS..."
1078110783 $irecovery -f pwnediBSS.dfu
1078210784 sleep 1
1078310785 log " Sending iBEC..."
10784- $irecovery -f $saves /$device_type_special / pwnediBEC.dfu
10786+ $irecovery -f $saves /pwnediBEC.dfu
1078510787 device_find_mode Recovery
1078610788 log " devicetree"
10787- $irecovery -f $saves /$device_type_special /devicetree
10789+ $irecovery -f $saves /$device_target_build /devicetree
1078810790 $irecovery -c devicetree
1078910791 log " kernelcache"
10790- $irecovery -f $saves /$device_type_special /kernelcache$ipsw_jailbreak
10792+ $irecovery -f $saves /$device_target_build /kernelcache$ipsw_jailbreak
1079110793 $irecovery -c bootx
1079210794 log " Device should now boot."
1079310795}
0 commit comments