Wednesday, June 29, 2016

Adding SQLite3 Binary on ROOTED Android (Advanced Mode)

Download SQLite3 binary from here, if you want another source to install SQLite3 with more simple step, then you may follow this instructions.

Info :
My android ip : 192.168.100.6
Downloaded sqlite3 binary location : /sdcard/Download/

1. In this step i'm using WIFI ADB (install it from Google Playstore).
2. install latest adb from here or here
3. start connect to your android device using adb command:
D:\tmp\adb connect 192.168.100.6:5555
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 192.168.100.6:5555

go to android shell
D:\tmp\adb shell

Become root
shell@android:/ $ su

mount system to allow read and write
root@android:/ # mount -o remount,rw /system

go to your place where you save sqlite3 binary, in this case i'm saving at sdcard/Download/
root@android:/ # cd sdcard/Download/
root@android:/ # ls sqlite3
sqlite3

copy sqlite3 binary into your /system/xbin/
root@android:/sdcard/Download # cp sqlite3 /system/xbin/
root@android:/sdcard/Download # ls -al /system/xbin/sqlite3
----rwxr-x root     root       868952 2016-06-29 11:26 sqlite3

make your sqlite3 binary become executable
root@android:/sdcard/Download # chmod 755 /system/xbin/sqlite3

Now lets mount back /system/ as read only (ro)
root@android:/ # mount -o remount,ro /system

Now run your sqlite3 from command shell, and try to query database inside your android
root@android:/storage/sdcard0 # sqlite3 /data/data/jp.naver.line.android/databases/naver_line
SQLite version 3.8.11.1 2015-07-29 20:00:57
Enter ".help" for usage hints.
sqlite> .tables
android_metadata       group_home             sns_friends
chat                   groups                 sticker
chat_history           membership             sticker_package
chat_member            more_menu_item_status  sticon_packages
chat_notification      my_theme               sticons
contacts               permanent_tasks        version
email_recommend        product
esk_history            setting
sqlite> SELECT * FROM setting;
AU_SMART_PASS_AGREEMENT|1
AU_SMART_PASS_FUNC_ACTIVATE|1
CHANNEL_ENCRYPTED|1
USER_STATUS_ACCESS_MOBILE_NETWORK_TIMESTAMP|1467159063483
APP_CURRENT_VERSION|15060403_6.4.1
APP_INIT|true
USER_STATUS_LAST_FOREGROUND_TIMESTAMP|1467164323745
MAT_INITIALIZED|1
APP_TIMELINE_TAB_BADGECOUNT|0
...
sqlite>

Done

Adding SQLite3 Binary on ROOTED Android (Simple Mode)

Some devices come with luxury binary, but some lacking that luxury item, but as we are love to hack android it doesn't matter anymore, in this little post, i will show you how to insert SQLite3 binary into our system.

Okay, now follow the instructions below, if you like using adb command then you can read advanced mode.

1. Download SQLite3 binary from here or here or here
2. Install any File manager with ROOT Capability like Root Explorer or Root Browser
3. Copy SQLite3 binary into /system/xbin/sqlite3
4. Chmod 0755 /system/xbin/sqlite3, you can do this inside Root Explorer or Root Browser


5. Done

Example shell output from sqlite3
root@android:/storage/sdcard0 # sqlite3 --help
Usage: sqlite3 [OPTIONS] FILENAME [SQL]
FILENAME is the name of an SQLite database. A new database is created
if the file does not previously exist.
OPTIONS include:
   -ascii               set output mode to 'ascii'
   -bail                stop after hitting an error
   -batch               force batch I/O
   -column              set output mode to 'column'
   -cmd COMMAND         run "COMMAND" before reading stdin
   -csv                 set output mode to 'csv'
   -echo                print commands before execution
   -init FILENAME       read/process named file
   -[no]header          turn headers on or off
   -help                show this message
   -html                set output mode to HTML
   -interactive         force interactive I/O
   -line                set output mode to 'line'
   -list                set output mode to 'list'
   -lookaside SIZE N    use N entries of SZ bytes for lookaside memory
   -mmap N              default mmap size set to N
   -newline SEP         set output row separator. Default: '\n'
   -nullvalue TEXT      set text string for NULL values. Default ''
   -pagecache SIZE N    use N slots of SZ bytes each for page cache memory
   -scratch SIZE N      use N slots of SZ bytes each for scratch memory
   -separator SEP       set output column separator. Default: '|'
   -stats               print memory stats before each finalize
   -version             show SQLite version
   -vfs NAME            use NAME as the default VFS
1|root@android:/storage/sdcard0 # sqlite3 -version
3.8.11.1 2015-07-29 20:00:57 cf538e2783e468bbc25e7cb2a9ee64d3e0e80b2f

Another source for SQLite3 you may interesting:
sqlite3-android
sqlite3
forum.xda-developers