Created
November 18, 2023 16:42
-
-
Save ashdavies/c64f3bedbb421634ef00ee804dd2f95f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
if test $# -lt 1; then | |
echo "usage: apk pattern target_directory" | |
exit 1 | |
fi | |
DIR="${2:-$PWD}" | |
for ENTRY in $(adb shell pm list packages -f | grep $1); do | |
PACKAGE=$(echo $ENTRY | sed -n 's/package:\(.*\)=.*$/\1/p') | |
NAME=$(echo $ENTRY | sed -n 's/^.*apk=\(.*\).*$/\1/p') | |
echo "Saving $PACKAGE to output directory $DIR/$NAME.apk" | |
adb pull $PACKAGE $DIR/$NAME.apk | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment