Loading orbotservice/src/main/java/org/torproject/android/service/TorService.java +18 −14 Original line number Diff line number Diff line Loading @@ -805,8 +805,9 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon } private boolean flushTransparentProxyRules () { if (Prefs.useRoot()) { try { if (Prefs.useRoot()) { if (mTransProxy == null) mTransProxy = new TorTransProxy(this, fileXtables); Loading @@ -818,8 +819,11 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon } return true; } else { return false; } else } catch (IOException ioe) { return false; } Loading orbotservice/src/main/java/org/torproject/android/service/transproxy/TorTransProxy.java +33 −10 Original line number Diff line number Diff line package org.torproject.android.service.transproxy; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; Loading Loading @@ -30,10 +32,25 @@ public class TorTransProxy implements TorServiceConstants { private int mTransProxyPort = TOR_TRANSPROXY_PORT_DEFAULT; private int mDNSPort = TOR_DNS_PORT_DEFAULT; public TorTransProxy (TorService torService, File fileXTables) private Process mProcess = null; private DataOutputStream mProcessOutput = null; public TorTransProxy (TorService torService, File fileXTables) throws IOException { mTorService = torService; mFileXtables = fileXTables; mProcess = Runtime.getRuntime().exec("su"); mProcessOutput = new DataOutputStream(mProcess.getOutputStream()); } public static boolean testRoot () throws IOException { Runtime.getRuntime().exec("su"); return true; } public void setTransProxyPort (int transProxyPort) Loading Loading @@ -545,15 +562,21 @@ public class TorTransProxy implements TorServiceConstants { private int executeCommand (String cmdString) throws Exception { Process proc = Runtime.getRuntime().exec(cmdString); proc.waitFor(); int exitCode = proc.exitValue(); //String output = cmd.getOutput(); mProcessOutput.writeBytes(cmdString + "\n"); mProcessOutput.flush(); logMessage(cmdString); return 0; } public int doExit () throws Exception { mProcessOutput.writeBytes("exit\n"); mProcessOutput.flush(); logMessage(cmdString + "; exit=" + exitCode); return mProcess.waitFor(); return exitCode; } Loading Loading
orbotservice/src/main/java/org/torproject/android/service/TorService.java +18 −14 Original line number Diff line number Diff line Loading @@ -805,8 +805,9 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon } private boolean flushTransparentProxyRules () { if (Prefs.useRoot()) { try { if (Prefs.useRoot()) { if (mTransProxy == null) mTransProxy = new TorTransProxy(this, fileXtables); Loading @@ -818,8 +819,11 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon } return true; } else { return false; } else } catch (IOException ioe) { return false; } Loading
orbotservice/src/main/java/org/torproject/android/service/transproxy/TorTransProxy.java +33 −10 Original line number Diff line number Diff line package org.torproject.android.service.transproxy; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; Loading Loading @@ -30,10 +32,25 @@ public class TorTransProxy implements TorServiceConstants { private int mTransProxyPort = TOR_TRANSPROXY_PORT_DEFAULT; private int mDNSPort = TOR_DNS_PORT_DEFAULT; public TorTransProxy (TorService torService, File fileXTables) private Process mProcess = null; private DataOutputStream mProcessOutput = null; public TorTransProxy (TorService torService, File fileXTables) throws IOException { mTorService = torService; mFileXtables = fileXTables; mProcess = Runtime.getRuntime().exec("su"); mProcessOutput = new DataOutputStream(mProcess.getOutputStream()); } public static boolean testRoot () throws IOException { Runtime.getRuntime().exec("su"); return true; } public void setTransProxyPort (int transProxyPort) Loading Loading @@ -545,15 +562,21 @@ public class TorTransProxy implements TorServiceConstants { private int executeCommand (String cmdString) throws Exception { Process proc = Runtime.getRuntime().exec(cmdString); proc.waitFor(); int exitCode = proc.exitValue(); //String output = cmd.getOutput(); mProcessOutput.writeBytes(cmdString + "\n"); mProcessOutput.flush(); logMessage(cmdString); return 0; } public int doExit () throws Exception { mProcessOutput.writeBytes("exit\n"); mProcessOutput.flush(); logMessage(cmdString + "; exit=" + exitCode); return mProcess.waitFor(); return exitCode; } Loading