Compare commits

...

46 Commits

Author SHA1 Message Date
n8fr8 e822160b00 udpate gradle depend version to 0.3.4.8-2 2018-10-11 23:10:09 -04:00
n8fr8 b0e62e58cc updated torrc defaults 2018-10-11 23:09:32 -04:00
n8fr8 43b10491a1 updated bridges 2018-10-11 23:08:38 -04:00
n8fr8 c4cf800488 update build files 2018-10-11 16:51:11 -04:00
n8fr8 0417acf570 update version string to 0.3.4.8-openssl1.0.2p-1 for 2nd release of 0.3.4.8 2018-10-11 16:50:58 -04:00
n8fr8 ff7ecbdba9 update version for gradle lib 2018-10-11 09:27:52 -04:00
n8fr8 3e8e5ace65 update armeabi-v7a binary for 0.3.4.8 2018-10-07 09:40:12 -04:00
n8fr8 0fda8f7779 update x86 binary for 0.3.4.8 2018-10-07 09:35:31 -04:00
n8fr8 6548d3630b update tor binary to 0.3.4.8 w/o dirauth module 2018-10-07 08:55:14 -04:00
n8fr8 d1ee65a795 fixes #7 disable dirauth support for tor client only mode 2018-10-07 08:53:38 -04:00
n8fr8 a2fba85a5b update tor binary to 0.3.4.8 2018-10-07 08:45:09 -04:00
n8fr8 6ef0a45050 update to 0.3.4.8 2018-10-04 11:31:32 -04:00
n8fr8 b82b6a4cb1 update tor binary to tor-0.3.4.7-rc 2018-09-30 18:34:56 -04:00
n8fr8 de522e2ec8 tor-0.3.4.7-rc 2018-09-30 18:34:33 -04:00
n8fr8 0756d058f7 set to libevent 2.0.10-stable 2018-09-30 18:33:21 -04:00
n8fr8 b98cad65d4 set to master for libevent 2018-09-30 14:31:08 -04:00
n8fr8 cd678980f9 remove amazon meek bridge 2018-09-30 14:26:41 -04:00
n8fr8 8a66040c4f updated resource string to 0.3.4.8-openssl1.0.2p 2018-09-13 06:09:05 -04:00
n8fr8 75bd78b287 update gradle archive versioning 2018-09-12 17:14:07 -04:00
n8fr8 fa1ed5505d update Makefile to add specific NDK versioning for openssl 2018-09-12 17:11:31 -04:00
n8fr8 84ab10731c update tor to 0.3.4.8 2018-09-12 17:11:25 -04:00
n8fr8 63656611dc update binaries 2018-09-12 17:09:35 -04:00
n8fr8 84d7745cde update binary constants to trigger upgrade 2018-09-05 21:35:54 -04:00
n8fr8 b0e2d4e63b update library to version 34700 2018-09-05 21:34:25 -04:00
n8fr8 e97d5a1016 update binaries for tor-0.3.4.7-rc 2018-09-05 21:26:20 -04:00
n8fr8 0ba24f8ca4 update tor to tor-0.3.4.7-rc 2018-09-05 21:07:07 -04:00
n8fr8 93663355fa update to ensure compression libs are included in binary 2018-09-05 21:06:09 -04:00
n8fr8 63723e06ef update to 0.3.3.5-rc-3 2018-05-14 12:29:12 -04:00
n8fr8 ae61770960 update loader to handle zipped entries in a zip file (like tor.so in the APK) 2018-05-14 12:28:39 -04:00
n8fr8 45ecbcb298 update gradle build to 0.3.3.5-rc-2 2018-05-14 11:35:36 -04:00
n8fr8 d2342ed7ec add split APK support to the sample 2018-05-14 11:27:01 -04:00
n8fr8 549fb14077 update native loader code 2018-05-14 11:17:14 -04:00
n8fr8 5366016c86 add armeabi-v7a optimized build 2018-05-14 11:17:06 -04:00
n8fr8 de630b45cb add simple sample app 2018-05-14 10:38:29 -04:00
n8fr8 292dcda8e0 add additional ways to load native binaries from native libs 2018-05-14 10:38:10 -04:00
n8fr8 87efd233e5 update gradle version to force refetch 0.3.3.5-rc-1 2018-05-12 00:10:41 -04:00
n8fr8 ff59b5595f updating display string to 0.3.3.5-openssl1.0.2o 2018-05-12 00:05:36 -04:00
n8fr8 9e428e1e09 update archive build version to 0.3.3.5-rc 2018-05-11 23:56:50 -04:00
n8fr8 a46fd778b5 update gradle 2018-05-11 23:55:42 -04:00
n8fr8 db82e6b889 update tor binaries 2018-05-11 23:55:31 -04:00
n8fr8 7a9cbe8fc7 update gradle to 3.1.2 2018-05-11 23:54:59 -04:00
n8fr8 d364a5493c update tor to 0.3.3.5-rc 2018-05-11 23:54:37 -04:00
n8fr8 988a87c8ef upload maven build to 0.3.2.10-dev 2018-05-09 13:03:56 -04:00
n8fr8 51c7a076a5 update makefile to copy into proper native lib location 2018-05-09 12:53:26 -04:00
n8fr8 1b1f64d376 update to use faux .so shared library method for loading tor binary 2018-05-09 12:47:25 -04:00
n8fr8 9abac285db update deploy gradle for 0.3.2.10 2018-04-21 22:14:52 -04:00
45 changed files with 656 additions and 64 deletions

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.0'
}
}

23
external/Makefile vendored
View File

@ -28,6 +28,7 @@ endif
# Android NDK setup
ANDROID_NDK_HOME ?= /opt/android-ndk
ANDROID_NDK ?= $(ANDROID_NDK_HOME)
NDK_PLATFORM_LEVEL ?= 16
NDK_TOOLCHAIN_VERSION=4.9
APP_ABI ?= armeabi
@ -42,6 +43,7 @@ endif
ifneq ($(filter arm64%, $(APP_ABI)),)
NDK_ABI := arm64
endif
NDK_SYSROOT=$(ANDROID_NDK_HOME)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)
NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
ifneq ($(filter mips%, $(NDK_ABI)),)
@ -125,10 +127,9 @@ ifneq ($(filter mips%, $(NDK_ABI)),)
OPENSSL_CONF_FLAG+=-D_MIPS_SZLONG=32 -D__MIPSEL__
endif
endif
lib/libcrypto.a:
cd openssl && \
./Configure android -DL_ENDIAN $(OPENSSL_CONF_FLAG) && \
./Configure android -D__ANDROID_API__=$(NDK_PLATFORM_LEVEL) -DL_ENDIAN $(OPENSSL_CONF_FLAG) && \
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr depend && \
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
@ -136,7 +137,7 @@ lib/libssl.a:
cp config.sub openssl
cp config.guess openssl
cd openssl && \
./Configure android -DL_ENDIAN $(OPENSSL_CONF_FLAG) && \
./Configure android -D__ANDROID_API__=$(NDK_PLATFORM_LEVEL) -DL_ENDIAN $(OPENSSL_CONF_FLAG) && \
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr depend && \
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
@ -254,14 +255,14 @@ tor/Makefile: tor/configure
cp config.sub tor
cp config.guess tor
cd tor && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS) -D_FORTIFY_SOURCE=2 -fwrapv -fno-strict-aliasing -fno-strict-overflow" LDFLAGS="$(LDFLAGS)" \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) PKG_CONFIG_PATH="$(EXTERNAL_ROOT)/lib/pkgconfig" CFLAGS="$(CFLAGS) -D_FORTIFY_SOURCE=2 -fwrapv -fno-strict-aliasing -fno-strict-overflow" LDFLAGS="$(LDFLAGS)" \
LIBS="-L$(EXTERNAL_ROOT)/lib" CFLAGS="-I$(EXTERNAL_ROOT)/include -I$(EXTERNAL_ROOT)/include/event2" \
./configure \
--host=$(HOST) \
--disable-asciidoc \
--enable-static-libevent --with-libevent-dir=$(EXTERNAL_ROOT) \
--enable-static-openssl --with-openssl-dir=$(EXTERNAL_ROOT) \
--disable-linker-hardening --disable-gcc-hardening --disable-tool-name-check --disable-systemd
--disable-linker-hardening --disable-gcc-hardening --disable-tool-name-check --disable-systemd --disable-module-dirauth
tor-build-stamp: tor/Makefile
$(MAKE) -C tor all-am
@ -280,18 +281,16 @@ tor-clean:
git reset HEAD --hard
#------------------------------------------------------------------------------#
#create and clean assets: FYI - tor is stored as a ZIP file with an mp3 extension
#in order to stop Android OS (older devices) from trying to compress/decompress it
#this is related to a bug in compression of assets and resources > 1MB
#create and clean assets: FYI - tor is stored as a ZIP file with an so extension
#in the libs directly, so it is handled like a shared library for local installation
assets: tor
install -d ../tor-android-binary/src/main/assets/$(APP_ABI)
install -d ../tor-android-binary/src/main/libs/$(APP_ABI)
-$(STRIP) bin/tor
-zip ../tor-android-binary/src/main/assets/$(APP_ABI)/tor.mp3 bin/tor
-zip ../tor-android-binary/src/main/libs/$(APP_ABI)/tor.so bin/tor
assets-clean:
-rm ../tor-android-binary/src/main/assets/$(APP_ABI)/tor.mp3
-rm ../tor-android-binary/src/main/libs/$(APP_ABI)/tor.so
#------------------------------------------------------------------------------#
# cleanup, cleanup, put the toys away

