-
Notifications
You must be signed in to change notification settings - Fork 84
/
Menu.sh
280 lines (250 loc) · 9.15 KB
/
Menu.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/bin/sh
function checkInstall()
{
local path
case $1 in
otool)
path=$(which otool)
echo "$path"
;;
sqlite3)
path=$(which sqlite3)
echo "$path"
;;
file)
path=$(which file)
echo "$path"
;;
plutil)
path=$(which plutil)
echo "$path"
;;
theos)
path=$(find / -name theos -type d)
echo "$path"
;;
dumpdecrypted)
path=$(find / -name dumpdecrypted.dylib -type f)
echo "$path"
;;
keychainDumper)
path=$(find / -name keychain_dumper -type f)
echo "$path"
;;
classDumpZ)
path=$(find / -name class-dump-z -type f)
echo "$path"
;;
*) break
esac
}
#File that stores paths of tools
file="/Applications/iRE.app/toolPaths.txt"
#check if "toolPaths.txt" file exists
if [ -f "$file" ]
then
#File already exists. Read it and check if any tool paths are missing
while IFS=$':' read -r -a myArray
do
toolName=${myArray[0]}
toolPath=${myArray[1]}
if [ ! -n "$toolPath" ]
then
toolArray+=($toolName)
fi
done < "$file"
if [ ${#toolArray[@]} -ge "1" ]
then
#echo "Inside tool array"
for i in "${toolArray[@]}"
do
#echo $i
result=$(checkInstall $i)
#echo "Path: $result"
if [ "$result" != "" ]
then
sed -i "s,"$i:","$i:$result",g" /Applications/iRE.app/toolPaths.txt
#mv temp.txt toolPaths.txt
fi
done
fi
else
#First time tool has run, check if tools are installed
#OTOOL
otoolPath=$(checkInstall otool)
strTools="otool:$otoolPath\n"
#SQLITE
sqlitePath=$(checkInstall sqlite3)
strTools+="sqlite3:$sqlitePath\n"
#FILE
fileToolPath=$(checkInstall file)
strTools+="file:$fileToolPath\n"
#PLUTIL
plutilPath=$(checkInstall plutil)
strTools+="plutil:$plutilPath\n"
#THEOS
theosPath=$(checkInstall theos)
strTools+="theos:$theosPath\n"
#DUMPDECRYPTED
dumpPath=$(checkInstall dumpdecrypted)
strTools+="dumpdecrypted:$dumpPath\n"
#KEYCHAIN
keychainPath=$(checkInstall keychainDumper)
strTools+="keychainDumper:$keychainPath\n"
#CLASS-DUMP-Z
classDumpPath=$(checkInstall classDumpZ)
strTools+="classDumpZ:$classDumpPath"
echo -e $strTools > /Applications/iRE.app/toolPaths.txt
fi
#Read if the paths of the tools and show installed or not
#check if "toolPaths.txt" file exists
if [ -f "$file" ]
then
while IFS=':' read -r f1 f2
do
case $f1 in
otool)
if [ "$f2" != "" ]
then
otoolInstalled="<font color="green">Installed</font>"
else
otoolInstalled="<font color="red">Not Installed</font>"
fi
;;
sqlite3)
if [ "$f2" != "" ]
then
sqliteInstalled="<font color="green">Installed</font>"
else
sqliteInstalled="<font color="red">Not Installed</font>"
fi
;;
file)
if [ "$f2" != "" ]
then
fileInstalled="<font color="green">Installed</font>"
else
fileInstalled="<font color="red">Not Installed</font>"
fi
;;
plutil)
if [ "$f2" != "" ]
then
plutilInstalled="<font color="green">Installed</font>"
else
plutilInstalled="<font color="red">Not Installed</font>"
fi
;;
theos)
if [ "$f2" != "" ]
then
theosInstalled="<font color="green">Installed</font>"
else
theosInstalled="<font color="red">Not Installed</font>"
fi
;;
dumpdecrypted)
if [ "$f2" != "" ]
then
dumpInstalled="<font color="green">Installed</font>"
else
dumpInstalled="<font color="red">Not Installed</font>"
fi
;;
keychainDumper)
if [ "$f2" != "" ]
then
keychainInstalled="<font color="green">Installed</font>"
else
keychainInstalled="<font color="red">Not Installed</font>"
fi
;;
classDumpZ)
if [ "$f2" != "" ]
then
classDumpZInstalled="<font color="green">Installed</font>"
else
classDumpZInstalled="<font color="red">Not Installed</font>"
fi
;;
*) break
esac
done < "$file"
else
echo "/Applications/iRE.app/toolPaths.txt File Does Not Exist"
fi
guids=$(ls /var/mobile/Applications/*/*.app/Info.plist |sort | cut -d"/" -f5)
dropDownList="<option value=>Select Application</option>"
for a in ${guids}
do
name=$( ls /var/mobile/Applications/$a/*.app/Info.plist | cut -d"/" -f6 | cut -d. -f1 )
dropDownList+="<option value="$a">"$name"</option>"
done
echo '<html>
<head>
<meta charset="UTF-8">
<title>iRET - iOS Reverse Engineering Toolkit</title>
</head>
<script type="text/javascript">
function submitForm(strValue)
{
var oForm = document.getElementById("form1");
oForm.action = "/Binary?" + strValue;
oForm.submit();
}
</script>
<body bgcolor="#0377CC">
<table width="100%" height="100%">
<tr>
<td align="center" valign="center">
<table style="background-color:white;border:1px solid black;" height="90%" width="90%">
<tr>
<td align="center" valign="top" colspan="2" height="20%"><font face="arial black" color="black" size="6">Welcome to iRET<br>The iOS Reverse Engineering Toolkit</font></td>
</tr>
<tr>
<td align="center" valign="top" width="50%">
<table style="background-color:white;border:1px solid black;" height="90%" width="90%">
<tr>
<td align="center" width="50%" cellpadding="4">
<table style="background-color:white;border:1px solid black;" height="100%" width="100%">
<tr>
<td valign="top">
<center><font face="arial black" color="black" size="3">What is in the toolkit?</font></center><br><br>
<font face="arial" color="black" size="3">
<span style="padding:150px">- oTool ('${otoolInstalled}')</span><br>
<span style="padding:150px">- dumpDecrypted ('${dumpInstalled}')</span><br>
<span style="padding:150px">- Sqlite ('${sqliteInstalled}')</span><br>
<span style="padding:150px">- Theos ('${theosInstalled}')</span><br>
<span style="padding:150px">- Keychain_dumper ('${keychainInstalled}')</span><br>
<span style="padding:150px">- file ('${fileInstalled}')</span><br>
<span style="padding:150px">- plutil ('${plutilInstalled}')</span><br>
<span style="padding:150px">- class-dump-z ('${classDumpZInstalled}')</span>
<br><br>
<span style="padding:100px">Note: All tools listed above must be installed.</span></font>
</td>
</tr>
</table>
</td>
<td>
<table style="background-color:white;border:1px solid black;" height="100%" width="100%">
<tr>
<td valign="top">
<center><font face="arial black" color="black" size="3">To begin, select an app from the list below:</font><br><br>
<form id="form1" method="GET">
<select name="AppID" onchange="submitForm(this.value);">'
echo ${dropDownList}
echo '</select></form></center>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<tr>
</table>
</td>
</tr>
</table>
</body>
</html>'