Created
February 6, 2017 16:14
-
-
Save davethomas11/3e8a45337f7b5a41b7e52a3319f02fd2 to your computer and use it in GitHub Desktop.
Pull a database from your Android device
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/bash | |
if [ -z "$1" ]; then | |
echo "Please specify DB file name" | |
echo "usage $0 [Database File] [App Package]" | |
exit 1 | |
fi | |
if [ -z "$2" ]; then | |
echo "Please specify the package name to run as" | |
echo "usage $0 [Database File] [App Package]" | |
exit 1 | |
fi | |
devices=($(adb devices -l | sed '/List of devices/d' | awk '{print $1}')) | |
if [ ${#devices[@]} -gt 1 ]; then | |
echo "Pick device to pull db from:" | |
select device in ${devices[@]}; | |
do | |
break; | |
done | |
else | |
device=${devices[0]} | |
fi | |
adb -s $device exec-out run-as $2 cat databases/$1 > $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment