Linux uses tcpdump to capture android network data packets

Source: Internet
Author: User
Capturing the network package of a mobile phone is something that programmers often need to do. But the path to packet capture is not that smooth. Three tools are required for network packet capture on the mobile phone: 1.ADB: usually get from AndroidSDK. 2. root tool: psneuter3.tcpdump: The network packet capture tool wants to capture packets. the following steps are generally used. 1. get the root permission: using psn to capture the network package of a mobile phone is something that programmers often need to do. But the path to packet capture is not that smooth.
Mobile network packet capture requires three tools:

1. ADB: generally obtained from the Android SDK
2. root tool: psneuter
3. Tcpdump: Network packet capture tool

To capture packets, follow these steps.
1. get the root permission:
Use psneuter. Actually, there are four steps.
Step 1: decompress psneuter.zip
Step 2: Copy the extracted psneuter to your mobile phone. Generally, use/data/local/tmp. of course, it can also be Sdcard, depending on your needs.
Step 3: Add operation permissions for psneuter. It is easy to use chmod 777. if you want to know the specific chmod authorization method, you can view the linux manual. 777 is the maximum permission and the least security permission, but it doesn't matter.
Step 4: run psneuter to obtain the root permission
The following is the sample code:
Adb push/data/local/tmp/
Adb shell $ chmod 777/data/local/tmp/psneuter
$/Data/local/tmp/psneuter
$ Exit
Adb shell
#
2. packet capture: it is easier to capture packets.
Step 1: copy tcpdump to your mobile phone
Step 2: authorize chmod 777 to tcpdump <文件路径 tcpdump>

Step 3: Use tcpdump to capture packets and view the package content
The following is the sample code:

Adb push /Data/local/tmp
Adb shell
# Chmod 777/data/local/tmp/tcpdump
#/Data/local/tmp/tcpdump-A-n-s 1024
OK. We can analyze the captured package.
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.