Created
January 30, 2014 11:43
-
-
Save ignasi/8706888 to your computer and use it in GitHub Desktop.
Get database from an Android app (Android 4.3+)
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 | |
# Android 4.3+ changes app's internal directory permissions and you can not just pull your | |
# databases to your computer, so I did this as a workaround to extract my databases. | |
# I only use it for debug, use it under your responsability. | |
package=$1 | |
db_name=$2 | |
path="/data/data/$package/" | |
rm $db_name | |
adb shell "su -c 'cd $path; chmod -R 777 databases; exit'; exit" | |
adb pull $path/databases/$db_name | |
open $db_name |
As always, very useful!
Good job!
Possible way around root, if the app does not have debuggable=false, is to pipe the db file contents...
package=$1
db_name=$2
adb shell "run-as $package cat databases/$db_name > /sdcard/$db_name"
adb pull /sdcard/$db_name
open $db_name
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BTW, requires root.