|
@@ -448,4 +448,19 @@ public final class HelperUtils {
|
|
|
|
|
|
return success;
|
|
|
}
|
|
|
+
|
|
|
+ public static boolean deletePort(String protocol, int From) throws IOException {
|
|
|
+ assert protocol.equals("tcp") || protocol.equals("udp");
|
|
|
+ int To = getRedirectedPort(From);
|
|
|
+ boolean success = Device.isRooted();
|
|
|
+
|
|
|
+ new ProcessBuilder("su","-c","iptables -t nat -D PREROUTING -p "+protocol+" --dport "+From+" -j REDIRECT --to-ports "+To).start();
|
|
|
+ new ProcessBuilder("su","-c","iptables -t nat -D OUTPUT -p "+protocol+" --dport "+To+" -j REDIRECT --to-ports "+From).start();
|
|
|
+
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static int getRedirectedPort(int port){
|
|
|
+ return port + 1024 + 27113;
|
|
|
+ }
|
|
|
}
|