Is there a way I could block a specific network port connection for a specific app in Android? My phone is rooted. I know iptables -I OUTPUT -p tcp --dport xx -j DROP
but this blocks those ports for every app. I want to block it for a single app.
Is there a way I could block a specific network port connection for a specific app in Android? My phone is rooted. I know iptables -I OUTPUT -p tcp --dport xx -j DROP
but this blocks those ports for every app. I want to block it for a single app.
You can block all TCP traffic from app with UID 10142, destined for port 53:
~# iptables -I OUTPUT -m owner --uid-owner 10142 -p tcp --dport 53 -j DROP
Change UID and port as per your needs.
Q & A