Android - Access Application's private data

      Ever wanted to check whats being stored by your favorite application? Well, one option is to root the device and get unlimited adb access to the app's private data

       adb pull /data/data/com.example.android.softkeyboard

 The package name can be found in /data/system/packages.xml

    What if the device isn't rooted? Well, there are two options provided debugger support is enabled in the device. The app should either be debuggable or should support backup (android:allowBackup). An app is debuggable if the third column in /data/system/packages.list is 1 and if it is use the following commands to run the shell commands as the app.

com.android.development_settings 10022 0 /data/data/com.android.development_settings release none
com.example.android.softkeyboard 10057 1 /data/data/com.example.android.softkeyboard default 1028,1015

     adb shell
     $ run-as com.example.android.softkeyboard
     $ cd /data/data/com.example.android.softkeyboard

  What if the file packages.list is not accessible or if the application isn't debuggable. In this case, the last resort is to backup the file and decode the contents of the backup file.

   // This should save the backup file in the host machine as backup.ab
   adb backup -noapk com.example.android.softkeyboard 

   // This command decompresses the backup file and stores the private data in an apps directory
   dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -

The only catch is that the backup generation command needs an explicit user intervention to authorize the backup operation. Make sure not to password protect the contents for the above commands to work.

No comments: