forked from Paisseon/SatellaJailed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-using-an-inferior-shell.sh
188 lines (153 loc) · 5.73 KB
/
patch-using-an-inferior-shell.sh
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
#!/bin/bash
# Made by Paisseon and Sudo
println() {
printf '%s\n' "$*"
}
# Read arguments
while getopts ":v:i:o:" args; do
case "${args}" in
v)
case "${OPTARG}" in
12)
println "[*] Unzipping Orion 12-13 framework..."
unzip -o -qq "Orion_12-13.zip"
vers=12
;;
13)
println "[*] Unzipping Orion 12-13 framework..."
unzip -o -qq "Orion_12-13.zip"
vers=13
;;
14)
println "[*] Unzipping Orion 14-15 framework..."
unzip -o -qq "Orion_14-15.zip"
vers=14
;;
15)
println "[*] Unzipping Orion 14-15 framework..."
unzip -o -qq "Orion_14-15.zip"
vers=15
;;
16)
println "[*] Unzipping Orion 14-15 framework..."
unzip -o -qq "Orion_14-15.zip"
vers=15
;;
*)
println "[*] Error: Version invalid. Valid versions are: 12, 13, 14, 15, and 16."
exit
;;
esac
;;
i)
println "[*] Setting input file as ${OPTARG}"
ipa="${OPTARG}"
;;
o)
println "[*] Setting output file as ${OPTARG}"
output="${OPTARG}"
;;
*)
println "[*] Error: Invalid argument: ${OPTARG}. Satella Jailed patcher accepts only -v, -i, and -o arguments"
exit
;;
esac
done
# Ensure that -v is set
if test -z "$vers"; then
println "[*] iOS version is undefined; assuming iOS 15"
println "[*] Unzipping Orion 14-15 framework..."
unzip -o -qq "Orion_14-15.zip"
vers=15
fi
# Move the miscellaneous assets into Orion.framework
println "[*] Adding assets used in preferences..."
cp -r Emilia Orion.framework/Emilia
# Install dependencies if they don't exist already
println "[*] Checking dependencies..."
case "$(uname -s)" in
*Darwin*)
if test -f /usr/lib/libsubstrate.dylib; then
println "[*] OS detected as iOS"
if test ! -f /usr/bin/azule; then
println "[*] Please add these repos:"
println "[*] https://apt.alfhaily.me"
println "[*] https://level3tjg.me/repo"
println "[*] https://cydia.akemi.ai"
println "[*] https://repo.packix.com"
println "[*] and install the deb file from https://github.com/Al4ise/Azule/releases/latest"
exit
fi
else
println "[*] OS detected as macOS"
println "[*] Installing dependencies..."
if type xcode-select >&- && xpath="$(xcode-select --print-path)" && test -d "$xpath" && test -x "$xpath"; then
println "[*] Xcode CLI already installed"
else
xcode-select --install
fi
fi
;;
*Linux*)
println "[*] OS detected as Linux or WSL"
if test "$(/usr/bin/id -u)" -ne 0; then
println "[*] Error: Needs sudo to run properly on Linux"
exit
fi
println "[*] Installing dependencies..."
apt install jq git curl rsync xz-utils unzip zip libxml2 libc++abi-dev
;;
*)
println "[*] Error: OS detected as $(uname -s), which is not supported"
exit
;;
esac
println "[*] Finished installing dependencies"
# Install Azule if it doesn't exist already
if test ! -L "/usr/local/bin/azule"; then
println "[*] Installing Azule..."
if test "$(/usr/bin/id -u)" -ne 0; then
println "[*] Error: Needs sudo to install Azule (this is only needed once)"
exit
fi
git clone https://github.com/Al4ise/Azule "$HOME/Azule"
ln -sf "$HOME/Azule/azule" /usr/local/bin/azule
fi
# Fix pathing issues (fuck me if this still crashes)
if test -f /usr/bin/install_name_tool; then
println "[*] Redirecting root framework calls to sandbox..."
install_name_tool -change /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate @executable_path/Frameworks/CydiaSubstrate.framework/CydiaSubstrate Orion.framework/Orion 2>/dev/null
install_name_tool -change /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate @executable_path/Frameworks/CydiaSubstrate.framework/CydiaSubstrate Satella.dylib 2>/dev/null
install_name_tool -change /Library/Frameworks/Orion.framework/Orion @executable_path/Frameworks/Orion.framework/Orion Satella.dylib 2>/dev/null
else
println "[*] install_name_tool not found. If you experience crash on launch, use the manual patching method"
fi
# Check if an .ipa file exists nearby
if test -z "$ipa"; then
files="../*"
for file in $files; do
if test "$(echo "$file" | sed 's/.ipa//')" != "$file" && test "$(echo "$file" | sed 's/_Patched.ipa//')" == "$file"; then
ipa="$file"
fi
done
files="*"
for file in $files; do
if test "$(echo "$file" | sed 's/.ipa//')" != "$file" && test "$(echo "$file" | sed 's/_Patched.ipa//')" == "$file"; then
ipa="$file"
fi
done
fi
# Exit if the $ipa variable is not set
if test -z "$ipa"; then
println "[*] Error: Couldn't find .ipa file"
exit
fi
# Ensure that the $output variable is set
if test -z "$output"; then
output="$(echo "$ipa" | sed 's/.ipa/_Patched/')"
fi
# Do stuff in Azule
azule -n "$output" -i "$ipa" -o ./ -f ./Orion.framework ./Satella.dylib -v
# Finish up
rm -rf Orion.framework
println "[*] Done!"