mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-11 06:55:01 +00:00
f4e3f593d4
And 'C' toggles color! a use-after-free has been fixed too And more instructions are now recognized by the analysis
48 lines
1.0 KiB
Bash
Executable File
48 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Import DEX/Dalvik information from `dexdump`
|
|
# Usage:
|
|
# r2 -c '.!doc/dexdump.sh $FILE' classes.dex
|
|
|
|
if [ -z "${DEXDUMP}" ]; then
|
|
DEXDUMP="${HOME}/Downloads/android-sdk/sdk/build-tools/android-4.4.2/dexdump";
|
|
if [ ! -x "${DEXDUMP}" ]; then
|
|
DEXDUMP="dexdump"
|
|
fi
|
|
fi
|
|
if [ -z "$1" ] ;then
|
|
echo "Usage: dexdump.sh [dexfile] > dex.r2"
|
|
exit 1
|
|
fi
|
|
echo "e asm.arch=dalvik"
|
|
echo "e asm.bits=32"
|
|
echo "fs symbols"
|
|
|
|
#${DEXDUMP} -d $1 ; exit 0
|
|
|
|
# Symbols
|
|
${DEXDUMP} -d $1 | perl -ne '
|
|
s/://g;
|
|
if (/invoke-/) {
|
|
s/\s+/ /g;
|
|
local @str = split (/ /);
|
|
/\sL(.*)/;
|
|
local $msg = $1;
|
|
$msg=~tr/,()[]{}|\/\;$<> @#-+*/_____________________/;
|
|
#$msg=~s//;
|
|
print "fs callrefs\nCC call.L".$msg." @ 0x".$str[0]."\n";
|
|
} elsif (/\|\[/) {
|
|
tr/()[]\/\;$<>/_________/;
|
|
/^(.*) (.*) (.*)$/;
|
|
print "fs symbols\nf sym.$3 = 0x$1\n";
|
|
} elsif (/const-string/) {
|
|
s/\s+/ /g;
|
|
local @str = split (/ /);
|
|
/"(.*)"/;
|
|
local $msg = $1;
|
|
$msg=~tr/,()[]{}|\/\;$<> @#-+*/_____________________/;
|
|
#$msg=~s//;
|
|
print "fs strings\nCC str.".$msg." @ 0x".$str[0]."\n";
|
|
}
|
|
'
|
|
echo "fs *"
|