Last active
February 21, 2020 21:43
-
-
Save jcalabres/150dceadf7b68914588b617fa497c197 to your computer and use it in GitHub Desktop.
Android RE Bash Utilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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