-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdeodex.sh
More file actions
93 lines (77 loc) · 1.88 KB
/
Copy pathdeodex.sh
File metadata and controls
93 lines (77 loc) · 1.88 KB
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
#!/bin/bash
#
# Deodex for android 6.0
WORKDIR=$(pwd)
output=$WORKDIR/output
if [ -f "DeodexJarList.txt" ]; then
rm DeodexJarList.txt
fi
if [ -f "DeodexApkList.txt" ]; then
rm DeodexApkList.txt
fi
if [ -f "classes.dex" ]; then
rm classes.dex
fi
if [ ! -f "boot.oat" ]; then
echo "error:please put boot.oat!"
exit 1;
fi
if [ -d $output ]; then
rm -rf $output/*
fi
if [ ! -d $output ]; then
mkdir $output
fi
#deodex jar files
(ls *.jar | grep -v 'baksmali.jar' | grep -v 'smali.jar') > $WORKDIR/DeodexJarList.txt;
cat $WORKDIR/DeodexJarList.txt | while read line;
do
#echo $line
filename=${line%.*}
if [ ! -f "$filename.odex" ]; then
echo "warning:hadn't found $filename.odex!"
fi
if [ -f "$filename.odex" ]; then
#echo $filename
if [ -d $filename ]; then
rm -rf $filename
fi
echo "Deodex $filename ..."
java -jar baksmali.jar -a 23 -x -c boot.oat -d . -b -s $filename.odex -o $filename
java -jar smali.jar -a 23 -j 1 -o classes.dex $filename
jar -cvf $filename.jar classes.dex 1> /dev/null 2> /dev/null
fi
mv $filename.jar $output/$filename.jar
#clean files
rm -rf $filename
rm -rf classes.dex
rm -rf $filename.odex
done
#deodex apk files
(ls *.apk) > $WORKDIR/DeodexApkList.txt;
cat $WORKDIR/DeodexApkList.txt | while read line;
do
#echo $line
filename=${line%.*}
if [ ! -f "$filename.odex" ]; then
echo "warning:hadn't found $filename.odex!"
fi
if [ -f "$filename.odex" ]; then
#echo $filename
if [ -d $filename ]; then
rm -rf $filename
fi
echo "Deodex $filename ..."
java -jar baksmali.jar -a 23 -x -c boot.oat -d . -b -s $filename.odex -o $filename
java -jar smali.jar -a 23 -j 1 -o classes.dex $filename
zip -m $filename.apk ./classes.dex 1> /dev/null 2> /dev/null
fi
mv $filename.apk $output/$filename.apk
#clean files
rm -rf $filename
rm -rf classes.dex
rm -rf $filename.odex
done
rm -rf DeodexJarList.txt
rm -rf DeodexApkList.txt
echo "All Done."