开发者

How to use iptables in an Android application

开发者 https://www.devze.com 2023-02-04 16:04 出处:网络
How can I use iptables in an Android application? I need this for a firewall-like functionality i.e. packet filtering, blocking sites etc.

How can I use iptables in an Android application? I need this for a firewall-like functionality i.e. packet filtering, blocking sites etc.

I'm also not sure whether iptables are available in the Android kernel.

I previously heard that I'd have to create cross-compiled binaries of iptables – but how can I do that? And how can I u开发者_JAVA技巧se them in the application?


It's definitely possible. You might consider looking at the source code of Droidwall.

DroidWall - Android Firewall is a front-end application for the powerful iptables Linux firewall. It allows you to restrict which applications are permitted to access your data networks (2G/3G and/or Wi-Fi).

Check out the iptables API from Droidwall for specific examples.

Note that when using iptables you need root access to your phone.

0

精彩评论

暂无评论...
验证码 换一张
取 消