Created
December 6, 2015 19:19
-
-
Save flo-genymobile/e1b10b032c650bebf8ae to your computer and use it in GitHub Desktop.
Shell script to dump current running apk to local directory
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
#!/bin/sh | |
# Simle shell script to dump the current running apk | |
# This require root adb access to the device | |
# Useful commands | |
# adb shell dumpsys activity recents | |
# adb shell dumpsys activity activities | |
# adb shell pm list package -f | |
dumpCurrentRunningApk() { | |
RUNNINGPACKAGE=$(adb shell dumpsys activity activities|grep realActivity -m 1|awk -F= '{print $2}'|awk -F/ '{print $1}') | |
echo 'current running package is' $RUNNINGPACKAGE | |
APKPATH=$(adb shell pm list package -f|grep $RUNNINGPACKAGE|awk -F: '{print $2}'|awk -F= '{print $1}') | |
echo 'apk path is' $APKPATH | |
adb pull $APKPATH . | |
} | |
echo 'Pull current running apk to local directory' | |
dumpCurrentRunningApk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment