Skip to content

Instantly share code, notes, and snippets.

@jcalabres
Last active February 21, 2020 21:43
Show Gist options
  • Save jcalabres/150dceadf7b68914588b617fa497c197 to your computer and use it in GitHub Desktop.
Save jcalabres/150dceadf7b68914588b617fa497c197 to your computer and use it in GitHub Desktop.
Android RE Bash Utilities
adb root
function jdwp-attach(){
adb jdwp
adb forward tcp:7777 jdwp:$1
echo "suspend"; cat; } | jdb -attach localhost:7777
}
function get-package(){
adb shell pm list packages | grep $1 | cut -d ":" -f 2
}
function set-debuggable() {
adb shell am set-debug-app -w --persistent $1
}
function pgkill() {
adb shell "for pid in \`ps | $1 | sed 's/ */ /g' | \
cut -d ' ' -f 2 \`; do kill \$pid; done"
}
function frida-start() {
pgkill "frida"
if [ -n "$1" ]; then frida=$1; else frida="frida-server"; fi
adb shell "/data/local/tmp/$frida &"
}
function gdb-start() {
pgkill "gdbserver"
if [ -n "$2" ]; then gdb=$2; else gdb="gdbserver"; fi
pid=$(adb shell pgrep $1)
adb shell "/data/local/tmp/$gdb :9999 --attach $pid &"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment