vpn changes
This commit is contained in:
parent
09bdd8fd29
commit
21b75b4c56
16
.project
16
.project
|
@ -5,6 +5,12 @@
|
|||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
|
@ -30,10 +36,20 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
|
@ -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"
|
||||
package="org.sandroproxy.ony"
|
||||
android:versionName="14.1.4-noPIE"
|
||||
android:versionCode="132"
|
||||
android:installLocation="auto"
|
||||
|
@ -15,7 +15,7 @@
|
|||
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
|
||||
<uses-permission android:name="org.torproject.android.MANAGE_TOR"/>
|
||||
|
||||
<application android:name=".OrbotApp" android:icon="@drawable/ic_launcher"
|
||||
<application android:name="org.sandroproxy.ony.OrbotApp" android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:description="@string/app_description"
|
||||
android:configChanges="locale|orientation|screenSize"
|
||||
|
@ -27,7 +27,7 @@
|
|||
android:largeHeap="false"
|
||||
>
|
||||
|
||||
<activity android:name=".Orbot"
|
||||
<activity android:name="org.torproject.android.Orbot"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:excludeFromRecents="true"
|
||||
android:launchMode="singleTop"
|
||||
|
@ -77,7 +77,7 @@
|
|||
<activity android:name=".OrbotDiagnosticsActivity" android:label="OrbotDiag"/>
|
||||
-->
|
||||
<activity
|
||||
android:name=".service.DummyActivity"
|
||||
android:name="org.torproject.android.service.DummyActivity"
|
||||
android:theme="@android:style/Theme.NoDisplay"
|
||||
android:enabled="true"
|
||||
android:allowTaskReparenting="true"
|
||||
|
@ -90,17 +90,17 @@
|
|||
/>
|
||||
|
||||
|
||||
<activity android:name=".wizard.LotsaText" android:exported="false"/>
|
||||
<activity android:name=".wizard.Permissions" android:exported="false"/>
|
||||
<activity android:name=".wizard.TipsAndTricks" android:exported="false"/>
|
||||
<activity android:name=".wizard.ConfigureTransProxy" android:exported="false"/>
|
||||
<activity android:name=".wizard.ChooseLocaleWizardActivity" android:exported="false"/>
|
||||
<activity android:name="org.torproject.android.wizard.LotsaText" android:exported="false"/>
|
||||
<activity android:name="org.torproject.android.wizard.Permissions" android:exported="false"/>
|
||||
<activity android:name="org.torproject.android.wizard.TipsAndTricks" android:exported="false"/>
|
||||
<activity android:name="org.torproject.android.wizard.ConfigureTransProxy" android:exported="false"/>
|
||||
<activity android:name="org.torproject.android.wizard.ChooseLocaleWizardActivity" android:exported="false"/>
|
||||
|
||||
<activity android:name=".settings.SettingsPreferences" android:label="@string/app_name"/>
|
||||
<activity android:name=".settings.AppManager" android:label="@string/app_name"/>
|
||||
<activity android:name="org.torproject.android.settings.SettingsPreferences" android:label="@string/app_name"/>
|
||||
<activity android:name="org.torproject.android.settings.AppManager" android:label="@string/app_name"/>
|
||||
|
||||
<service android:enabled="true"
|
||||
android:name=".service.TorService"
|
||||
android:name="org.torproject.android.service.TorService"
|
||||
android:permission="org.torproject.android.MANAGE_TOR"
|
||||
android:stopWithTask="false"
|
||||
>
|
||||
|
@ -110,7 +110,7 @@
|
|||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<receiver android:name=".OnBootReceiver">
|
||||
<receiver android:name="org.torproject.android.OnBootReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||
|
|
|
@ -16,14 +16,14 @@ EXTERNAL_ROOT := $(shell pwd)
|
|||
# user building this will have to manually set NDK_PROCESSOR or NDK_TOOLCHAIN.
|
||||
CPU := $(shell uname -m)
|
||||
ifeq ($(CPU),x86_64)
|
||||
NDK_PROCESSOR=x86_64
|
||||
NDK_PROCESSOR=x86
|
||||
else
|
||||
NDK_PROCESSOR=x86
|
||||
endif
|
||||
|
||||
# Android NDK setup
|
||||
NDK_BASE ?= /opt/android-ndk
|
||||
NDK_PLATFORM_LEVEL ?= 9
|
||||
NDK_PLATFORM_LEVEL ?= 19
|
||||
NDK_ABI ?= arm
|
||||
NDK_TOOLCHAIN_VERSION=4.8
|
||||
NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry exported="true" kind="lib" path="libs/android-support-v4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="libs/android-support-v7-appcompat.jar"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
##include ../OriginalDest/Android.mk
|
||||
##include ../external/badvpn/Android.mk
|
||||
include ./external/badvpn/Android.mk
|
||||
##include ../kalium-jni/jni/Android.mk
|
||||
|
|
|
@ -65,11 +65,9 @@
|
|||
yourapp:showAsAction="never"
|
||||
|
||||
/>
|
||||
<!--
|
||||
<item android:id="@+id/menu_vpn"
|
||||
android:title="@string/menu_vpn"
|
||||
yourapp:showAsAction="never"/>
|
||||
-->
|
||||
|
||||
<item android:id="@+id/menu_exit"
|
||||
android:title="@string/menu_exit"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<resources>
|
||||
<string name="app_name">Orbot</string>
|
||||
<string name="app_name">Ony</string>
|
||||
<string name="app_description">Orbot is a free proxy app that empowers other apps to use the internet more securely. Orbot uses Tor to encrypt your Internet traffic and then hides it by bouncing through a series of computers around the world. Tor is free software and an open network that helps you defend against a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security known as traffic analysis.</string>
|
||||
<string name="internal_web_url">http://orbot/</string>
|
||||
<string name="default_web_url">http://check.torproject.org</string>
|
||||
|
|
|
@ -8,6 +8,7 @@ import static org.torproject.android.TorConstants.TAG;
|
|||
import java.net.URLDecoder;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.torproject.android.service.TorService;
|
||||
import org.torproject.android.service.TorServiceConstants;
|
||||
import org.torproject.android.service.TorServiceUtils;
|
||||
|
@ -394,12 +395,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
|||
|
||||
|
||||
}
|
||||
/**
|
||||
* remove for now... VPN is not ready yet
|
||||
else if (item.getItemId() == R.id.menu_vpn)
|
||||
{
|
||||
this.startVpnService();
|
||||
}*/
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1210,8 +1209,5 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.sufficientlysecure.rootcommands.Shell;
|
||||
import org.sufficientlysecure.rootcommands.command.SimpleCommand;
|
||||
import org.torproject.android.service.TorResourceInstaller;
|
||||
|
|
|
@ -17,9 +17,9 @@ import java.util.concurrent.TimeoutException;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.sufficientlysecure.rootcommands.Shell;
|
||||
import org.sufficientlysecure.rootcommands.command.SimpleCommand;
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -45,10 +45,10 @@ import net.freehaven.tor.control.TorControlConnection;
|
|||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.sufficientlysecure.rootcommands.Shell;
|
||||
import org.sufficientlysecure.rootcommands.command.SimpleCommand;
|
||||
import org.torproject.android.Orbot;
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
import org.torproject.android.Utils;
|
||||
import org.torproject.android.settings.AppManager;
|
||||
|
@ -362,57 +362,35 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
|||
mIntent = intent;
|
||||
}
|
||||
|
||||
public void run ()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
public void run (){
|
||||
try{
|
||||
//if this is a start on boot launch turn tor on
|
||||
if (mIntent != null)
|
||||
{
|
||||
if (mIntent != null){
|
||||
String action = mIntent.getAction();
|
||||
|
||||
if (action!=null)
|
||||
{
|
||||
if(action.equals(Intent.ACTION_BOOT_COMPLETED)||action.equals(CMD_START))
|
||||
{
|
||||
if (action!=null){
|
||||
if(action.equals(Intent.ACTION_BOOT_COMPLETED)||action.equals(CMD_START)){
|
||||
setTorProfile(STATUS_ON);
|
||||
}
|
||||
else if (action.equals(CMD_STOP))
|
||||
{
|
||||
}else if (action.equals(CMD_STOP)){
|
||||
setTorProfile(STATUS_OFF);
|
||||
}
|
||||
else if (action.equals(CMD_INIT))
|
||||
{
|
||||
}else if (action.equals(CMD_INIT)){
|
||||
initialize();
|
||||
sendCallbackStatus(mCurrentStatus);
|
||||
}
|
||||
else if (action.equals(CMD_NEWNYM))
|
||||
{
|
||||
}else if (action.equals(CMD_NEWNYM)){
|
||||
newIdentity();
|
||||
}
|
||||
else if (action.equals(CMD_FLUSH))
|
||||
{
|
||||
}else if (action.equals(CMD_FLUSH)){
|
||||
flushTransparentProxyRules();
|
||||
}
|
||||
else if (action.equals(CMD_UPDATE))
|
||||
{
|
||||
}else if (action.equals(CMD_UPDATE)){
|
||||
processSettings();
|
||||
}
|
||||
else if (action.equals(CMD_VPN))
|
||||
{
|
||||
}else if (action.equals(CMD_VPN)){
|
||||
startVpnService();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
Log.d(TAG, "Got null onStartCommand() intent");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}catch (Exception e){
|
||||
Log.e(TAG,"error onBind",e);
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +399,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
|||
@Override
|
||||
public void onTaskRemoved(Intent rootIntent){
|
||||
Log.d(TAG,"task removed");
|
||||
|
||||
Intent intent = new Intent( this, DummyActivity.class );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
startActivity( intent );
|
||||
|
@ -429,27 +406,19 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
|||
|
||||
@Override
|
||||
public boolean stopService(Intent name) {
|
||||
|
||||
logNotice("TorService is being stopped: " + name);
|
||||
|
||||
return super.stopService(name);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy ()
|
||||
{
|
||||
String msg = ("TorService is being DESTROYED... shutting down!");
|
||||
|
||||
Log.d(TAG, msg);
|
||||
sendCallbackLogMessage(msg);
|
||||
|
||||
unregisterReceiver(mNetworkStateReceiver);
|
||||
|
||||
clearNotifications ();
|
||||
|
||||
super.onDestroy();
|
||||
|
||||
}
|
||||
|
||||
private void stopTor ()
|
||||
|
@ -1783,69 +1752,46 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
|||
|
||||
|
||||
|
||||
public void processSettings ()
|
||||
{
|
||||
|
||||
public void processSettings (){
|
||||
try{
|
||||
|
||||
boolean hadEnableTransparentProxy = mEnableTransparentProxy;
|
||||
|
||||
updateSettings ();
|
||||
|
||||
if (mHasRoot)
|
||||
{
|
||||
Shell shell = Shell.startRootShell();
|
||||
|
||||
if (hadEnableTransparentProxy)
|
||||
if (hadEnableTransparentProxy){
|
||||
disableTransparentProxy(shell);
|
||||
|
||||
if (mEnableTransparentProxy)
|
||||
}
|
||||
if (mEnableTransparentProxy){
|
||||
enableTransparentProxy(shell);
|
||||
|
||||
}
|
||||
shell.close();
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Thread thread = new Thread()
|
||||
{
|
||||
|
||||
public void run ()
|
||||
{
|
||||
Thread thread = new Thread(){
|
||||
public void run (){
|
||||
try {
|
||||
|
||||
|
||||
|
||||
processSettingsImpl();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logException ("error applying mPrefs",e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
thread.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String getInfo (String key) {
|
||||
try
|
||||
{
|
||||
if(conn !=null)
|
||||
{
|
||||
try {
|
||||
if(conn !=null){
|
||||
String m = conn.getInfo(key);
|
||||
return m;
|
||||
|
||||
}
|
||||
}
|
||||
catch(Exception ioe)
|
||||
{
|
||||
catch(Exception ioe){
|
||||
// Log.e(TAG,"Unable to get Tor information",ioe);
|
||||
logNotice("Unable to get Tor information"+ioe.getMessage());
|
||||
}
|
||||
|
@ -2398,7 +2344,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
|||
|
||||
private void blockPlaintextPorts (String portList) throws RemoteException
|
||||
{
|
||||
|
||||
updateConfiguration("RejectPlaintextPorts",portList,false);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.torproject.android.R;
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
import org.torproject.android.service.TorService;
|
||||
import org.torproject.android.service.TorServiceUtils;
|
||||
|
|
|
@ -5,8 +5,8 @@ package org.torproject.android.settings;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.sufficientlysecure.rootcommands.RootCommands;
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.service.TorServiceUtils;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -20,23 +20,36 @@ import java.io.IOException;
|
|||
import java.net.InetAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.torproject.android.Orbot;
|
||||
import org.torproject.android.service.TorService;
|
||||
import org.torproject.android.service.TorServiceConstants;
|
||||
|
||||
import com.runjva.sourceforge.jsocks.protocol.ProxyServer;
|
||||
import com.runjva.sourceforge.jsocks.server.ServerAuthenticatorNone;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.VpnService;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
import android.widget.RemoteViews;
|
||||
import android.widget.Toast;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||
private static final String TAG = "OrbotVpnService";
|
||||
private static final String TAG = "DrobotVpnService";
|
||||
|
||||
private PendingIntent mConfigureIntent;
|
||||
|
||||
|
@ -48,10 +61,24 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
|||
private ParcelFileDescriptor mInterface;
|
||||
|
||||
private int mSocksProxyPort = 9999;
|
||||
// private ProxyServer mProxyServer;
|
||||
private ProxyServer mProxyServer;
|
||||
|
||||
private final static int VPN_MTU = 1500;
|
||||
|
||||
private static final int NOTIFY_ID = 10;
|
||||
private static final int TRANSPROXY_NOTIFY_ID = 20;
|
||||
private static final int ERROR_NOTIFY_ID = 30;
|
||||
private static final int HS_NOTIFY_ID = 40;
|
||||
|
||||
private boolean prefPersistNotifications = true;
|
||||
|
||||
private NotificationManager mNotificationManager = null;
|
||||
private android.support.v4.app.NotificationCompat.Builder mNotifyBuilder;
|
||||
private Notification mNotification;
|
||||
private boolean mShowExpandedNotifications = false;
|
||||
private boolean mNotificationShowing = false;
|
||||
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
|
||||
|
@ -71,16 +98,31 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
|||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void startSocksBypass ()
|
||||
private void startSocksBypass(){
|
||||
mThreadProxy = new Thread ()
|
||||
{
|
||||
public void run ()
|
||||
{
|
||||
|
||||
try {
|
||||
mProxyServer = new ProxyServer(new ServerAuthenticatorNone(null, null));
|
||||
ProxyServer.setVpnService(OrbotVpnService.this);
|
||||
mProxyServer.start(mSocksProxyPort, 5, InetAddress.getLocalHost());
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG,"proxy server error: " + e.getLocalizedMessage(),e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mThreadProxy.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
|
||||
|
||||
if (mInterface != null)
|
||||
if (mProxyServer != null){
|
||||
mProxyServer.stop();
|
||||
}
|
||||
if (mInterface != null){
|
||||
try {
|
||||
mInterface.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -88,6 +130,7 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message message) {
|
||||
|
@ -117,13 +160,11 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
|||
Builder builder = new Builder();
|
||||
|
||||
builder.setMtu(VPN_MTU);
|
||||
builder.addAddress("10.0.0.1",8);
|
||||
builder.setSession("OrbotVPN");
|
||||
builder.addAddress("10.0.0.1",28);
|
||||
builder.setSession("DrobotVPN");
|
||||
builder.addRoute("0.0.0.0",0);
|
||||
builder.addRoute("10.0.0.0",8);
|
||||
//builder.addRoute("192.0.0.0",8);
|
||||
//builder.addRoute("192.168.43.0",8);
|
||||
builder.addDnsServer("8.8.8.8");
|
||||
|
||||
// Create a new interface using the builder and save the parameters.
|
||||
mInterface = builder.setSession(mSessionName)
|
||||
|
@ -132,7 +173,14 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
|||
|
||||
try
|
||||
{
|
||||
Tun2Socks.Start(mInterface, VPN_MTU, "10.0.0.2", "255.255.255.0", "localhost:" + TorServiceConstants.PORT_SOCKS_DEFAULT, "50.116.51.157:7300", true);
|
||||
Tun2Socks.Start(mInterface,
|
||||
VPN_MTU,
|
||||
"10.0.0.2",
|
||||
"255.255.255.0",
|
||||
"127.0.0.1:" + TorServiceConstants.PORT_SOCKS_DEFAULT,
|
||||
"10.0.0.1:" + String.valueOf(TorServiceConstants.TOR_DNS_PORT_DEFAULT),
|
||||
true);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -141,8 +189,8 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
mThreadVPN.start();
|
||||
showToolbarNotification(getString(R.string.status_activated), NOTIFY_ID, R.drawable.ic_stat_tor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -163,89 +211,90 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
|||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
clearNotifications();
|
||||
super.onRevoke();
|
||||
}
|
||||
|
||||
private void clearNotifications()
|
||||
{
|
||||
if (mNotificationManager != null)
|
||||
mNotificationManager.cancelAll();
|
||||
mNotificationShowing = false;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
private void debugPacket(ByteBuffer packet)
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void showToolbarNotification (String notifyMsg, int notifyType, int icon)
|
||||
{
|
||||
|
||||
int buffer = packet.get();
|
||||
int version;
|
||||
int headerlength;
|
||||
version = buffer >> 4;
|
||||
headerlength = buffer & 0x0F;
|
||||
headerlength *= 4;
|
||||
Log.d(TAG, "IP Version:"+version);
|
||||
Log.d(TAG, "Header Length:"+headerlength);
|
||||
//Reusable code.
|
||||
Intent intent = new Intent(OrbotVpnService.this, Orbot.class);
|
||||
PendingIntent pendIntent = PendingIntent.getActivity(OrbotVpnService.this, 0, intent, 0);
|
||||
|
||||
String status = "";
|
||||
status += "Header Length:"+headerlength;
|
||||
if (mNotifyBuilder == null)
|
||||
{
|
||||
|
||||
buffer = packet.get(); //DSCP + EN
|
||||
buffer = packet.getChar(); //Total Length
|
||||
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
Log.d(TAG, "Total Length:"+buffer);
|
||||
if (mNotifyBuilder == null)
|
||||
{
|
||||
mNotifyBuilder = new NotificationCompat.Builder(this)
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
.setSmallIcon(R.drawable.ic_stat_tor);
|
||||
mNotifyBuilder.setContentIntent(pendIntent);
|
||||
}
|
||||
}
|
||||
|
||||
buffer = packet.getChar(); //Identification
|
||||
Log.d(TAG, "Identification:"+buffer);
|
||||
mNotifyBuilder.setContentText(notifyMsg);
|
||||
mNotifyBuilder.setSmallIcon(icon);
|
||||
|
||||
buffer = packet.getChar(); //Flags + Fragment Offset
|
||||
buffer = packet.get(); //Time to Live
|
||||
buffer = packet.get(); //Protocol
|
||||
if (notifyType != NOTIFY_ID)
|
||||
{
|
||||
mNotifyBuilder.setTicker(notifyMsg);
|
||||
// mNotifyBuilder.setLights(Color.GREEN, 1000, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
mNotifyBuilder.setTicker(null);
|
||||
}
|
||||
|
||||
Log.d(TAG, "Protocol:"+buffer);
|
||||
mNotifyBuilder.setOngoing(prefPersistNotifications);
|
||||
|
||||
status += " Protocol:"+buffer;
|
||||
mNotification = mNotifyBuilder.build();
|
||||
|
||||
buffer = packet.getChar(); //Header checksum
|
||||
if (Build.VERSION.SDK_INT >= 16 && mShowExpandedNotifications) {
|
||||
|
||||
String sourceIP = "";
|
||||
buffer = packet.get(); //Source IP 1st Octet
|
||||
sourceIP += buffer;
|
||||
sourceIP += ".";
|
||||
|
||||
buffer = packet.get(); //Source IP 2nd Octet
|
||||
sourceIP += buffer;
|
||||
sourceIP += ".";
|
||||
// Create remote view that needs to be set as bigContentView for the notification.
|
||||
RemoteViews expandedView = new RemoteViews(this.getPackageName(),
|
||||
R.layout.layout_notification_expanded);
|
||||
|
||||
buffer = packet.get(); //Source IP 3rd Octet
|
||||
sourceIP += buffer;
|
||||
sourceIP += ".";
|
||||
StringBuffer sbInfo = new StringBuffer();
|
||||
|
||||
buffer = packet.get(); //Source IP 4th Octet
|
||||
sourceIP += buffer;
|
||||
|
||||
Log.d(TAG, "Source IP:"+sourceIP);
|
||||
|
||||
status += " Source IP:"+sourceIP;
|
||||
|
||||
String destIP = "";
|
||||
buffer = packet.get(); //Destination IP 1st Octet
|
||||
destIP += buffer;
|
||||
destIP += ".";
|
||||
|
||||
buffer = packet.get(); //Destination IP 2nd Octet
|
||||
destIP += buffer;
|
||||
destIP += ".";
|
||||
|
||||
buffer = packet.get(); //Destination IP 3rd Octet
|
||||
destIP += buffer;
|
||||
destIP += ".";
|
||||
|
||||
buffer = packet.get(); //Destination IP 4th Octet
|
||||
destIP += buffer;
|
||||
|
||||
Log.d(TAG, "Destination IP:"+destIP);
|
||||
|
||||
status += " Destination IP:"+destIP;
|
||||
|
||||
//Log.d(TAG, "version:"+packet.getInt());
|
||||
//Log.d(TAG, "version:"+packet.getInt());
|
||||
//Log.d(TAG, "version:"+packet.getInt());
|
||||
|
||||
}*/
|
||||
if (notifyType == NOTIFY_ID)
|
||||
expandedView.setTextViewText(R.id.text, notifyMsg);
|
||||
else
|
||||
{
|
||||
expandedView.setTextViewText(R.id.info, notifyMsg);
|
||||
|
||||
}
|
||||
expandedView.setTextViewText(R.id.title, getString(R.string.app_name));
|
||||
|
||||
expandedView.setImageViewResource(R.id.icon, icon);
|
||||
mNotification.bigContentView = expandedView;
|
||||
}
|
||||
|
||||
if (prefPersistNotifications && (!mNotificationShowing))
|
||||
{
|
||||
startForeground(NOTIFY_ID, mNotification);
|
||||
}
|
||||
else
|
||||
{
|
||||
mNotificationManager.notify(NOTIFY_ID, mNotification);
|
||||
}
|
||||
|
||||
mNotificationShowing = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.net.Socket;
|
|||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.util.Log;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
|
||||
public class Tun2Socks
|
||||
|
@ -35,6 +36,8 @@ public class Tun2Socks
|
|||
boolean doVpnProtect(DatagramSocket socket);
|
||||
};
|
||||
|
||||
private static final String TAG = Tun2Socks.class.getSimpleName();
|
||||
private static final boolean LOGD = true;
|
||||
|
||||
private static Thread mThread;
|
||||
private static ParcelFileDescriptor mVpnInterfaceFileDescriptor;
|
||||
|
@ -84,8 +87,6 @@ public class Tun2Socks
|
|||
mSocksServerAddress,
|
||||
mUdpgwServerAddress,
|
||||
mUdpgwTransparentDNS ? 1 : 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
|
@ -95,6 +96,22 @@ public class Tun2Socks
|
|||
|
||||
}
|
||||
|
||||
public static void logTun2Socks(
|
||||
String level,
|
||||
String channel,
|
||||
String msg)
|
||||
{
|
||||
String logMsg = level + "(" + channel + "): " + msg;
|
||||
if (0 == level.compareTo("ERROR"))
|
||||
{
|
||||
Log.e(TAG, logMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOGD) Log.d(TAG, logMsg);
|
||||
}
|
||||
}
|
||||
|
||||
private native static int runTun2Socks(
|
||||
int vpnInterfaceFileDescriptor,
|
||||
int vpnInterfaceMTU,
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.torproject.android.wizard;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.torproject.android.R;
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
import org.torproject.android.service.TorServiceUtils;
|
||||
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package org.torproject.android.wizard;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.torproject.android.Orbot;
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
import org.torproject.android.R.drawable;
|
||||
import org.torproject.android.R.id;
|
||||
import org.torproject.android.R.layout;
|
||||
import org.torproject.android.R.string;
|
||||
import org.torproject.android.service.TorServiceUtils;
|
||||
import org.torproject.android.settings.AppManager;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.torproject.android.wizard;
|
||||
|
||||
import org.torproject.android.R;
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
import org.torproject.android.service.TorServiceUtils;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.torproject.android.wizard;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.sufficientlysecure.rootcommands.RootCommands;
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
import org.torproject.android.service.TorServiceUtils;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.torproject.android.wizard;
|
||||
|
||||
import org.sandroproxy.ony.R;
|
||||
import org.torproject.android.Orbot;
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.TorConstants;
|
||||
|
||||
import android.app.Activity;
|
||||
|
@ -241,9 +241,5 @@ public class TipsAndTricks extends Activity implements TorConstants {
|
|||
.setPositiveButton(R.string.button_close, ocListener)
|
||||
.setMessage(msg)
|
||||
.show();
|
||||
|
||||
|
||||
|
||||
|
||||
}*/
|
||||
}
|
Loading…
Reference in New Issue