Analysis of Android network data through tcpdump packet capture

Source: Internet
Author: User
1. the mobile phone must have the root permission. 2. download tcpdumphttp: // token. 1. the mobile phone must have the root permission.
2. Download TcpdumpHttp://www.strazzere.com/android/ Tcpdump
3. adb pushc: \ wherever_you_put \ Tcpdump/Data/local/ Tcpdump
4. adb shell chmod 6755/data/local/ Tcpdump
5. adb shell and su get the root permission
6. cd/data/local
7,./tcpdump-I any-p-s 0-w/sdcard/capture. pcap
Command parameters:

# "-I any": listen onany 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 tostdout)
... Do whatever you want to capture, then ^ C to stop it...
8, adb pull/sdcard/capture. pcap d :/
9. enable capture. pcap with wireshark on the computer to analyze the log

Execute the following if you wowould like to watch packets go byrather than capturing them to a file (-n skips DNS lookups.-s 0 captures the entire packet rather than just theheader ):
Adb shell tcpdump-n-s 0 Typical tcpdump options apply. For example, if you want to seeHTTP traffic:
Only listen to http adb shell tcpdump-X-n-s 0 port 80
Based on the above information, write a bat for execution (the tcpdump file must be in the current directory ).
Start tcpdump
Adb push tcpdump/data/local/tcpdump
Adb shell chmod 6755/data/local/tcpdump
Adb shell rm-r/sdcard/capture. pcap
Adb shell/data/local/tcpdump-I any-p-s 0-w/sdcard/capture. pcap
Pause

Download the tcpdump file to your computer
Adb pull/sdcard/capture. pcap capture. pcap
Problem: some machines use the adb shell after root, which is not the root user by default. you need to enter su to switch to the root user. this will cause problems when performing batch processing. the solution is as follows:
Adb shell "su-c 'sleep 1 '"
Adb start-server
Adb push tcpdump/data/local/tcpdump

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.