Gkapoor
Gkapoor

Reputation: 850

Android Change iptable rules in android source code

Does anybody know how to change iptables rules in android source code or android linux kernel code or android image?

I want to apply these following rules in android image

iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -P FORWARD DROP

Do i need to create any system level native app? if anybody know the answer or done anything like that please help me out.

Thanks, Gaurav

Upvotes: 2

Views: 4622

Answers (2)

Kingron
Kingron

Reputation: 11

For android 9.0. please modify the android source file: external/iptables/etc/xtables.conf Rebuild android system image.

Upvotes: 1

Joan P.S
Joan P.S

Reputation: 1573

You need to have root access and you can run the commands. Check this example code to run your commands:

https://github.com/joanpuigsanz/servdroid/blob/master/android/ServDroid.web/src/org/servDroid/util/shell/ShellCommands.java

Upvotes: 1

Related Questions