Last active
December 17, 2015 02:59
Pull Android app's database file from device to computer and open. Different versions for iTerm and Terminal. You can use it by running the command line "osascript pathtoscript.scpt packagename dbfilename.db" (make an alias for it) or by setting the properties on the top of the file and saving the script as an app.
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
(* | |
Pull Android app's database file from device to computer and open. iTerm version. | |
You can use it by running the command line | |
osascript pathtoscript.scpt packagename dbfilename.db | |
(make an alias for it) or by setting the properties on the top of the file and saving as an app. | |
*) | |
property package : "pt.company.app" | |
property dbname : "databasename.db" | |
on command() | |
tell application "iTerm" | |
set mysession to (make new session at the end of sessions of first terminal) | |
tell mysession | |
exec command "login -fp carlos" | |
write text "pkill Base ; rm " & dbname | |
write text "adb shell" | |
delay 0.2 | |
write text "run-as " & package | |
delay 0.2 | |
write text "cat databases/" & dbname & " > /mnt/sdcard/" & dbname | |
delay 0.2 | |
write text "exit" | |
write text "exit" | |
delay 0.2 | |
write text "adb pull /mnt/sdcard/" & dbname & "; open " & dbname | |
delay 1 | |
end tell | |
terminate mysession | |
end tell | |
end command | |
on run argv | |
if class of argv is not script then | |
set package to item 1 of argv | |
set dbname to item 2 of argv | |
end if | |
my command() | |
end run |
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
(* | |
Pull Android app's database file from device to computer and open. Terminal version. | |
You can use it by running the command line | |
osascript pathtoscript.scpt packagename dbfilename.db | |
(make an alias for it) or by setting the properties on the top of the file and saving as an app. | |
*) | |
property package : "pt.company.app" | |
property dbname : "databasename.db" | |
on command() | |
tell application "Terminal" | |
set x to do script "pkill Base ; rm " & dbname | |
do script "adb shell" in x | |
delay 0.2 | |
do script "run-as " & package in x | |
delay 0.2 | |
do script "cat databases/" & dbname & " > /mnt/sdcard/" & dbname in x | |
delay 0.2 | |
do script "exit" in x | |
do script "exit" in x | |
delay 0.2 | |
do script "adb pull /mnt/sdcard/" & dbname & "; open " & dbname in x | |
delay 1 | |
close (first window whose selected tab is x) saving no | |
end tell | |
end command | |
on run argv | |
if class of argv is not script then | |
set package to item 1 of argv | |
set dbname to item 2 of argv | |
end if | |
my command() | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment