Skip to content

Instantly share code, notes, and snippets.

@jerrellmardis
Forked from tyvsmith/dex-count.sh
Last active January 2, 2016 04:48
Show Gist options
  • Save jerrellmardis/8252498 to your computer and use it in GitHub Desktop.
Save jerrellmardis/8252498 to your computer and use it in GitHub Desktop.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
java -jar baksmali.jar $1 -o $dir
for pkg in `find $dir/* -type d`; do
java -jar smali.jar $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
echo -e "$count\t$name"
done
rm -rf $dir
}
function dex-field-count(){
cat $1 | head -c 84 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-field-count-by-package() {
dir=$(mktemp -d -t dex)
java -jar baksmali.jar $1 -o $dir
for pkg in `find $dir/* -type d`; do
java -jar smali.jar $pkg -o $pkg/classes.dex
count=$(dex-field-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
echo -e "$count\t$name"
done
rm -rf $dir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment