Difference between revisions of "Talk:Android File System"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
(stock, non-rooted Android OS: new section)
Line 64: Line 64:
  
 
source: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html
 
source: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html
 +
 +
== Special directories ==
 +
 +
There are a number of directories part of the root Android file system.  Some of these directories are not entirely accessible to the the user without root permissions. 
 +
 +
=== /data/app ===
 +
 +
Say you download and install an app from Google Play store.  The "apk" is placed in the /data/app folder.  All application apk files are located in /data/app (non-system-apps) and the file names are not visible without root permission.  The file permissions on the app folder are 771 (chmod 771) meaning that only the executable flag is set for non-privileged users.  Without the read permission set, it is not possible to list the filenames in the folder, unless you have root.  The installed application apk files can be extracted if the name of the file is known. 
 +
 +
* User installed apps apk's are stored at /data/app
 +
* System apk's are stored at /system/app
 +
 +
Some workarounds to view the filenames in the /data/app folder without having root exists using "adb".  They vary depending on the Android version of your device.  It is simply so much easier if you have root access to your device.  See the discussion of this page to read about the workarounds.

Revision as of 20:41, 12 March 2014

using a "media" intermediary directory

Some people are using a "media" intermediary directory between the standard public directory and the storage root. See below

  • /sdcard/media/alarms OR /sdcard/Alarms
  • /sdcard/media/notifications OR /sdcard/notifications
  • /sdcard/media/ringtones OR /sdcard/ringtones
  • /sdcard/media/ui OR /sdcard/ui

Warning: This may be incorrect.

adb

adb is part of Android SDK

Someone claims a workaround to view the filenames in the /data/app folder without having root exists using "adb".

 adb shell pm list packages

to get a list of packages installed

However, you need to root the Android device to install Android SDK.

what?

list contents of /data/app without root

To do this from the command line, use adb shell pm list packages to get the list of installed packages, pick the desired package, append -1.apk to it, and pull it from /data/app. Example: If the package name is org.mozilla.firefox, use adb pull /data/app/org.mozilla.firefox-1.apk.

need to root first

You need to root your phone first. Then install Android SDK. run adb or ddms->file explorer, look for your interested-in APK in /system/app

backup then view

You can use a file browser with an backup function, for example the ES File Explorer Long tap a item and select create backup

stock, non-rooted Android OS

If the application, whose data you wish to access, is debuggable, its read-protected folder can be accessed with the help of the run-as command. In essence, we pretend to be the application in question and copy file(s) stored inside the application's data folder into user readable folder.

adb shell
run-as app.package.name \
cp /data/data/package.name/databases/application.sqlite /sdcard/
exit
adb pull /sdcard/application.sqlite ~/

This only works if the application is debuggable. If the application was not debuggable, so the method above did not work either.

Starting with Android v4.0 (Ice Cream Sandwich) Google has provided a way to backup data and applications from Android devices without root via adb.

adb backup -f ~/data.ab -noapk app.package.name

This will prompt you to "unlock your device and confirm the backup operation". To keep things simple do not provide a password, otherwise you will have to jump through the hoops to decrypt it later. Just click on "Back up my data" button. The screen will display the name of the package you're backing up, then close by itself upon successful completion.

The resulting ".ab" file contains application data in android backup format. It's a tar archive that has been run through deflate and optionally encrypted (in a somewhat peculiar way) by AES-256-CRC cypher. To quickly extract a simple non-encrypted backup...

dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf -

If that doesn't work, try this alternative using Python

dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -

The result is the apps/app.package.name/ folder containing application data.

source: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html

Special directories

There are a number of directories part of the root Android file system. Some of these directories are not entirely accessible to the the user without root permissions.

/data/app

Say you download and install an app from Google Play store. The "apk" is placed in the /data/app folder. All application apk files are located in /data/app (non-system-apps) and the file names are not visible without root permission. The file permissions on the app folder are 771 (chmod 771) meaning that only the executable flag is set for non-privileged users. Without the read permission set, it is not possible to list the filenames in the folder, unless you have root. The installed application apk files can be extracted if the name of the file is known.

  • User installed apps apk's are stored at /data/app
  • System apk's are stored at /system/app

Some workarounds to view the filenames in the /data/app folder without having root exists using "adb". They vary depending on the Android version of your device. It is simply so much easier if you have root access to your device. See the discussion of this page to read about the workarounds.