问题
I want create firewall app for Android that when an app wants to connect to internet shows app's name and let the user block it for permanent or block it temporarily or allow it and when that app wants to receive data from network shows app name and user can allow or deny it.
I viewed this question: create firewall, but it doesn't cover my needs.
Any suggestion to detect which apps have access to network and / or receive data from it?
Thanks!
回答1:
This is quite possible, and has been done before.
See these applications/implementations:
- https://github.com/ukanth/afwall
- https://code.google.com/p/iptableslog/
- https://code.google.com/p/droidwall/
- https://github.com/n8fr8/orbot
- https://github.com/Soyokaze99/VPNFirewall
Depending on implementation it may require your device to be rooted.
Universal, non-ROOT, way is to create custom VPN service and track connections using NFLOG/ULOG kernel-userspace module.
See other QAs for reference:
- Building a firewall application
- https://android.stackexchange.com/questions/34181/droidwall-firewall-app-alternative-for-non-rooted-phones
- https://android.stackexchange.com/questions/37067/allow-only-specific-apps-to-use-cell-data-only-when-on-3g
回答2:
Non-Root firewall can also be create using VPNService and a few C code to handle tcp/udp. NetGuard is a good example:
https://github.com/M66B/NetGuard
来源:https://stackoverflow.com/questions/29864196/create-interactive-firewall-app-in-android