This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
prepare
executable file
·141 lines (117 loc) · 3.71 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
#!/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 == "darwin"* ]]; then
echo "macOS Detected"
path="/Users/`whoami`/Downloads"
platform="macos"
else
echo "Not supported"
exit
fi
if ! [[ `curl -sS "https://rossdarker.github.io/o"` && `curl -sS "https://api.ipsw.me/v4/"` ]] ; then
echo "Could not connect to Github or IPSW.me - See Troubleshooting"
exit
fi
if [ -e "$path/blobs" ]; then
rm -r "$path/blobs"
fi
mkdir "$path/blobs"
cd "$path/blobs"
model=$1
ios=$2
curl -sS -o defaultbdids "https://rossdarker.github.io/o/defaultbdids"
buildid=`cat defaultbdids | grep $model | cut -d \; -f 2`
echo $buildid > extbdid
echo "Calculating Build ID for iOS $ios"
echo -e "Please wait...\n"
cutios=`echo $ios | cut -d . -f 1`
mainbdid=`curl -sS "https://api.ipsw.me/v4/device/$model?type=ipsw" | tr '{' '\n' | grep "version\":\"$ios\"" | cut -d \" -f 12`
if [[ $mainbdid == *"
"* ]]; then
echo -e "Possible Build IDs: \n$mainbdid\n"
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
echo ""
if [[ $mainbdid == *$newmainbdid* ]]; then
mainbdid=$newmainbdid
else
echo "Check that you typed in the Build ID correctly!"
exit
fi
fi
ipswurl="https://api.ipsw.me/v4/ipsw/download/$model/$mainbdid"
if [ "$mainbdid" = "" ]; then
curl -sS -o exceptions "https://rossdarker.github.io/o/exceptions"
mainbdid=`cat exceptions | grep "$model;$ios" | cut -d \; -f 3`
ipswurl=`cat exceptions | grep "$model;$ios" | cut -d \; -f 4`
fi
if [ "$mainbdid" = "" ]; then
echo "Could not find iOS $ios for $model!"
exit
fi
echo $mainbdid > mainbdid
echo "Build ID for extraction iOS: $buildid"
echo "Build ID for current iOS: $mainbdid"
echo -e "Model: $model\n"
echo "Downloading extraction IPSW..."
curl -# -k -o "$model_$buildid.ipsw" -L "https://api.ipsw.me/v4/ipsw/download/$model/$buildid"
if [ $buildid = $mainbdid ]; then
echo "Build IDs are the same"
else
echo "Build IDs are different, downloading IPSW for iOS $ios as well..."
curl -# -k -o "$model_$mainbdid.ipsw" -L "$ipswurl"
fi
echo "Downloading Odysseus & FirmwareBundles"
curl -# -o odysseus.zip https://rossdarker.github.io/o/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"