Last active
December 12, 2015 02:39
-
-
Save tchn/4700996 to your computer and use it in GitHub Desktop.
[android] private-app-keeper
adb-pull apks not on the goolgle-play
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/bash | |
# | |
# 1. package list -> list private apps | |
# 2. private app list -> private app path list | |
# 3. pull all | |
# Usage: $0 <destdir> | |
set -o nounset | |
set -x | |
# global vars | |
PLAY_URL="https://play.google.com/store/apps/details?id=" | |
package_list="package-list.txt" | |
private_app_list="private-app-list.txt" | |
private_app_path_list="private-app-path-list.txt" | |
# functions | |
ls_private_apps() { | |
local appname | |
while read appname; do | |
curl "${PLAY_URL}${appname}" -I | \ | |
if egrep -i '404 not found'; then | |
echo "${appname} is not in play store"; | |
echo "$appname" >> "$private_app_list"; | |
fi | |
done < "$package_list" | |
} | |
ls_private_apppath() { | |
local appname | |
for appname in $(cat $private_app_list | tr -d '\r'); do | |
adb shell pm path "$appname" | cut -d ':' -f2 | tee -a "$private_app_path_list"; | |
done | |
} | |
get_apk() { | |
local apppath | |
for apppath in $(cat $private_app_path_list | tr -d '\r'); do | |
adb pull "$apppath" ./apps; | |
done | |
} | |
# sets params | |
destdir="$1" | |
# runs | |
if [ ! -d "$destdir" ]; then | |
mkdir -p "$destdir"; | |
fi | |
cd "$destdir" | |
adb shell pm list packages | cut -d ':' -f2 | tee "$package_list" | |
ls_private_apps; | |
ls_private_apppath; | |
mkdir apps | |
get_apk; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment