Skip to content

Instantly share code, notes, and snippets.

@pietrocaselani
Created October 6, 2015 11:26
Show Gist options
  • Save pietrocaselani/327c3bb5521e7fb9a6fa to your computer and use it in GitHub Desktop.
Save pietrocaselani/327c3bb5521e7fb9a6fa to your computer and use it in GitHub Desktop.
Get Android database from device
#!/bin/bash
PKG=$1
DB=$2
adb shell "run-as $PKG chmod 755 /data/data/$PKG/databases"
adb shell "run-as $PKG chmod 666 /data/data/$PKG/databases/$DB"
adb shell "rm /sdcard/$DB"
adb shell "cp /data/data/$PKG/databases/$DB /sdcard/$DB"
rm -f /tmp/${DB}
adb pull /sdcard/${DB} /tmp/${DB}
open /tmp/${DB}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment