@Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     addPreferencesFromResource(R.xml.advanced);
     if (!ShellUtils.isRooted()) {
         PreferenceCategory bypassCategoryPref = (PreferenceCategory) findPreference("Bypass");
         bypassCategoryPref.removePreference(bypassCategoryPref.findPreference("TcpScramblerEnabled"));
     }
 }
Example #2
0
 private void checkFreeInternet() {
     if (ShellUtils.isRooted()) {
         CheckFreeInternetService.execute(this);
     } else {
         if (LaunchService.isVpnRunning()) {
             onFreeInternetChanged(true);
         }
     }
 }
Example #3
0
 private String createLogFiles() {
   if (!new File(LOG_DIR).exists()) {
     new File(LOG_DIR).mkdir();
   }
   String error = "";
   try {
     ShellUtils.sudo(ShellUtils.findCommand("getprop"), ">", LOG_DIR + "/getprop.log");
   } catch (Exception e) {
     LogUtils.e("failed to execute getprop", e);
     error += "\n" + "failed to execute getprop" + "\n" + e;
   }
   try {
     ShellUtils.sudo(
         ShellUtils.findCommand("logcat"),
         "-d",
         "-v",
         "time",
         "-s",
         "fqrouter:V",
         ">",
         LOG_DIR + "/logcat.log");
   } catch (Exception e) {
     LogUtils.e("failed to execute logcat", e);
     error += "\n" + "failed to execute logcat" + "\n" + e;
   }
   try {
     ShellUtils.sudo(
         ShellUtils.findCommand("iptables"), "-L", "-v", "-n", ">", LOG_DIR + "/iptables.log");
   } catch (Exception e) {
     LogUtils.e("failed to execute iptables for filter table", e);
     error += "\n" + "failed to execute iptables for filter table" + "\n" + e;
   }
   try {
     ShellUtils.sudo(
         ShellUtils.findCommand("iptables"),
         "-t",
         "nat",
         "-L",
         "-v",
         "-n",
         ">>",
         LOG_DIR + "/iptables.log");
   } catch (Exception e) {
     LogUtils.e("failed to execute iptables for nat table", e);
     error += "\n" + "failed to execute iptables for nat table" + "\n" + e;
   }
   try {
     ShellUtils.sudo(
         "/data/data/fq.router2/busybox", "chmod", "0666", "/data/data/fq.router2/log/*.log");
   } catch (Exception e) {
     LogUtils.e("failed to change log file permission", e);
     error += "\n" + "failed to change log file permission using busybox chmod" + "\n" + e;
     try {
       ShellUtils.sudo(ShellUtils.findCommand("chmod"), "0666", "/data/data/fq.router2/log/*.log");
     } catch (Exception e2) {
       LogUtils.e("failed to change log file permission", e2);
       error += "\n" + "failed to change log file permission using system chmod" + "\n" + e2;
     }
   }
   error += copyLog("manager.log");
   error += copyLog("fqsocks.log");
   error += copyLog("fqsocks.log.1");
   error += copyLog("fqdns.log");
   error += copyLog("fqting.log");
   error += copyLog("fqlan.log");
   error += copyLog("scan.log");
   error += copyLog("wifi.log");
   error += copyLog("wifi.log.1");
   error += copyLog("current-java.log");
   error += copyLog("current-python.log");
   return error;
 }
Example #4
0
 private void checkPickAndPlay() {
     if (ShellUtils.isRooted()) {
         CheckPickAndPlayService.execute(this);
     }
 }
Example #5
0
 private void checkWifiRepeater() {
     if (ShellUtils.isRooted() && Build.VERSION.SDK_INT >= 14) {
         CheckWifiRepeaterService.execute(this);
     }
 }