forked from RossDarker/A5-A6X-Blobs-Dumper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare
executable file
·198 lines (177 loc) · 4.73 KB
/
prepare
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash
if [ "`whoami`" = root ]; then
echo "Please do not run this as the root user"
exit
fi
if [ $# -lt 2 ]; then
echo ""
echo "[DESCRIPTION]"
echo "Downloads correct IPSW's, Odysseus & FirmwareBundels"
echo ""
echo "[USAGE]"
echo "./prepare <device model> <ios version>"
echo ""
echo "[EXAMPLES]"
echo "./prepare iPad3,5 6.1.2"
echo "./prepare iPod5,1 9.1"
echo "./prepare iPhone4,1 8.4.1"
echo ""
exit
fi
if [ $# -gt 2 ]; then
echo "[ERROR] Too many arguments"
exit
fi
if [ $OSTYPE = msys ]; then
echo "WINDOWS DETECTED"
path="/c/Users/`whoami`/Downloads"
platform="win"
elif [[ $OSTYPE == "darwin"* ]]; then
echo "MAC OS DETECTED"
path="/Users/`whoami`/Downloads"
platform="macos"
else
echo "Not supported"
exit
fi
if [ -e "$path/blobs" ]; then
rm -r "$path/blobs"
fi
mkdir "$path/blobs"
cd "$path/blobs"
if [ $1 = "iPhone4,1" ]; then
buildid="10B329"
fi
if [ $1 = "iPhone5,1" ]; then
buildid="10B329"
fi
if [ $1 = "iPhone5,2" ]; then
buildid="10B329"
fi
if [ $1 = "iPhone5,3" ]; then
buildid="11B511"
fi
if [ $1 = "iPhone5,4" ]; then
buildid="11B651"
fi
if [ $1 = "iPod5,1" ]; then
buildid="10B329"
fi
if [ $1 = "iPad2,1" ]; then
buildid="10B329"
fi
if [ $1 = "iPad2,2" ]; then
buildid="11D257"
fi
if [ $1 = "iPad2,3" ]; then
buildid="12H321"
fi
if [ $1 = "iPad2,4" ]; then
buildid="10B329"
fi
if [ $1 = "iPad2,5" ]; then
buildid="10B329"
fi
if [ $1 = "iPad2,6" ]; then
buildid="12H321"
fi
if [ $1 = "iPad2,7" ]; then
buildid="12H321"
fi
if [ $1 = "iPad3,1" ]; then
buildid="10B146"
fi
if [ $1 = "iPad3,2" ]; then
buildid="12H321"
fi
if [ $1 = "iPad3,3" ]; then
buildid="10B329"
fi
if [ $1 = "iPad3,4" ]; then
buildid="10B329"
fi
if [ $1 = "iPad3,5" ]; then
buildid="12H321"
fi
if [ $1 = "iPad3,6" ]; then
buildid="10B329"
fi
model=$1
ios=$2
echo "Calculating BuildID for iOS $ios"
echo "Please wait..."
curl -# -k -o "firmware" -L https://api.ipsw.me/v2.1/firmwares.json/
cutios=`echo $ios | cut -d . -f 1`
if [ "$cutios" == "10" ]; then
if [[ $model = *"iPad"* ]]; then
cat firmware | grep "$ios"_"" | grep "iPad_32bit" | grep "filename" | cut -d "_" -f 4
mainbdid=`cat firmware | grep "$ios"_"" | grep "iPad_32bit" | grep "filename" | cut -d "_" -f 4`
fi
if [[ $model = *"iPhone"* ]]; then
cat firmware | grep "$ios"_"" | grep "iPhone_4.0_32bit" | grep "filename" | cut -d "_" -f 5
mainbdid=`cat firmware | grep "$ios"_"" | grep "iPhone_4.0_32bit" | grep "filename" | cut -d "_" -f 5`
fi
else
mainbdid=`cat firmware | grep "$model"_"$ios"_"" | grep "http" | cut -d _ -f 3`
cat firmware | grep "$model"_"$ios"_"" | grep "http" | cut -d _ -f 3
fi
if [[ $mainbdid == *"
"* ]]; then
echo "Multiple builds of iOS $ios may exist, please enter the Build ID for the version you are on, exactly as one appears from the list above (case sensitive) :"
read newmainbdid
if [[ $mainbdid == *$newmainbdid* ]]; then
mainbdid=$newmainbdid
else
echo "Check that you typed in the Build ID correctly!"
exit
fi
fi
if [ "$mainbdid" = "" ]; then
echo "iOS $ios does not exist for $model!"
exit
fi
echo $mainbdid > mainbdid
echo "Build ID for extraction iOS: $buildid"
echo "Build ID for current iOS: $mainbdid"
echo "Model: $model"
echo "Downloading correct IPSW"
curl -# -k -o "$model_$buildid.ipsw" -L "https://api.ipsw.me/v4/ipsw/download/$model/$buildid"
echo "Downloaded IPSW for extraction"
if [ $buildid = $mainbdid ]; then
echo "BuildIDs are the same"
else
echo "BuildIDs are different, downloading IPSW for iOS $ios as well"
curl -# -k -o "$model_$mainbdid.ipsw" -L "https://api.ipsw.me/v4/ipsw/download/$model/$mainbdid"
fi
echo "Downloading Odysseus & FirmwareBundles"
curl -# -o odysseus.zip https://dayt0n.com/odysseus/odysseus-0.999.zip
unzip -qq odysseus.zip
rm odysseus.zip
curl -# -o FirmwareBundles.zip https://rossdarker.github.io/o/FirmwareBundles.zip
unzip -qq FirmwareBundles.zip
rm FirmwareBundles.zip
rm -r odysseus-0.999.0/macos/FirmwareBundles
mv FirmwareBundles odysseus-0.999.0/macos/
if [ $cutios = "10" ]; then
echo "Downloading kloader for iOS 10"
curl -# -o kloader https://rossdarker.github.io/o/kloaders/10/kloader
rm odysseus-0.999.0/kloader
chmod +x kloader
mv kloader odysseus-0.999.0/
fi
if [ $cutios = "5" ]; then
echo "Downloading kloader for iOS 5"
curl -# -o kloader https://rossdarker.github.io/o/kloaders/5/kloader
rm odysseus-0.999.0/kloader
chmod +x kloader
mv kloader odysseus-0.999.0/
fi
if [ $platform = "win" ]; then
echo "Downloading xpwn for Windows"
curl -# -o xpwn_win.zip https://rossdarker.github.io/o/xpwn_win.zip
unzip -qq xpwn_win.zip -d odysseus-0.999.0/
rm xpwn_win.zip
mv odysseus-0.999.0/macos/FirmwareBundles/ odysseus-0.999.0/win/FirmwareBundles
fi
echo ""
echo "Done"