-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
238 lines (222 loc) · 4.89 KB
/
main.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
#!/bin/bash
# Automate frida commands
# Copyright (C) 2022 mstavrou
# Last revised 01/04/2022
clear
START=$(date +"%s")
function ShowElapsedTime {
echo ''
end=$(date +"%s")
elapsed=$(($end-$START))
echo "$(($elapsed / 60)) minutes $(($elapsed % 60)) seconds"
echo ''
}
echo ''
echo ''
echo ''
echo '|||||||||||||||||||||||||||||||'
echo '| |'
echo '| Frida Commands |'
echo '| |'
echo '| |'
echo '|||||||||||||||||||||||||||||||'
echo ''
echo ''
echo ''
echo ''
echo '1 – Java classes of the apk'
echo '2 – Search java class'
echo '3 – Java class properties of the apk'
echo '4 – Search property of a class'
echo '5 – Fake Location'
echo ''
echo ''
read -n 1 -s -r -p 'Select operation type, ESC to cancel...' key
echo ''
if [ "$key" == $'\e' ]; then
echo ''
echo ''
echo 'Operation canceled!'
echo ''
echo ''
exit 1
fi
clear
case $key in
1)
echo ''
echo ''
echo 'Enter app package name to retrieve classes and press Enter, Ctrl+C to cancel...'
echo ''
echo 'Packages Latest List of Installed Application'
echo ''
adb shell pm list packages -3 | cut -f 2 -d ":"
echo ''
read -e -p 'Package Name: ' packageName
echo ''
echo ''
echo ''
echo '
if(Java.available){
Java.perform(function() {
Java.enumerateLoadedClasses({
onMatch : function(className){
console.log(className);
},
onComplete : function(){
console.log("thank you");
}
})
});
} else{
console.log("java is not available");
}' > ./js/${packageName}_class.js
echo '-------------------------'
echo ''
echo 'Frida connected hit %resume to see the classes, when you exit it will produce output to a folder output-fridaTxt'
echo ''
echo '-------------------------'
echo ''
echo ''
frida -U -f ${packageName} -l ./js/${packageName}_class.js
echo ''
echo ''
echo '-------------------------'
echo ''
echo ''
echo ''
echo ''
frida -U -f ${packageName} -l ./js/${packageName}_class.js --no-pause > ./output-fridaTxt/${packageName}_class.txt
echo ''
echo ''
echo ''
echo ''
;;
2)
echo ''
echo ''
echo 'Enter app package name and class to search and press Enter, Ctrl+C to cancel...'
echo ''
echo 'Packages Latest List of Installed Application'
echo ''
adb shell pm list packages -3 | cut -f 2 -d ":"
echo ''
echo ''
read -e -p 'Package Name: ' packageName
echo ''
echo ''
read -e -p 'Class to see if exists - %like: ' classSearch
echo ''
echo ''
echo '-------------------------'
echo ''
echo 'Results.......'
echo ''
echo ''
cat ./output-fridaTxt/${packageName}_class.txt | grep "${classSearch}"
echo ''
echo ''
echo '-------------------------'
echo ''
echo ''
;;
3)
echo ''
echo ''
echo 'Enter app package name and class to retrieve methods and press Enter, Ctrl+C to cancel...'
echo ''
echo 'Packages Latest List of Installed Application'
echo ''
adb shell pm list packages -3 | cut -f 2 -d ":"
echo ''
echo '-------------------------'
echo ''
echo ''
read -e -p 'Package Name: ' packageName
echo ''
echo ''
echo '-------------------------'
echo ''
read -e -p 'Class Name: ' className
echo ''
echo ''
echo '
if(Java.available){
Java.perform(function() {
var t = Java.use("'${className}'");
console.log(Object.getOwnPropertyNames(t).join("\n"));
});
} else{
console.log("java is not available");
}' > ./js/${packageName}_properties.js
echo ''
echo '-------------------------'
echo ''
echo 'Frida connected hit %resume to see the method, when you exit it will produce output to a folder output-fridaTxt'
echo ''
echo '-------------------------'
echo ''
echo ''
frida -U -f ${packageName} -l ./js/${packageName}_properties.js
echo ''
echo ''
echo '-------------------------'
frida -U -f ${packageName} -l ./js/${packageName}_properties.js --no-pause > ./output-fridaTxt/${packageName}_properties.txt
echo ''
echo ''
echo ''
echo ''
;;
4)
echo ''
echo ''
echo 'Enter app package name and property of a class to search and press Enter, Ctrl+C to cancel...'
echo ''
echo 'Packages Latest List of Installed Application'
echo ''
adb shell pm list packages -3 | cut -f 2 -d ":"
echo ''
echo ''
read -e -p 'Package Name: ' packageName
echo ''
echo ''
read -e -p 'Property of a class to see if exists - %like: ' propertySearch
echo ''
echo ''
echo '-------------------------'
echo ''
echo 'Results.......'
echo ''
echo ''
cat ./output-fridaTxt/${packageName}_properties.txt | grep "${propertySearch}"
echo ''
echo ''
echo '-------------------------'
echo ''
echo ''
;;
5)
echo ''
echo ''
echo 'Enter app package name to start fake location and press Enter, Ctrl+C to cancel...'
echo ''
echo 'Packages Latest List of Installed Application'
echo ''
adb shell pm list packages -3 | cut -f 2 -d ":"
echo ''
read -e -p 'Package name: ' packageName
echo ''
echo 'Frida started'
echo '-------------------------'
frida -U -f $packageName -l js/fakeLocation.js --no-pause
;;
*)
echo ''
echo ''
echo 'Unknown operation type!'
echo ''
echo ''
exit 1
;;
esac
ShowElapsedTime