如何用iptables在Android应用程序 [英] How to use iptables in an Android application

查看:520
本文介绍了如何用iptables在Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在Android应用程序中使用iptables的?我需要这样一个类似防火墙的功能,即数据包过滤,阻止网站等。

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

我也不能肯定的iptables是否在Android内核中可用。

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

我previously听说我要创建的iptables的交叉编译的二进制文件 - 但我怎么能做到这一点?我如何使用它们的应用程序?

I previously heard that I'd have to create cross-compiled binaries of iptables – but how can I do that? And how can I use them in the application?

推荐答案

这是绝对有可能。你可能会考虑看 $ C $了C Droidwall

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

DroidWall - Android的防火墙是强大的iptables的Linux防火墙前端应用程序。它可以让你来限制哪些应用程序允许访问您的数据网络(2G / 3G和/或Wi-Fi)。

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).

退房的<一个href="http://$c$c.google.com/p/droidwall/source/browse/trunk/src/com/google$c$c/droidwall/Api.java?r=148"相对=nofollow>从Droidwall 的iptables API 以具体的例子。

Check out the iptables API from Droidwall for specific examples.

请注意,当使用的iptables 需要root访问到您的手机。

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

这篇关于如何用iptables在Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