2
external/openssl vendored

@ -1 +1 @@
Subproject commit 3ce7bc40a3c48da1c96c2d04c10045bd797c6aa3
Subproject commit e71ebf275da66dfd601c92e0e80a35114c32f6f8

2
external/tor vendored

@ -1 +1 @@
Subproject commit 31cc63deb69db819ed55aca406ebaaa52500730e
Subproject commit da95b91355248ad8f3a6aa6733cc6d24915f59ce

View File

@ -6,12 +6,12 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Mon Jun 20 21:44:59 EDT 2016
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
android.useDeprecatedNdk=true
aar.deployPath=/media/n8fr8/nate128/dev/repos/gpmaven

View File

@ -1,5 +1,6 @@
#Thu Oct 11 16:49:15 EDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

View File

@ -10,3 +10,4 @@
# Project target.
target=android-16
aar.deployPath=/media/n8fr8/nate128/dev/repos/gpmaven/

1
sampletorapp/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

62
sampletorapp/build.gradle Normal file
View File

@ -0,0 +1,62 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "org.torproject.android.sample"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
splits {
// Configures multiple APKs based on ABI. This helps keep the size down, since PT binaries can be large.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86 and x86_64.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "armeabi", "armeabi-v7a"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':tor-android-binary')
}

21
sampletorapp/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,26 @@
package org.torproject.android.sample;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("org.torproject.android.sample", appContext.getPackageName());
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.torproject.android.sample">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".sampleTorActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,41 @@
package org.torproject.android.sample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import org.torproject.android.binary.TorResourceInstaller;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
public class sampleTorActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_tor);
try {
boolean success = new TorResourceInstaller(this,getFilesDir()).installResources();
String message = "Tor install success? " + success;
((TextView)findViewById(R.id.lblStatus)).setText(message);
} catch (IOException e) {
e.printStackTrace();
((TextView)findViewById(R.id.lblStatus)).setText(e.getMessage());
} catch (TimeoutException e) {
e.printStackTrace();
}
}
public void doTorThings ()
{
//please see this project: https://github.com/thaliproject/Tor_Onion_Proxy_Library/
}
}

View File

@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".sampleTorActivity">
<TextView
android:id="@+id/lblStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">SampleTorApp</string>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@ -0,0 +1,17 @@
package org.torproject.android.sample;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -1 +1 @@
include ':tor-android-binary'
include ':tor-android-binary', ':sampletorapp'

View File

@ -1,21 +1,22 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
compileSdkVersion 27
buildToolsVersion '28.0.2'
/**
sourceSets {
main {
jni.srcDirs = []
}
}
}**/
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 3210
versionName "0.3.2.10"
targetSdkVersion 27
versionCode 34700
versionName "0.3.4.7-rc"
}
buildTypes {
@ -27,7 +28,7 @@ android {
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.so'])
implementation fileTree(dir: 'libs', include: ['*.so'])
}
apply plugin: 'maven'
@ -39,7 +40,7 @@ uploadArchives {
pom.project {
groupId 'org.torproject'
artifactId 'tor-android-binary'
version "0.3.1.9b"
version "0.3.4.8-2"
}
}
}

View File

