Merge branch 'tethering'
This commit is contained in:
commit
6a4388de28
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.torproject.android" android:versionName="0.2.2.25-orbot-alpha-1.0.5.2" android:versionCode="14">
|
||||
package="org.torproject.android" android:versionName="0.2.2.25-orbot-alpha-1.0.5.3" android:versionCode="15">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
NOTE: Specific #s below correspond to Trac tickets logged and maintained at https://trac.torproject.org/projects/tor/
|
||||
|
||||
1.0.5.3
|
||||
- added auto-tor of wireless and usb tethering
|
||||
|
||||
1.0.5.1/.2
|
||||
- small updates to layout of main screen to fit smaller screens
|
||||
- fixed preference setting of EntryNode torrc value
|
||||
|
|
|
@ -7,5 +7,8 @@ RelayBandwidthRate 20 KBytes
|
|||
RelayBandwidthBurst 20 KBytes
|
||||
UseBridges 0
|
||||
AutomapHostsOnResolve 1
|
||||
TransListenAddress 0.0.0.0
|
||||
TransPort 9040
|
||||
DNSListenAddress 0.0.0.0
|
||||
DNSPort 5400
|
||||
|
||||
|
|
|
@ -131,4 +131,8 @@
|
|||
<string name="pref_start_boot_title">Start Orbot on Boot</string>
|
||||
<string name="pref_start_boot_summary">Automatically start Orbot and connect Tor when your Android device boots</string>
|
||||
|
||||
<string name="pref_transparent_tethering_title">Tor Tethering</string>
|
||||
<string name="pref_transparent_tethering_summary">Enable Tor Transparent Proxying for Wifi and USB Tethered Devices</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -39,6 +39,13 @@ android:title="Select Apps"
|
|||
android:summary="Choose Apps to Route Through Tor"
|
||||
android:enabled="true"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="pref_transparent_tethering"
|
||||
android:summary="@string/pref_transparent_tethering_summary"
|
||||
android:enabled="true"
|
||||
android:title="@string/pref_transparent_tethering_title"/>
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,37 +0,0 @@
|
|||
package org.torproject.android.boot;
|
||||
|
||||
import org.torproject.android.service.ITorService;
|
||||
import org.torproject.android.service.TorService;
|
||||
import org.torproject.android.service.TorServiceConstants;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
public class OnbootBroadcastReceiver extends BroadcastReceiver implements TorServiceConstants {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
Log.d(TAG, "received on boot notification");
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
boolean startOnBoot = prefs.getBoolean("pref_start_boot",true);
|
||||
|
||||
Log.d(TAG, "startOnBoot:" + startOnBoot);
|
||||
|
||||
if (startOnBoot)
|
||||
{
|
||||
Intent serviceIntent = new Intent(context,TorService.class);
|
||||
serviceIntent.setAction("onboot");
|
||||
context.startService(serviceIntent);
|
||||
}
|
||||
|
||||
//bindService(new Intent(ITorService.class.getName()),
|
||||
// mConnection, Context.BIND_AUTO_CREATE);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
||||
/* Copyright (c) 2009-2011, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
||||
/* See LICENSE for licensing information */
|
||||
package org.torproject.android.service;
|
||||
|
||||
|
@ -545,6 +545,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
|||
boolean enableTransparentProxy = prefs.getBoolean("pref_transparent", false);
|
||||
boolean transProxyAll = prefs.getBoolean("pref_transparent_all", false);
|
||||
boolean transProxyPortFallback = prefs.getBoolean("pref_transparent_port_fallback", false);
|
||||
boolean transProxyTethering = prefs.getBoolean("pref_transparent_tethering", false);
|
||||
|
||||
TorService.logMessage ("Transparent Proxying: " + enableTransparentProxy);
|
||||
|
||||
|
@ -581,6 +582,7 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
|||
showAlert("Status", "Setting up app-based transparent proxying...");
|
||||
code = TorTransProxy.setTransparentProxyingByApp(this,AppManager.getApps(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TorService.logMessage ("TorTransProxy resp code: " + code);
|
||||
|
@ -588,12 +590,23 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
|||
if (code == 0)
|
||||
{
|
||||
showAlert("Status", "Transparent proxying ENABLED");
|
||||
|
||||
|
||||
|
||||
if (transProxyTethering)
|
||||
{
|
||||
showAlert("Status", "TransProxy enabled for Tethering!");
|
||||
|
||||
TorTransProxy.enableTetheringRules(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showAlert("Status", "WARNING: error starting transparent proxying!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -313,14 +313,12 @@ public class TorTransProxy implements TorServiceConstants {
|
|||
return code;
|
||||
}
|
||||
|
||||
public static int enableWifiHotspotRules (Context context) throws Exception
|
||||
public static int enableTetheringRules (Context context) throws Exception
|
||||
{
|
||||
|
||||
boolean runRoot = true;
|
||||
boolean waitFor = true;
|
||||
|
||||
//redirectDNSResolvConf(); //not working yet
|
||||
|
||||
String ipTablesPath = new File(context.getDir("bin", 0),"iptables").getAbsolutePath();
|
||||
|
||||
StringBuilder script = new StringBuilder();
|
||||
|
@ -328,25 +326,24 @@ public class TorTransProxy implements TorServiceConstants {
|
|||
StringBuilder res = new StringBuilder();
|
||||
int code = -1;
|
||||
|
||||
script.append(ipTablesPath);
|
||||
script.append(" -I FORWARD");
|
||||
script.append(" -m state --state ESTABLISHED,RELATED -j ACCEPT");
|
||||
script.append(" || exit\n");
|
||||
String[] hwinterfaces = {"usb0","wl0.1"};
|
||||
|
||||
script.append(ipTablesPath);
|
||||
script.append(" -I FORWARD");
|
||||
script.append(" -j ACCEPT");
|
||||
script.append(" || exit\n");
|
||||
for (int i = 0; i < hwinterfaces.length; i++)
|
||||
{
|
||||
script.append(ipTablesPath);
|
||||
script.append(" -t nat -A PREROUTING -i ");
|
||||
script.append(hwinterfaces[i]);
|
||||
script.append(" -p udp --dport 53 -j REDIRECT --to-ports ");
|
||||
script.append(TOR_DNS_PORT);
|
||||
script.append(" || exit\n");
|
||||
|
||||
/*
|
||||
script.append(ipTablesPath);
|
||||
script.append(" -P FORWARD DROP");
|
||||
script.append(" || exit\n");
|
||||
*/
|
||||
|
||||
script.append(ipTablesPath);
|
||||
script.append(" -t nat -I POSTROUTING -j MASQUERADE");
|
||||
script.append(" || exit\n");
|
||||
script.append(ipTablesPath);
|
||||
script.append(" -t nat -A PREROUTING -i ");
|
||||
script.append(hwinterfaces[i]);
|
||||
script.append(" -p tcp -j REDIRECT --to-ports ");
|
||||
script.append(TOR_TRANSPROXY_PORT);
|
||||
script.append(" || exit\n");
|
||||
}
|
||||
|
||||
String[] cmdAdd = {script.toString()};
|
||||
|
||||
|
@ -374,8 +371,6 @@ public class TorTransProxy implements TorServiceConstants {
|
|||
|
||||
purgeIptables(context);
|
||||
|
||||
enableWifiHotspotRules(context);
|
||||
|
||||
int torUid = context.getApplicationInfo().uid;
|
||||
|
||||
// Set up port redirection
|
||||
|
|
Loading…
Reference in New Issue