在 root 的 xoom(android 3 honeycomb)上运行 iptables
我正在尝试添加一些规则来使用 iptables 过滤来自/到设备(Xoom WiFi)的网络流量。 iptables 命令位于运行 android 3.0.1 的 xoom 设备中的 /system/bin/iptables。我正在使用 adb shell 添加规则。但是我似乎无法通过 Android 应用程序执行相同的操作。
使用 SU
(su -c 命令
)。 Xoom 已扎根。并且 iptables 已通过超级用户应用程序被授予 su 权限(最新版本,最新的 su 二进制文件):
iptables
07-18 09:00:32.990: DEBUG/su(17539): 10054 com.iptables 执行 0 /system/bin/iptables 使用 shell /system/bin/sh : sh 07-18 09:00:33.010:WARN/su(17546):请求被拒绝(0->0 /系统/bin/iptables)
chown
07-18 09:02:21.380: WARN/su(17594): 请求被拒绝 (0->0 /系统/bin/chmod)
没有 SU
iptables
没有输出。什么也没发生。不会添加规则。
乔恩
没有输出。按预期工作!?!.
我如何运行 iptables 命令:
runCommand(new String[] { "su", "-c", "/system/bin/iptables", "-F" });
runCommand(new String[] { "su", "-c", "/system/bin/iptables", "-A", "OUTPUT", "-d", "184.72.45.145", "-j", "ACCEPT" });
运行命令的方法:
public static String runCommand(String[] ars) {
try {
Process p = Runtime.getRuntime().exec(ars);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(p.getInputStream()));
StringBuffer buffer = new StringBuffer();
String sCurrentLine;
while ((sCurrentLine = bufferedReader.readLine()) != null) {
buffer.append(sCurrentLine);
}
return buffer.toString();
} catch (IOException e) {
e.printStackTrace();
return "ERROR";
}
}
有什么想法吗?我正在碰壁。非常感谢任何帮助。谢谢!
I am trying to add some rules to filter network traffic from/to the device (Xoom WiFi) using iptables. The iptables command is located at /system/bin/iptables in the xoom device running android 3.0.1. I am abel add rules using the adb shell. However i can't seem to do the same through a android app.
With SU
(su -c command
). The Xoom has been rooted. And iptables has been granted su permissions thougth the Superuser app(latest version, uptodate su binary):
iptables
07-18 09:00:32.990: DEBUG/su(17539): 10054 com.iptables executing 0
/system/bin/iptables using shell /system/bin/sh : sh 07-18
09:00:33.010: WARN/su(17546): request rejected (0->0
/system/bin/iptables)
chown
07-18 09:02:21.380: WARN/su(17594): request rejected (0->0
/system/bin/chmod)
Without SU
iptables
no output. nothing happens. rules don't get added.
chown
no output. works as expected!?!.
How i run the iptables command:
runCommand(new String[] { "su", "-c", "/system/bin/iptables", "-F" });
runCommand(new String[] { "su", "-c", "/system/bin/iptables", "-A", "OUTPUT", "-d", "184.72.45.145", "-j", "ACCEPT" });
The method for running a command:
public static String runCommand(String[] ars) {
try {
Process p = Runtime.getRuntime().exec(ars);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(p.getInputStream()));
StringBuffer buffer = new StringBuffer();
String sCurrentLine;
while ((sCurrentLine = bufferedReader.readLine()) != null) {
buffer.append(sCurrentLine);
}
return buffer.toString();
} catch (IOException e) {
e.printStackTrace();
return "ERROR";
}
}
Any ideas? I am hitting a wall. Any help highly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论