Wednesday, March 25, 2009

Finally tcpdump on GPhone G1 Android

Timur helped me a lot with this.

Step 1.
You need to get the tcpdump binary from here or here.
If you want to know where this binary is from, refer to Timur's post about cross-compilation.
If you don't want to bother, just download the tcpdump binary.

Step 2.
Install Android SDK in your machine.
See here for details.
They have good support for Windows, Linux and Mac.

Step 3.
Go to android-sdk-linux_x86-1.1_r1/tools
or xxx/tools depending on which build version of android you are using.
run
"sudo ./adb push ./tcpdump-arm /data/local"
You can push the tcpdump binary from your computer to the phone's directory "/data/local".
According to Timur, we can remount the gphone and make other directory writable to user "shell", however, by default, I only found "/data/local" is writable to user "shell" (maybe wrong, but at least it works)

Step.
run "sudo ./adb kill-server"
run "sudo ./adb shell"
Now you have logined into Gphone's shell command

You can see this
"
* daemon not running. starting it now *
* daemon started successfully *
$
"

Run "su"
You will see
"#" and now you are in root mode.
(Our Gphone is a holiday version which is not for sale.
For normal GPhone, I guessed, you can not enter root mode, hence not be able to run "tcpdump". For GPhone Dev version, you can definitely enter root mode)

Run
"cd /data/local"

Run
"chmod 777 tcpdump-arm"
To change the binary executable

then
run
"./tcpdump-arm"

If you see
"tcpdump: no suitable device found"
Then it means that you need to be root to run tcpdump.

Have fun dumping traffic on your GPhone Adroid

4 comments:

Istvan said...

Dear Colleague,

Have you already checked the performance of the TCPDUMP on Android?
I mean could post the CPU-percentage data during a capture?

THX

Junxian Huang said...

No, I haven't checked the performance related issues.

Android said...

Certainly, the Samsung Omnia deserves a better operating system. The current WM6.1 represents the outdated pda-orientated thinking in the mobile industry that has been all-but neglected since the the advent of the Iphone's touch-optimized UI.

Android app developer said...

Thanks for creating this interesting blog and i got a good knowledge about android. so you can create more blog with useful knowledge. Because its benefited to lots of android peoples.