I want to capture the network packets for a specific app on Android (4.1 or later) emulator. Since I do not know which ports the target app will open, tcpdump, wireshark may not be able to do this. iptables can make log for specific UID, while each downloaded app will associated with a unique UID during run time. However, it seems iptables cannot only log some header information of the packets. I am now thinking of using iptables to block all traffic except for the target app, and then use tcpdump to capture the packets, but the iptable on my emulator seems do not work. Someone said I need to compile and build my emulator from the source code and enable the netfilter/iptables. Does anyone know how to do this? Or is there any available emulator image I can use? If there is a better way to capture the packets for a targeted app, that would be better.
Asked
Active
Viewed 854 times
0
-
Can you be more specific in your question? Is your question about sniffing packets or about emulator rebuilding? Does [this](http://stackoverflow.com/questions/2453949/android-emulator-how-to-monitor-network-traffic/) question with answer(s) help you? – pinepain Jul 04 '14 at 18:02
-
It's about sniffing packets for specific app. TCPdump and wireshark cannot sniff for a targeted app. DO you have any solutions? On the other side, I found a potential solution using netfilter/iptables, but I don't know how to enable this tool in Android. – user3806194 Jul 06 '14 at 10:40