Skip to content

Instantly share code, notes, and snippets.

@Chuckytuh
Last active January 26, 2022 23:38
Show Gist options
  • Save Chuckytuh/c1e57fb73ff9d1df505346160fd4f9ef to your computer and use it in GitHub Desktop.
Save Chuckytuh/c1e57fb73ff9d1df505346160fd4f9ef to your computer and use it in GitHub Desktop.
Retrieve content of debuggable android application

Retrieve content of debuggable android application

Whenever you need to see the content of an Android application that is in debug mode and you want to do it over adb just do the following:

$ adb shell
$ run-as some.package.identifier 

This will change your prompt to be authenticated into the app space and your cwd changed to the app’s , from there you can do the typical ls, cd, etc within the app’s domain space.

If you’ve installed the application on a work profile, you first need to obtain the user id of the work profile. To do that, run:

$ adb shell pm list users

This will give you an id , for example:

UserInfo{11:Work profile:30} running

The number 11 is the “user id”, we can now use this information on the run-as command and to something like:

$ run-as some.package.identifier --user 11

Extra tip:

If you want to obtain the content of, say files directory, you can run:

$ adb exec-out run-as some.package.identifier --user 11 tar c files/ > files.tar

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment