Skip to content

Commit 3752946

Browse files
committed
fix touch 3 ios 3, and other changes
fixes enable exploit on 3.1.x/3.2.x for touch 3/ipad 1. - offset is +63 instead of +64 - partition size now depends on sector size as well. previously this was hardcoded to 8 (for 65536/8192, meaning this is broken on devices that use 4096)
1 parent 6d40774 commit 3752946

File tree

3 files changed

+53
-9
lines changed

3 files changed

+53
-9
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
- iPhone 4 CDMA - iOS 4.2.6 to 7.1.1
100100
- iPhone 4S, 5, 5C, iPad 2 Rev A, iPod touch 5 - iOS 5.0 to 9.3.5
101101
- iPad 1 - iOS 3.2 to 5.1
102-
- iPod touch 3 - iOS 4.0 to 5.1 (3.1.x has issues)
102+
- iPod touch 3 - iOS 3.1.1 to 5.1
103103
- Using powdersn0w requires iOS 7.1.x blobs for your device
104104
- No blob requirement for iPhone 4, iPad 1, iPod touch 3 (7.1.2 and 5.1.1 are signed)
105105
- For iPhone 5 and 5C, both 7.0.x and 7.1.x blobs can be used
@@ -111,6 +111,8 @@
111111
- iPhone 2G, 3G, 3GS, iPod touch 1, touch 2 - All versions are supported
112112
- Lowest downgradable version is 2.0. Going to 1.x does not work
113113
- For jailbreaking support, see below
114+
- [Restoring the iPod touch 3rd gen to iOS 6.0 untethered](https://github.com/LukeZGD/Legacy-iOS-Kit/wiki/touch3-ios6)
115+
- [Restoring the iPod touch 4th gen to iOS 7.1.2 tethered](https://github.com/LukeZGD/Legacy-iOS-Kit/wiki/touch4-ios7)
114116
- Jailbreaking for 32-bit devices and versions support:
115117
- iPhone 2G and touch 1 - 3.1.3 only
116118
- iPhone 3G and touch 2 - 4.2.1, 4.1, and 3.1.3
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SystemPartitionPadding</key>
6+
<dict>
7+
<key>n18</key>
8+
<dict>
9+
<key>128</key>
10+
<integer>1280</integer>
11+
<key>16</key>
12+
<integer>160</integer>
13+
<key>32</key>
14+
<integer>320</integer>
15+
<key>64</key>
16+
<integer>640</integer>
17+
<key>8</key>
18+
<integer>80</integer>
19+
</dict>
20+
</dict>
21+
<key>SystemPartitionSize</key>
22+
<integer>1280</integer>
23+
<key>UpdateBaseband</key>
24+
<false/>
25+
</dict>
26+
</plist>

restore.sh

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4670,9 +4670,9 @@ ipsw_prepare_multipatch() {
46704670
"$dir/hfsplus" RestoreRamdisk.dec chmod 755 usr/sbin/asr
46714671
fi
46724672

4673-
if [[ $device_target_vers == "3.2"* ]]; then
4674-
log "3.2 options.plist"
4675-
cp ../resources/firmware/src/target/k48/options.plist $options_plist
4673+
if [[ $device_target_vers == "3."* ]]; then
4674+
log "3.x options.plist"
4675+
cp ../resources/firmware/src/target/${device_model}/options.plist $options_plist
46764676
else
46774677
log "Extract options.plist from $device_target_vers IPSW"
46784678
"$dir/hfsplus" ramdisk2.dec extract usr/local/share/restore/$options_plist
@@ -5449,6 +5449,14 @@ restore_idevicerestore() {
54495449
log "Sending iBEC..."
54505450
$irecovery -f "$ipsw_custom/Firmware/dfu/iBEC.${device_model}ap.RELEASE.dfu"
54515451
device_find_mode Recovery
5452+
elif [[ $device_type == "iPod3,1" && $device_target_vers == "6.0" ]]; then
5453+
rm -rf shsh
5454+
idevicerestore2=
5455+
[[ $platform == "linux" ]] && idevicerestore2="sudo "
5456+
idevicerestore2+="../saved/SundanceInH2A_$platform/executables/"
5457+
[[ $platform == "linux" ]] && idevicerestore2+="$(uname -m)/"
5458+
idevicerestore2+="idevicerestore"
5459+
ExtraArgs="-ey"
54525460
fi
54535461
if [[ $debug_mode == 1 ]]; then
54545462
ExtraArgs+="d"
@@ -5771,7 +5779,10 @@ restore_deviceprepare() {
57715779
if [[ $device_type == "iPod4,1" && $device_target_vers == "7.1.2" ]] ||
57725780
[[ $device_type == "iPod3,1" && $device_target_vers == "6.0" ]]; then
57735781
shsh_save version $device_latest_vers
5774-
device_buttons
5782+
case $device_type in
5783+
iPod4,1 ) device_buttons;;
5784+
iPod3,1 ) device_enter_mode pwnDFU;;
5785+
esac
57755786
elif [[ $device_target_tethered == 1 ]]; then
57765787
shsh_save version $device_latest_vers
57775788
device_enter_mode pwnDFU
@@ -7007,12 +7018,17 @@ device_ramdisk_setnvram() {
70077018

70087019
device_ramdisk_ios3exploit() {
70097020
log "iOS 3.x detected, running exploit commands"
7010-
local offset="$($ssh -p $ssh_port [email protected] "echo -e 'p\nq\n' | fdisk -e /dev/rdisk0" | grep AF | head -1)"
7021+
local fdisk_out="$($ssh -p $ssh_port [email protected] "fdisk /dev/rdisk0")"
7022+
echo "$fdisk_out"
7023+
local offset="$(echo "$fdisk_out" | grep AF | head -1)"
70117024
offset="${offset##*-}"
70127025
offset="$(echo ${offset%]*} | tr -d ' ')"
7013-
offset=$((offset+64))
7026+
offset=$((offset+63))
7027+
local sector_size="$(echo "$fdisk_out" | grep "Sector size" | awk '{print $3}')"
7028+
local partition_size=$((65536/sector_size))
70147029
log "Got offset $offset"
7015-
$ssh -p $ssh_port [email protected] "echo -e 'e 3\nAF\n\n${offset}\n8\nw\ny\nq\n' | fdisk -e /dev/rdisk0"
7030+
log "Got sector size $sector_size. Partition size will be $partition_size"
7031+
$ssh -p $ssh_port [email protected] "echo -e 'e 3\nAF\n\n${offset}\n${partition_size}\nw\ny\nq\n' | fdisk -e /dev/rdisk0"
70167032
echo
70177033
log "Writing exploit ramdisk"
70187034
$scp -P $ssh_port ../resources/firmware/src/target/$device_model/9B206/exploit [email protected]:/
@@ -10069,7 +10085,7 @@ device_jailbreak_gilbert() {
1006910085
mv freeze.tar payload/common/Cydia.tar
1007010086
log "Running g1lbertJB..."
1007110087
"../../$dir/gilbertjb"
10072-
rm payload/common/Cydia.tar
10088+
rm -rf payload/common/Cydia.tar private var
1007310089
popd >/dev/null
1007410090
}
1007510091

0 commit comments

Comments
 (0)