Skip to content

Commit 19e80e5

Browse files
committed
use 'pf' instead of px to avoid colors, and use internal grep instead of awk. Thanks @trufae for the optimization tips :)
1 parent 76f0ce3 commit 19e80e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

android/oat2dex.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ if [ -z "${OAT}" ]; then
77
echo "Usage: $0 <file.oat>"
88
exit 0
99
fi
10-
HIT=$(r2 -q -c '/ dex\n035' "${OAT}" 2>/dev/null |grep hit0_0 |awk '{print $1}')
10+
HIT=$(r2 -n -q -c '/ dex\n035' "${OAT}" 2>/dev/null |grep hit0_0 |awk '{print $1}')
1111
if [ -z "${HIT}" ]; then
1212
echo "[-] ERROR: Can't find dex header"
1313
exit 1
1414
else
1515
echo "[+] DEX header found at address: ${HIT}"
1616
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)
17+
SIZE=$(r2 -n -q -c "pf i @${HIT}+32 ~[2]" "${OAT}" 2>/dev/null)
1818
echo "[+] Dex file size: ${SIZE} bytes"
1919
r2 -q -c "pr ${SIZE} @${HIT} > ${OAT}.dex" "${OAT}" 2>/dev/null
2020
if [ $? -eq 0 ]; then

0 commit comments

Comments
 (0)