Hacking the Android Emulator from the Command Line�or �what to do when you are to cheap to pay for wi-fi in the airport.
John F. Davis
johndavi@us.ibm.com
davisjf@gmail.com
Overview
Android Emulator is a virtual device which runs on your pc
Typically used with eclipse
However, it can also be used from the command line
Here are some things you can try
Setup your Environment
echo off
set ANDHOME=c:\prg\android\android-sdk
echo ANDHOME= %ANDHOME%
set PATH=%PATH%;%ANDHOME%\platform-tools
set PATH=%PATH%;%ANDHOME%\tools
Create an Emulator
c:\users\davis> android list targets
c:\users\davis> android create avd -n emulator2.2-api-8 -t 7 -c 64M
Listing the emulators
c:\users\davis> android list avd
c:\users\davis\.android\avd
Starting the Emulator
c:\Users\davis> emulator -avd emulator2.2-api-8
c:\users\davis> adb devices
The Shell
c:\users\davis> adb -e shell
Exploring the Filesystem
# set
# ls /system/bin
# df
# dmesg
# showslab
Examine the proc filesystem
# ls /proc
# cat /proc/version
# cat /proc/cpuinfo
# cat /proc/meminfo
# cat /proc/loadavg
Examine the proc filesystem
# cat 36/cmdline
/system/bin/sh /system/etc/init.goldfish.sh
# cat init.goldfish.sh
The Accounts Database
1. Use the VM GUI to enter your account
2. Verify you can read your email
3. Use the shell to examine the accounts.db
4. How does the database store your password?
Setup a Gmail Account
Verify your Gmail Account
Locate the Account Database
This will give the sqlite database admin interface
Examine the Account Database
No leading period since this is a sql command. This works on 2.2 and 2.3.3. Not sure if it was fixed in 3.x.
*A real phone will not have permission to read this db.
Bootanimation
Bootanimation
Listing Installed Packages
List<PackageInfo> packs = theContext.getPackageManager().getInstalledPackages(0);
for(int i=0;i<packs.size();i++) {
PackageInfo p = packs.get(i);
if ((!getSysPackages) && (p.versionName == null)) {
continue ;
}
PInfo newInfo = new PInfo();
newInfo.appname = p.applicationInfo.loadLabel(
theContext.getPackageManager()).toString();
Push/Pull files and SD Card
But Can You Run from the SDCARD?
permission denied
Shows /mnt/sdcard is mounted noexec ;-(