Android 使用 tcpdump 抓包

$ pwd
/opt/android-sdk/platform-tools

$ ll
total 20068
drwxrwxr-x 2 root root     4096 Dec 16  2011 lib/
drwxrwxr-x 4 root root     4096 Dec 16  2011 renderscript/
-rwxrwxr-x 1 root root   811728 Mar  7 15:07 aapt*
-rwxrwxr-x 1 root root   159620 Mar  7 15:07 adb*
-rwxrwxr-x 1 root root   164312 Mar  7 15:07 aidl*
-rwxrwxr-x 1 root root    97952 Mar  7 15:07 dexdump*
-rwxrwxr-x 1 root root     2603 Dec 16  2011 dx*
-rwxrwxr-x 1 root root    55776 Mar  7 15:07 fastboot*
-rwxrwxr-x 1 root root 18850844 Mar  7 15:07 llvm-rs-cc*
-rw-rw-r– 1 root root   377618 Dec 16  2011 NOTICE.txt
-rw-rw-r– 1 root root       33 Dec 16  2011 source.properties

$ ./adb devices
android
List of devices attached
????????????    no permissions

$ ./adb kill-server
$ ./adb start-server

$ ./adb devices
List of devices attached
SH0AYNX11632    device

$ ./adb  push /usr/sbin/tcpdump /system/xbin/

如果出现由于权限引起的 failed 问题:
$ ./adb  shell
shell@android:/ $ mount                                                       
rootfs / rootfs ro,relatime 0 0

/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,relatime,user_xattr,acl,barrier=1,journal_checksum,data=ordered,noauto_da_alloc 0 0
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,nosuid,nodev,relatime,user_xattr,acl,barrier=1,journal_checksum,data=ordered,noauto_da_alloc 0 0

shell@android:/ $ su
shell@android:/ #
shell@android:/ # mount -o rw,remount -t yaffs2 /dev/block/platform/msm_sdcc.1/by-name/system /system
shell@android:/ # chmod 777 /system

$ ./adb push /usr/sbin/tcpdump /system/xbin
$ ./adb shell /system/xbin/tcpdump -w /system/xbin/output

以上在小米手机上测试通过,tcpdump 很强大,屎黄色的小米实在不怎么样。