Android uses tcpdump to capture packets
Androidaccessgohtml
Instructions
Http://source.android.com/porting/tcpdump.html
Source code and documents ents
Http://www.tcpdump.org/
Compiled Binary Download
Http://www.strazzere.com/android/tcpdump
Wireshark
Http://www.wireshark.org/download.html
Installing tcpdump
Pushing the binary to an existing device
Download tcpdump from http://www.tcpdump.org/, then execute: cmd code
- ADB Root
- ADB remount
- ADB push/wherever/you/Put/tcpdump/system/xbin/tcpdump
- ADB shell chmod 6755/data/local/tmp/tcpdump
ADB rootadb remountadb push/wherever/you/Put/tcpdump/system/xbin/tcpdumpadb shell chmod 6755/data/local/tmp/tcpdump
Running tcpdump
You need to have root access on your device.
Batch mode capture
The typical procedure is to capture packets to a file and then examine the file on the desktop, as your strated below: cmd code
- ADB shell tcpdump-I any-p-S 0-W/sdcard/capture. pcap
- # "-I any": Listen on any network interface
- # "-P": Disable promiscuous mode (doesn' t work anyway)
- # "-S 0": capture the entire packet
- # "-W": Write packets to a file (rather than printing to stdout)
- ... Do whatever you want to capture, then ^ C to stop it...
- ADB pull/sdcard/capture. pcap.
- Sudo apt-Get install Wireshark # Or ethereal, if you're still on dapper
- Wireshark capture. pcap # or Ethereal
- ... Look at your packets and be wise...
ADB shell tcpdump-I any-p-S 0-W/sdcard/capture. pcap # "-I any": Listen on any network interface # "-P": Disable promiscuous mode (doesn't work anyway) # "-S 0 ": capture the entire packet # "-W": Write packets to a file (rather than printing to stdout )... do whatever you want to capture, then ^ C to stop it... ADB pull/sdcard/capture. pcap. sudo apt-Get install Wireshark # Or ethereal, If you're still on dapperwireshark capture. pcap # Or ethereal... look at your packets and be wise...
You can run tcpdump in the background from an interactive shell or from terminal. by default, tcpdump captures all traffic without filtering. if you prefer, add an expression like port 80 to the tcpdump command line.
Real Time packet monitoring
Execute the following if you wowould like to watch packets go by rather than capturing them to a file (-N skips DNS lookups. -S 0 captures the entire packet rather than just the header): cmd code
- ADB shell tcpdump-n-s 0
ADB shell tcpdump-n-s 0
Typical tcpdump options apply. For example, if you want to see http traffic: cmd code
- ADB shell tcpdump-X-n-s 0 Port
80
ADB shell tcpdump-X-n-s 0 port 80