Android Tips

When working with Android devices there are some tips and tricks that will make life a little easier.

ADB is your friend a very powerful friend and when you couple it with SU being installed it might become one of your most trusted friends.   The following commands will come in useful.

Get a list of attached devices

root@b1nn1n:~ # adb devices

You need to play around with the following ones to learn the difference

Shell, just a shell onto a connected android.  If you know the directory you can cd to it but ls does not work with this shell.

root@b1nn1n:~# adb shell

Shell with SU, you are root on the device.  Commands do no work the way they should when the shell is opened this way.

root@b1nn1n:~# adb shell su

Shell with SU that works better, ah now that is the way a shell should work.

root@b1nn1n# adb shell

shell@hammerhead:/ $ su

root@hammerhead:/ #

Most Android phones have an /sdcard/ directory even if there is no real sdcard installed.  This directory, /sdcard/, is very useful for temporary storage.  Like moving files there so they can be pulled by a simple adb pull command.

The command I like the most at the time of writing this is the following.  Yes it is the shell that does not work right as a shell but works great as a shell with a command, that is the -c

root@b1nn1n:~ # adb shell su -c “YOUR COMMAND HERE”

This makes running commands on the device very easy and allows the automation of many of the steps I perform in EVERY Android mobile application pen test.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s