File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Extract DEX file from inside Android Runtime OAT file using radare2
3
+ # (c)2013 Pau Oliva (@pof)
4
+
5
+ OAT=" $1 "
6
+ if [ -z " ${OAT} " ]; then
7
+ echo " Usage: $0 <file.oat>"
8
+ exit 0
9
+ fi
10
+ HIT=$( r2 -q -c ' / dex\n035' " ${OAT} " 2> /dev/null | grep hit0_0 | awk ' {print $1}' )
11
+ if [ -z " ${HIT} " ]; then
12
+ echo " [-] ERROR: Can't find dex header"
13
+ exit 1
14
+ else
15
+ echo " [+] DEX header found at address: ${HIT} "
16
+ fi
17
+ SIZE=$( r2 -e scr.color=false -q -c " px 4 @$HIT +32" ${OAT} 2> /dev/null | tail -n 1 | awk ' {print $2 $3}' | sed -e " s/^/0x/" | rax2 -e)
18
+ echo " [+] Dex file size: ${SIZE} bytes"
19
+ r2 -q -c " pr ${SIZE} @${HIT} > ${OAT} .dex" " ${OAT} " 2> /dev/null
20
+ if [ $? -eq 0 ]; then
21
+ echo " [+] Dex file dumped to: ${OAT} .dex"
22
+ else
23
+ echo " [-] ERROR: Something went wrong :("
24
+ fi
You can’t perform that action at this time.
0 commit comments