@ -1,22 +1,4 @@
obfs4 154.35.22.10:15937 8FB9F4319E89E5C6223052AA525A192AFBC85D55 cert=GGGS1TX4R81m3r0HBl79wKy1OtPPNR2CZUIrHjkRg65Vc2VR8fOyo64f9kmT1UAFG7j0HQ iat-mode=0
obfs4 198.245.60.50:443 752CF7825B3B9EA6A98C83AC41F7099D67007EA5 cert=xpmQtKUqQ/6v5X7ijgYE/f03+l2/EuQ1dexjyUhh16wQlu/cpXUGalmhDIlhuiQPNEKmKw iat-mode=0
obfs4 192.99.11.54:443 7B126FAB960E5AC6A629C729434FF84FB5074EC2 cert=VW5f8+IBUWpPFxF+rsiVy2wXkyTQG7vEd+rHeN2jV5LIDNu8wMNEOqZXPwHdwMVEBdqXEw iat-mode=0
obfs4 109.105.109.165:10527 8DFCD8FB3285E855F5A55EDDA35696C743ABFC4E cert=Bvg/itxeL4TWKLP6N1MaQzSOC6tcRIBv6q57DYAZc3b2AzuM+/TfB7mqTFEfXILCjEwzVA iat-mode=1
obfs4 83.212.101.3:50002 A09D536DD1752D542E1FBB3C9CE4449D51298239 cert=lPRQ/MXdD1t5SRZ9MquYQNT9m5DV757jtdXdlePmRCudUU9CFUOX1Tm7/meFSyPOsud7Cw iat-mode=0
obfs4 109.105.109.147:13764 BBB28DF0F201E706BE564EFE690FE9577DD8386D cert=KfMQN/tNMFdda61hMgpiMI7pbwU1T+wxjTulYnfw+4sgvG0zSH7N7fwT10BI8MUdAD7iJA iat-mode=2
obfs4 154.35.22.11:16488 A832D176ECD5C7C6B58825AE22FC4C90FA249637 cert=YPbQqXPiqTUBfjGFLpm9JYEFTBvnzEJDKJxXG5Sxzrr/v2qrhGU4Jls9lHjLAhqpXaEfZw iat-mode=0
obfs4 154.35.22.12:80 00DC6C4FA49A65BD1472993CF6730D54F11E0DBB cert=N86E9hKXXXVz6G7w2z8wFfhIDztDAzZ/3poxVePHEYjbKDWzjkRDccFMAnhK75fc65pYSg iat-mode=0
obfs4 154.35.22.13:443 FE7840FE1E21FE0A0639ED176EDA00A3ECA1E34D cert=fKnzxr+m+jWXXQGCaXe4f2gGoPXMzbL+bTBbXMYXuK0tMotd+nXyS33y2mONZWU29l81CA iat-mode=0
obfs4 154.35.22.10:80 8FB9F4319E89E5C6223052AA525A192AFBC85D55 cert=GGGS1TX4R81m3r0HBl79wKy1OtPPNR2CZUIrHjkRg65Vc2VR8fOyo64f9kmT1UAFG7j0HQ iat-mode=0
obfs4 154.35.22.10:443 8FB9F4319E89E5C6223052AA525A192AFBC85D55 cert=GGGS1TX4R81m3r0HBl79wKy1OtPPNR2CZUIrHjkRg65Vc2VR8fOyo64f9kmT1UAFG7j0HQ iat-mode=0
obfs4 154.35.22.11:443 A832D176ECD5C7C6B58825AE22FC4C90FA249637 cert=YPbQqXPiqTUBfjGFLpm9JYEFTBvnzEJDKJxXG5Sxzrr/v2qrhGU4Jls9lHjLAhqpXaEfZw iat-mode=0
obfs4 154.35.22.11:80 A832D176ECD5C7C6B58825AE22FC4C90FA249637 cert=YPbQqXPiqTUBfjGFLpm9JYEFTBvnzEJDKJxXG5Sxzrr/v2qrhGU4Jls9lHjLAhqpXaEfZw iat-mode=0
obfs4 154.35.22.9:12166 C73ADBAC8ADFDBF0FC0F3F4E8091C0107D093716 cert=gEGKc5WN/bSjFa6UkG9hOcft1tuK+cV8hbZ0H6cqXiMPLqSbCh2Q3PHe5OOr6oMVORhoJA iat-mode=0
obfs4 154.35.22.9:80 C73ADBAC8ADFDBF0FC0F3F4E8091C0107D093716 cert=gEGKc5WN/bSjFa6UkG9hOcft1tuK+cV8hbZ0H6cqXiMPLqSbCh2Q3PHe5OOr6oMVORhoJA iat-mode=0
obfs4 154.35.22.9:443 C73ADBAC8ADFDBF0FC0F3F4E8091C0107D093716 cert=gEGKc5WN/bSjFa6UkG9hOcft1tuK+cV8hbZ0H6cqXiMPLqSbCh2Q3PHe5OOr6oMVORhoJA iat-mode=0
obfs4 154.35.22.12:4304 00DC6C4FA49A65BD1472993CF6730D54F11E0DBB cert=N86E9hKXXXVz6G7w2z8wFfhIDztDAzZ/3poxVePHEYjbKDWzjkRDccFMAnhK75fc65pYSg iat-mode=0
obfs4 154.35.22.13:16815 FE7840FE1E21FE0A0639ED176EDA00A3ECA1E34D cert=fKnzxr+m+jWXXQGCaXe4f2gGoPXMzbL+bTBbXMYXuK0tMotd+nXyS33y2mONZWU29l81CA iat-mode=0
obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1
obfs4 85.17.30.79:443 FC259A04A328A07FED1413E9FC6526530D9FD87A cert=RutxZlu8BtyP+y0NX7bAVD41+J/qXNhHUrKjFkRSdiBAhIHIQLhKQ2HxESAKZprn/lR3KA iat-mode=0
meek_lite 0.0.2.0:1 B9E7141C594AF25699E0079C1F0146F409495296 url=https://d2cly7j4zqgua7.cloudfront.net/ front=a0.awsstatic.com
obfs4 78.215.187.186:45675 AE907EE5FAA5D0D27E0C83EFA6ADF8E79FCC0FF1 cert=/TRjMo+RinKaixARMjMtZZBhystaBe+aDaapPrbiITFtWx3M/AJcvpjHjO54tJqLd1+IWQ iat-mode=0
obfs4 107.160.7.24:443 7A0904F6D182B81BEFE0DEDAFEC974494672627B cert=a5/IlZMnDvb8d92LTHMfsBIgL7QlDLPiXiLwe85uedC80mGD0QerygzmsWnMEdwG9ER9Eg iat-mode=0
obfs4 79.136.160.201:46501 66AC975BF7CB429D057AE07FC0312C57D61BAEC1 cert=dCtn9Ya8z+R8YQikdWgC3XTAt58z5Apnm95QHrJwnhFSdnphPPEz+NMm6OawWc2srKLjJg iat-mode=0
meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com

