adb-export


Source link: https://github.com/sromku/adb-export

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 content provider that isn't blocked with permissions.

Getting started

First, clone the repository using git:

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

or download the script manually using this command:

curl "https://raw.githubusercontent.com/snatik/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

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

  • content://com.android.calendar/calendars
  • content://com.android.calendar/events
  • content://com.android.calendar/attendees
  • content://com.android.calendar/reminders
  • content://com.android.calendar/extendedproperties

Contacts

  • content://com.android.contacts/contacts
  • content://com.android.contacts/directories
  • content://com.android.contacts/deleted_contacts
  • content://com.android.contacts/raw_contacts
  • content://com.android.contacts/data
  • content://com.android.contacts/data/phones
  • content://com.android.contacts/raw_contact_entities
  • content://com.android.contacts/status_updates
  • content://com.android.contacts/groups
  • content://com.android.contacts/aggregation_exceptions
  • content://com.android.contacts/photo_dimensions

Media

  • content://media/external/images/media
  • content://media/external/images/thumbnails
  • content://media/external/audio/media
  • content://media/external/audio/genres
  • content://media/external/audio/playlists
  • content://media/external/audio/artists
  • content://media/external/audio/albums
  • content://media/external/video/media
  • content://media/external/video/thumbnails

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

Settings

  • content://settings/system
  • content://settings/secure
  • content://settings/global
  • content://settings/bookmarks

Other

  • content://user_dictionary/words

Tested Environments

  • MacOSX
  • Ubuntu 14.10 (Utopic). Run sudo apt-get install android-tools-adb first

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

See LICENSE for details.

Follow us

Resources

Chain of Command with background foreground options. Chains can be pre-constructed, and reused any number of times. Individual commands can be written as lambdas, or as classes.

Binds views and resources easily. Really easily. Everywhere.

The Shared Memory library allows for the creation of memory regions that may be simultaneously accessed by multiple Android processes or applications. Developed to overcome the Android 1MB IPC limitation, this Shared Memory library allows you to exchange larger amounts of data between your Android applications.

The missing library manager for Android Developers.

This project allows you to create a custom Toast in android in simplest way.

A layout that arranges other views in a circle.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes