Merge branch 'tethering'
This commit is contained in:
commit
6a4388de28
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<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.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
<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/
|
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
|
1.0.5.1/.2
|
||||||
- small updates to layout of main screen to fit smaller screens
|
- small updates to layout of main screen to fit smaller screens
|
||||||
- fixed preference setting of EntryNode torrc value
|
- fixed preference setting of EntryNode torrc value
|
||||||
|
|
|
@ -7,5 +7,8 @@ RelayBandwidthRate 20 KBytes
|
||||||
RelayBandwidthBurst 20 KBytes
|
RelayBandwidthBurst 20 KBytes
|
||||||
UseBridges 0
|
UseBridges 0
|
||||||
AutomapHostsOnResolve 1
|
AutomapHostsOnResolve 1
|
||||||
|
TransListenAddress 0.0.0.0
|
||||||
TransPort 9040
|
TransPort 9040
|
||||||
|
DNSListenAddress 0.0.0.0
|
||||||
DNSPort 5400
|
DNSPort 5400
|
||||||
|
|
||||||
|
|
|
@ -131,4 +131,8 @@
|
||||||
<string name="pref_start_boot_title">Start Orbot on Boot</string>
|
<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_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>
|
</resources>
|
||||||
|
|
|
@ -39,6 +39,13 @@ android:title="Select Apps"
|
||||||
android:summary="Choose Apps to Route Through Tor"
|
android:summary="Choose Apps to Route Through Tor"
|
||||||
android:enabled="true"/>
|
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>
|
</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 */
|
/* See LICENSE for licensing information */
|
||||||
package org.torproject.android.service;
|
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 enableTransparentProxy = prefs.getBoolean("pref_transparent", false);
|
||||||
boolean transProxyAll = prefs.getBoolean("pref_transparent_all", false);
|
boolean transProxyAll = prefs.getBoolean("pref_transparent_all", false);
|
||||||
boolean transProxyPortFallback = prefs.getBoolean("pref_transparent_port_fallback", false);
|
boolean transProxyPortFallback = prefs.getBoolean("pref_transparent_port_fallback", false);
|
||||||
|
boolean transProxyTethering = prefs.getBoolean("pref_transparent_tethering", false);
|
||||||
|
|
||||||
TorService.logMessage ("Transparent Proxying: " + enableTransparentProxy);
|
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...");
|
showAlert("Status", "Setting up app-based transparent proxying...");
|
||||||
code = TorTransProxy.setTransparentProxyingByApp(this,AppManager.getApps(this));
|
code = TorTransProxy.setTransparentProxyingByApp(this,AppManager.getApps(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TorService.logMessage ("TorTransProxy resp code: " + code);
|
TorService.logMessage ("TorTransProxy resp code: " + code);
|
||||||
|
@ -588,11 +590,22 @@ public class TorService extends Service implements TorServiceConstants, Runnable
|
||||||
if (code == 0)
|
if (code == 0)
|
||||||
{
|
{
|
||||||
showAlert("Status", "Transparent proxying ENABLED");
|
showAlert("Status", "Transparent proxying ENABLED");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (transProxyTethering)
|
||||||
|
{
|
||||||
|
showAlert("Status", "TransProxy enabled for Tethering!");
|
||||||
|
|
||||||
|
TorTransProxy.enableTetheringRules(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showAlert("Status", "WARNING: error starting transparent proxying!");
|
showAlert("Status", "WARNING: error starting transparent proxying!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -313,14 +313,12 @@ public class TorTransProxy implements TorServiceConstants {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int enableWifiHotspotRules (Context context) throws Exception
|
public static int enableTetheringRules (Context context) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
boolean runRoot = true;
|
boolean runRoot = true;
|
||||||
boolean waitFor = true;
|
boolean waitFor = true;
|
||||||
|
|
||||||
//redirectDNSResolvConf(); //not working yet
|
|
||||||
|
|
||||||
String ipTablesPath = new File(context.getDir("bin", 0),"iptables").getAbsolutePath();
|
String ipTablesPath = new File(context.getDir("bin", 0),"iptables").getAbsolutePath();
|
||||||
|
|
||||||
StringBuilder script = new StringBuilder();
|
StringBuilder script = new StringBuilder();
|
||||||
|
@ -328,25 +326,24 @@ public class TorTransProxy implements TorServiceConstants {
|
||||||
StringBuilder res = new StringBuilder();
|
StringBuilder res = new StringBuilder();
|
||||||
int code = -1;
|
int code = -1;
|
||||||
|
|
||||||
script.append(ipTablesPath);
|
String[] hwinterfaces = {"usb0","wl0.1"};
|
||||||
script.append(" -I FORWARD");
|
|
||||||
script.append(" -m state --state ESTABLISHED,RELATED -j ACCEPT");
|
for (int i = 0; i < hwinterfaces.length; i++)
|
||||||
script.append(" || exit\n");
|
{
|
||||||
|
script.append(ipTablesPath);
|
||||||
script.append(ipTablesPath);
|
script.append(" -t nat -A PREROUTING -i ");
|
||||||
script.append(" -I FORWARD");
|
script.append(hwinterfaces[i]);
|
||||||
script.append(" -j ACCEPT");
|
script.append(" -p udp --dport 53 -j REDIRECT --to-ports ");
|
||||||
script.append(" || exit\n");
|
script.append(TOR_DNS_PORT);
|
||||||
|
script.append(" || exit\n");
|
||||||
/*
|
|
||||||
script.append(ipTablesPath);
|
script.append(ipTablesPath);
|
||||||
script.append(" -P FORWARD DROP");
|
script.append(" -t nat -A PREROUTING -i ");
|
||||||
script.append(" || exit\n");
|
script.append(hwinterfaces[i]);
|
||||||
*/
|
script.append(" -p tcp -j REDIRECT --to-ports ");
|
||||||
|
script.append(TOR_TRANSPROXY_PORT);
|
||||||
script.append(ipTablesPath);
|
script.append(" || exit\n");
|
||||||
script.append(" -t nat -I POSTROUTING -j MASQUERADE");
|
}
|
||||||
script.append(" || exit\n");
|
|
||||||
|
|
||||||
String[] cmdAdd = {script.toString()};
|
String[] cmdAdd = {script.toString()};
|
||||||
|
|
||||||
|
@ -374,8 +371,6 @@ public class TorTransProxy implements TorServiceConstants {
|
||||||
|
|
||||||
purgeIptables(context);
|
purgeIptables(context);
|
||||||
|
|
||||||
enableWifiHotspotRules(context);
|
|
||||||
|
|
||||||
int torUid = context.getApplicationInfo().uid;
|
int torUid = context.getApplicationInfo().uid;
|
||||||
|
|
||||||
// Set up port redirection
|
// Set up port redirection
|
||||||
|
|
Loading…
Reference in New Issue