View File

@ -1,8 +1,8 @@
RunAsDaemon 1
AvoidDiskWrites 1
AvoidDiskWrites 0
ControlPort auto
SOCKSPort 0
DNSPort 0
TransPort 0
CookieAuthentication 1
DisableNetwork 1
DisableNetwork 1

View File

@ -0,0 +1,122 @@
package org.torproject.android.binary;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
public class NativeLoader {
private final static String LIB_NAME = "tor";
private final static String LIB_SO_NAME = "tor.so";
private final static String TAG = "TorNativeLoader";
private static boolean loadFromZip(Context context, File destLocalFile, String folder) {
ZipFile zipFile = null;
ZipInputStream stream = null;
try {
zipFile = new ZipFile(context.getApplicationInfo().sourceDir);
ZipEntry entry = zipFile.getEntry("lib/" + folder + "/" + LIB_SO_NAME);
if (entry == null) {
throw new Exception("Unable to find file in apk:" + "lib/" + folder + "/" + LIB_NAME);
}
//how we wrap this in another stream because the native .so is zipped itself
stream = new ZipInputStream(zipFile.getInputStream(entry));
ZipEntry ze = stream.getNextEntry();
OutputStream out = new FileOutputStream(destLocalFile);
byte[] buf = new byte[4096];
int len;
while ((len = stream.read(buf)) > 0) {
Thread.yield();
out.write(buf, 0, len);
}
out.close();
if (Build.VERSION.SDK_INT >= 9) {
destLocalFile.setReadable(true, false);
destLocalFile.setExecutable(true, false);
destLocalFile.setWritable(true);
}
return true;
} catch (Exception e) {
Log.e(TAG, e.getMessage());
} finally {
if (stream != null) {
try {
stream.close();
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
if (zipFile != null) {
try {
zipFile.close();
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
}
return false;
}
public static synchronized boolean initNativeLibs(Context context, File destLocalFile) {
try {
String folder = null;
try {
if (Build.CPU_ABI.equalsIgnoreCase("armeabi-v7a")) {
folder = "armeabi-v7a";
}
else if (Build.CPU_ABI.equalsIgnoreCase("armeabi")) {
folder = "armeabi";
} else if (Build.CPU_ABI.equalsIgnoreCase("x86")) {
folder = "x86";
} else if (Build.CPU_ABI.equalsIgnoreCase("mips")) {
folder = "mips";
} else {
folder = "armeabi";
//FileLog.e("tmessages", "Unsupported arch: " + Build.CPU_ABI);
}
} catch (Exception e) {
// FileLog.e("tmessages", e);
Log.e(TAG, e.getMessage(),e);
folder = "armeabi";
}
String javaArch = System.getProperty("os.arch");
if (javaArch != null && javaArch.contains("686")) {
folder = "x86";
}
if (loadFromZip(context, destLocalFile, folder)) {
return true;
}
} catch (Throwable e) {
Log.e(TAG, e.getMessage(),e);
}
return false;
}
}

View File

@ -4,6 +4,7 @@
package org.torproject.android.binary;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@ -15,6 +16,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.util.Log;
@ -32,7 +34,7 @@ public class TorResourceInstaller implements TorServiceConstants {
this.context = context;
}
public void deleteDirectory(File file) {
private void deleteDirectory(File file) {
if( file.exists() ) {
if (file.isDirectory()) {
File[] files = file.listFiles();
@ -49,33 +51,56 @@ public class TorResourceInstaller implements TorServiceConstants {
file.delete();
}
}
private final static String MP3_EXT = ".mp3";
//
/*
* Extract the Tor resources from the APK file using ZIP
*/
public boolean installResources () throws IOException, TimeoutException
{
String cpuPath = "armeabi";
if (Build.CPU_ABI.contains("x86"))
cpuPath = "x86";
File fileTorLocalFile = new File(installFolder, TOR_ASSET_KEY);
deleteDirectory(installFolder);
installFolder.mkdirs();
installGeoIP();
assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, false, false);
assetToFile(cpuPath + '/' + TOR_ASSET_KEY + MP3_EXT, TOR_ASSET_KEY, true, true);
installGeoIP();
return true;
File fileNativeDir = new File(getNativeLibraryDir(context));
Log.d(TAG,"listing native files");
listf(fileNativeDir.getAbsolutePath());
File fileNativeBin = new File(getNativeLibraryDir(context),TOR_ASSET_KEY + ".so");
if (!fileNativeBin.exists())
{
if (getNativeLibraryDir(context).endsWith("arm")) {
fileNativeBin = new File(getNativeLibraryDir(context)+"eabi", TOR_ASSET_KEY + ".so");
}
}
if (fileNativeBin.exists()) {
InputStream is = new FileInputStream(fileNativeBin);
streamToFile(is, fileTorLocalFile, false, true);
setExecutable(fileTorLocalFile);
return fileTorLocalFile.exists() && fileTorLocalFile.canExecute();
}
else
{
//let's try another approach
return NativeLoader.initNativeLibs(context,fileTorLocalFile);
}
}
// Return Full path to the directory where native JNI libraries are stored.
private static String getNativeLibraryDir(Context context) {
ApplicationInfo appInfo = context.getApplicationInfo();
return appInfo.nativeLibraryDir;
}
public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException
{
if (fileTorRcCustom.exists())
@ -124,7 +149,7 @@ public class TorResourceInstaller implements TorServiceConstants {
/*
* Write the inputstream contents to the file
*/
public static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException
private static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException
{
byte[] buffer = new byte[FILE_WRITE_BUFFER_SIZE];
@ -169,4 +194,22 @@ public class TorResourceInstaller implements TorServiceConstants {
fileBin.setWritable(true, true);
}
private static File[] listf(String directoryName) {
// .............list file
File directory = new File(directoryName);
// get all the files from a directory
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile()) {
Log.d(TAG,file.getAbsolutePath());
} else if (file.isDirectory()) {
listf(file.getAbsolutePath());
}
}
return fList;
}
}

View File

@ -20,6 +20,6 @@ public interface TorServiceConstants {
int FILE_WRITE_BUFFER_SIZE = 1024;
String BINARY_TOR_VERSION = "0.3.2.10-openssl1.0.2o";
String BINARY_TOR_VERSION = "0.3.4.8-openssl1.0.2p-1";
}

View File

@ -0,0 +1 @@
libs

Binary file not shown.

Binary file not shown.

Binary file not shown.