Code Monkey home page Code Monkey logo

adb-export's Introduction

adb-export

Bash script that exports content provider's data to raw and CSV format. It can be your own content provider or any other provider that android decided not to block with permissions (and this is the funny part)

Getting started

First, clone the repository using git (recommended):

git clone https://github.com/sromku/adb-export/

or download the script manually using this command:

curl "https://raw.githubusercontent.com/sromku/adb-export/master/adb-export.sh" -o adb-export.sh

Then give the execution permission to the script and run it:

$ chmod +x adb-export.sh
$ ./adb-export.sh

Usage

Enable Developer options on the device

  • -e [uri] - Set your provider URI and Export the data to CSV

Example:

./adb-export.sh -e content://com.your.app/images

Example:

./adb-export.sh -e content://com.android.calendar/calendars

Output

The exported data will be in a new created folders with timestamps in the same root folder this script is located. You will find two new created files:

  • raw_query.txt - this is what we exported from device
  • data.csv - this is what you need

The funny part - no permissions ๐Ÿ”“

There is a list of some android content providers that don't block the adb query. My expectation was that it wouldn't be possible because of lack of provider permissions. Just to be on the safe side, I opened a security vulnarability issue to Security Google Team and got few replies where the last one says that this is not a security hole.

Just an example:

  • This one won't work: content://sms
    The result will be: requires android.permission.READ_SMS

  • This will work: content://com.android.contacts/contacts
    The result: CSV with all contacts
    Which, btw, should also check for permissions, but it doesn't. ๐Ÿ˜ฎ

Android content providers URIs ๐Ÿ”“

If you discover some new that work, add them here

Calendar

Contacts

Media

the extrnal in the uri, you can also change to internal

Settings

Other

Tested Environments (meanwhile)

  • MacOSX

If you have successfully tested this script on others systems or platforms please let me know or update this list.

Important things to know

  • Any commas in imported values are replaced to " " (space) char, since they don't play well in CSV format. You can configure it by changing REPLACE_VALUE_COMMAS_TO variable in the script.
  • The table schema of the same android content provider on different devices can be different, thus the parsing steps try to understand what is the column and what is the value.
  • This is the first version, and if you find bad parsing outputs, please open an issue.
  • Use it only for good purposes!

License

Apache License 2.0

adb-export's People

Contributors

sromku avatar

Watchers

Michael jentsch avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.