forked from kavan-mevada/ApktoolX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ApktoolX.sh
236 lines (176 loc) · 3.66 KB
/
ApktoolX.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
#!/bin/bash
clear
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
TOOL_DIR="$SCRIPT_DIR/tools"
FRAME_DIR="$TOOL_DIR/framework"
INPU_DIR="$SCRIPT_DIR/In"
OU_DIR="$SCRIPT_DIR/Out"
DO_DIR="$SCRIPT_DIR/Done"
title_ui() {
clear
echo "---------------------------------------------"
echo "- Advanced ApkTo0ol v1.0.0 -"
echo "- By wolfmannight -"
echo "---------------------------------------------"
echo " "
echo " "
}
# --------- Functions ------------
# Install framework
install_frame() {
clear
title_ui
#UI Render
echo "List of Apk inside In folder :";
echo " "
var=0;
for file in "$INPU_DIR"/*; do
path_array[$var]="$file"
name_array[$var]="${file##*/}"
echo "$var" "-" ${name_array[$var]};
echo " "
var=$((var+1));
done
echo " "
echo "Enter the Number of apk to Decompile:"
read USR_INPUT
# Install framework
clear
title_ui
echo "Installing framework..."
echo " "
echo "Log:"
echo "----------"
java -jar "$TOOL_DIR/apktool.jar" if -p "$FRAME_DIR" "${path_array[$USR_INPUT]}"
}
# Decompile
decompile_apk() {
clear
title_ui
#UI Render
echo "List of Apk inside In folder :";
echo " "
var=0;
for file in "$INPU_DIR"/*; do
path_array[$var]="$file"
name_array[$var]="${file##*/}"
echo "$var" "-" ${name_array[$var]};
echo " "
var=$((var+1));
done
echo " "
echo "Enter the Number of apk to Decompile:"
read USR_INPUT
# Decompile
clear
title_ui
echo "Decompiling file..."
echo " "
echo "Log:"
echo "----------"
java -jar "$TOOL_DIR/apktool.jar" d -f -o "$OU_DIR/${name_array[$USR_INPUT]}" "${path_array[$USR_INPUT]}"
}
# Recompile
recompile_apk() {
clear
title_ui
#UI Render
echo "List of Apk for Recompile :";
echo " "
var=0;
for file in "$OU_DIR"/*; do
de_folder_path_array[$var]="$file"
de_folder_name_array[$var]="${file##*/}"
echo "$var" "-" ${de_folder_name_array[$var]};
echo " "
var=$((var+1));
done
echo " "
echo "Enter the Number of apk to Recompile:"
read USR_INPUT
# Recompile
clear
title_ui
echo "Recompiling file..."
echo " "
echo "Log:"
echo "----------"
java -jar "$TOOL_DIR/apktool.jar" b -o "$DO_DIR/${de_folder_name_array[$USR_INPUT]}" -p "$FRAME_DIR" "${de_folder_path_array[$USR_INPUT]}"
}
#recompile_apk
sign_apk() {
clear
title_ui
#UI Render
echo "List of Apk for Sign :";
echo " "
var=0;
for file in "$DO_DIR"/*; do
do_apk_path_array[$var]="$file"
do_apk_name_array[$var]="${file##*/}"
echo "$var" "-" ${do_apk_name_array[$var]};
echo " "
var=$((var+1));
done
echo " "
echo "Enter the Number of apk to Sign:"
read USR_INPUT
echo ${do_apk_path_array[$USR_INPUT]}
# Sign
clear
title_ui
echo "Signing file..."
echo " "
echo "Log:"
echo "----------"
"$TOOL_DIR/jarsigner" -keystore "$TOOL_DIR/AOSP.keystore" -storepass android "${do_apk_path_array[$USR_INPUT]}" platform
}
# --------- UI -----------
user_interface() {
title_ui
my_array=(
"1 - Install Framework"
" "
"2 - Decompile Files"
" "
"3 - Recompile Files"
" "
"4 - Sign Files"
)
printf '%s\n' "${my_array[@]}"
echo " "
echo " "
echo '.----------------.'
echo '| Any key - Exit |'
echo '.----------------.'
echo " "
echo "Make A Choice And Press ENTER:";
read CHOISE
case $CHOISE in
1)
install_frame;;
2)
decompile_apk;;
3)
recompile_apk;;
4)
sign_apk;;
*) exit;;
esac
}
back_function() {
echo " "
echo "Enter the x to go back:"
read BC_USR_INPUT
if [ "$BC_USR_INPUT" = 'x' ]
then
user_interface;
else
exit 0
fi
}
user_interface;
while :
do
back_function;
done