tcpdump
A powerful command-line packet analyzer; and libpcap, a portable C/C++ library for network traffic capture.
How to sniff traffic from Android emulator
Check which AVDs are present
emulator -list-avds
Select your AVD and run (avoid this part if you are running the emulator yet)
emulator -avd <non_production_avd_name> -writable-system -no-snapshot
Install tcpdump on the Android device (download here: https://www.androidtcpdump.com/android-tcpdump/downloads)
adb root
adb remount
adb push /wherever/you/put/tcpdump /system/xbin/tcpdump
adb shell chmod 6755 /system/xbin/tcpdump
Forward an android port to host
adb forward tcp:11111 tcp:11111
Start sniff traffic with tcpdump
adb shell
tcpdump -i wlan0 -s0 -w - | nc -l -p 11111
Connect wireshark to the forwarded port via netcat
nc localhost 11111 | wireshark -k -S -i -
References
Last updated
Was this helpful?