Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulator: How to monitor network traffic?

People also ask

Where is network profiler Android studio?

To open any Profiler, click anywhere on its respective row, where you'll see a more detailed view. Note: For Android Studio versions 2020.3. 1+, Network Profiler has been moved to App Inspector. To open the Network Profiler, go to View > Tool Windows > App Inspection and select Network Inspector from the tabs.

How do you sniff packets on Android?

Using tPacketCapture is very easy, captured packet save into a PCAP file that can be easily analyzed by using a network protocol analyzer application such as Wireshark. You can route your android mobile traffic to PC and capture the traffic in the desktop using any network sniffing tool.

How do I install tcpdump on Android?

Since tcpdump is a command line tool, you will require terminal access on your device. There are plenty of terminal access programs for the Android. Just go to the Play Store on your device, and search for Terminal Emulator, or Shell Terminal, or Command Prompt, and this will bring you to a suitable shell prompt.


There are two ways to capture network traffic directly from an Android emulator:

  1. Copy and run an ARM-compatible tcpdump binary on the emulator, writing output to the SD card, perhaps (e.g. tcpdump -s0 -w /sdcard/emulator.cap).

  2. Run emulator -tcpdump emulator.cap -avd my_avd to write all the emulator's traffic to a local file on your PC

In both cases you can then analyse the pcap file with tcpdump or Wireshark as normal.


It is also possible to use http proxy to monitor http requests from emulator. You can pass -http-proxy flag when starting a new emulator to set proxy (Example burp) to monitor Android traffic. Example usage ./emulator -http-proxy localhost:8080 -avd android2.2. Note that in my example I'm using Burp, and it is listening port 8080. More info can be found here.


For OS X you can use Charles, it's simple and easy to use.

For more information, please have a look at Android Emulator and Charles Proxy blog post.


Yes, wireshark will work.

I don't think there is any easy way to filter out solely emulator traffic, since it is coming from the same src IP.

Perhaps the best way would be to set up a very bare VMware environment and only run the emulator in there, at least that way there wouldn't be too much background traffic.