Android uses tcpdump to capture packets

Source: Internet
Author: User
Tags root access

Android uses tcpdump to capture packets

    Http://mysuperbaby.iteye.com/blog/902201

    Blog type:

  • Android
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

  1. ADB Root
  2. ADB remount
  3. ADB push/wherever/you/Put/tcpdump/system/xbin/tcpdump
  4. 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

  1. ADB shell tcpdump-I any-p-S 0-W/sdcard/capture. pcap
  2. # "-I any": Listen on any network interface
  3. # "-P": Disable promiscuous mode (doesn' t work anyway)
  4. # "-S 0": capture the entire packet
  5. # "-W": Write packets to a file (rather than printing to stdout)
  6. ... Do whatever you want to capture, then ^ C to stop it...
  7. ADB pull/sdcard/capture. pcap.
  8. Sudo apt-Get install Wireshark # Or ethereal, if you're still on dapper
  9. Wireshark capture. pcap # or Ethereal
  10. ... 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

  1. 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

  1. ADB shell tcpdump-X-n-s 0 Port
    80
ADB shell tcpdump-X-n-s 0 port 80

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.