日期:2014-05-16  浏览次数:20514 次

Android如何利用adb shell查看数据库的内容

>adb shell

root@android:/ # cd /data/data
cd /data/data
root@android:/data/data # ls
ls
com.android.ActivityNetwork
com.android.backupconfirm
com.android.browser
com.android.browser.tests
com.android.calculator2
com.android.calendar
com.android.calendar.tests
com.android.certinstaller
com.android.contacts
com.android.defcontainer
com.android.deskclock
com.android.development
com.android.email
com.android.exchange
com.android.galaxy4
com.android.gallery3d
com.android.htmlviewer
com.android.inputmethod.latin
com.android.keychain
com.android.launcher
com.android.magicsmoke
com.android.mms
com.android.music
com.android.musicfx
com.android.musicvis
com.android.noisefield
com.android.packageinstaller
com.android.phasebeam
com.android.phone
com.android.protips
com.android.providers.applications
com.android.providers.calendar
com.android.providers.contacts
com.android.providers.downloads
com.android.providers.downloads.ui
com.android.providers.drm
com.android.providers.media
com.android.providers.settings
com.android.providers.telephony
com.android.providers.userdictionary
com.android.provision
com.android.quicksearchbox
com.android.settings
com.android.sharedstoragebackup
com.android.simmelock
com.android.soundrecorder
com.android.stk
com.android.stk2
com.android.systemui
com.android.videoeditor
com.android.vpndialogs
com.android.wallpaper
com.android.wallpaper.holospiral
com.android.wallpaper.livepicker

比如我查看的是settings的数据库:

root@android:/data/data # cd com.android.providers.settings
cd com.android.providers.settings
root@android:/data/data/com.android.providers.settings # cd databases
cd databases
root@android:/data/data/com.android.providers.settings/databases # ls
ls(查看到有如下的数据库)
settings.db
settings.db-shm
settings.db-wal
root@android:/data/data/com.android.providers.settings/databases # sqlite3 settings.db
3 settings.db                                                                 <
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from secure;
select * from secure;
1|bluetooth_on|0
2|data_roaming|0
3|data_roaming_2|0
4|mobile_data|0
6|location_providers_allowed|
7|assisted_gps_enabled|1
8|network_preference|1
9|usb_mass_storage_enabled|1
11|wifi_networks_available_notification_on|1
12|preferred_network_mode|0
13|cdma_cell_broadcast_sms|1
14|mock_location|1
15|backup_enabled|0
16|backup_transport|android/com.android.internal.backup.LocalTransport
17|mount_play_not_snd|1
18|mount_ums_autostart|0
19|mount_ums_prompt|1
20|mount_ums_notify_enabled|1
21|accessibility_script_injection|0
22|accessibility_web_content_key_bindings|0x13=0x01000100; 0x14=0x01010100; 0x15=0x02000001; 0x16=0x02010001;
0x200000013=0x02000601; 0x200000014=0x02010601; 0x200000015=0x03020101; 0x200000016=0x03010201; 0x200000023=0x
02000301; 0x200000024=0x02010301; 0x200000037=0x03070201; 0x200000038=0x03000701:0x03010701:0x03020701