Compare commits
43 Commits
0.3.2.10-d
...
master
Author | SHA1 | Date |
---|---|---|
n8fr8 | e822160b00 | |
n8fr8 | b0e62e58cc | |
n8fr8 | 43b10491a1 | |
n8fr8 | c4cf800488 | |
n8fr8 | 0417acf570 | |
n8fr8 | ff7ecbdba9 | |
n8fr8 | 3e8e5ace65 | |
n8fr8 | 0fda8f7779 | |
n8fr8 | 6548d3630b | |
n8fr8 | d1ee65a795 | |
n8fr8 | a2fba85a5b | |
n8fr8 | 6ef0a45050 | |
n8fr8 | b82b6a4cb1 | |
n8fr8 | de522e2ec8 | |
n8fr8 | 0756d058f7 | |
n8fr8 | b98cad65d4 | |
n8fr8 | cd678980f9 | |
n8fr8 | 8a66040c4f | |
n8fr8 | 75bd78b287 | |
n8fr8 | fa1ed5505d | |
n8fr8 | 84ab10731c | |
n8fr8 | 63656611dc | |
n8fr8 | 84d7745cde | |
n8fr8 | b0e2d4e63b | |
n8fr8 | e97d5a1016 | |
n8fr8 | 0ba24f8ca4 | |
n8fr8 | 93663355fa | |
n8fr8 | 63723e06ef | |
n8fr8 | ae61770960 | |
n8fr8 | 45ecbcb298 | |
n8fr8 | d2342ed7ec | |
n8fr8 | 549fb14077 | |
n8fr8 | 5366016c86 | |
n8fr8 | de630b45cb | |
n8fr8 | 292dcda8e0 | |
n8fr8 | 87efd233e5 | |
n8fr8 | ff59b5595f | |
n8fr8 | 9e428e1e09 | |
n8fr8 | a46fd778b5 | |
n8fr8 | db82e6b889 | |
n8fr8 | 7a9cbe8fc7 | |
n8fr8 | d364a5493c | |
n8fr8 | 988a87c8ef |
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.1.1'
|
classpath 'com.android.tools.build:gradle:3.2.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ endif
|
||||||
|
|
||||||
# Android NDK setup
|
# Android NDK setup
|
||||||
ANDROID_NDK_HOME ?= /opt/android-ndk
|
ANDROID_NDK_HOME ?= /opt/android-ndk
|
||||||
|
ANDROID_NDK ?= $(ANDROID_NDK_HOME)
|
||||||
NDK_PLATFORM_LEVEL ?= 16
|
NDK_PLATFORM_LEVEL ?= 16
|
||||||
NDK_TOOLCHAIN_VERSION=4.9
|
NDK_TOOLCHAIN_VERSION=4.9
|
||||||
APP_ABI ?= armeabi
|
APP_ABI ?= armeabi
|
||||||
|
@ -42,6 +43,7 @@ endif
|
||||||
ifneq ($(filter arm64%, $(APP_ABI)),)
|
ifneq ($(filter arm64%, $(APP_ABI)),)
|
||||||
NDK_ABI := arm64
|
NDK_ABI := arm64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
NDK_SYSROOT=$(ANDROID_NDK_HOME)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)
|
NDK_SYSROOT=$(ANDROID_NDK_HOME)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)
|
||||||
NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
|
NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
|
||||||
ifneq ($(filter mips%, $(NDK_ABI)),)
|
ifneq ($(filter mips%, $(NDK_ABI)),)
|
||||||
|
@ -125,10 +127,9 @@ ifneq ($(filter mips%, $(NDK_ABI)),)
|
||||||
OPENSSL_CONF_FLAG+=-D_MIPS_SZLONG=32 -D__MIPSEL__
|
OPENSSL_CONF_FLAG+=-D_MIPS_SZLONG=32 -D__MIPSEL__
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
lib/libcrypto.a:
|
lib/libcrypto.a:
|
||||||
cd 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 depend && \
|
||||||
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
|
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ lib/libssl.a:
|
||||||
cp config.sub openssl
|
cp config.sub openssl
|
||||||
cp config.guess openssl
|
cp config.guess openssl
|
||||||
cd 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 depend && \
|
||||||
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
|
make CC="$(CC)" ANDROID_DEV=$(NDK_SYSROOT)/usr build_libs
|
||||||
|
|
||||||
|
@ -254,14 +255,14 @@ tor/Makefile: tor/configure
|
||||||
cp config.sub tor
|
cp config.sub tor
|
||||||
cp config.guess tor
|
cp config.guess tor
|
||||||
cd 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" \
|
LIBS="-L$(EXTERNAL_ROOT)/lib" CFLAGS="-I$(EXTERNAL_ROOT)/include -I$(EXTERNAL_ROOT)/include/event2" \
|
||||||
./configure \
|
./configure \
|
||||||
--host=$(HOST) \
|
--host=$(HOST) \
|
||||||
--disable-asciidoc \
|
--disable-asciidoc \
|
||||||
--enable-static-libevent --with-libevent-dir=$(EXTERNAL_ROOT) \
|
--enable-static-libevent --with-libevent-dir=$(EXTERNAL_ROOT) \
|
||||||
--enable-static-openssl --with-openssl-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
|
tor-build-stamp: tor/Makefile
|
||||||
$(MAKE) -C tor all-am
|
$(MAKE) -C tor all-am
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3ce7bc40a3c48da1c96c2d04c10045bd797c6aa3
|
Subproject commit e71ebf275da66dfd601c92e0e80a35114c32f6f8
|
|
@ -1 +1 @@
|
||||||
Subproject commit 31cc63deb69db819ed55aca406ebaaa52500730e
|
Subproject commit da95b91355248ad8f3a6aa6733cc6d24915f59ce
|
|
@ -6,12 +6,12 @@
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
# 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.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# 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
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
#Mon Jun 20 21:44:59 EDT 2016
|
#Mon Jun 20 21:44:59 EDT 2016
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
android.useDeprecatedNdk=true
|
android.useDeprecatedNdk=true
|
||||||
aar.deployPath=/media/n8fr8/nate128/dev/repos/gpmaven
|
aar.deployPath=/media/n8fr8/nate128/dev/repos/gpmaven
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Wed May 09 12:39:36 EDT 2018
|
#Thu Oct 11 16:49:15 EDT 2018
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||||
|
|
|
@ -10,3 +10,4 @@
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-16
|
target=android-16
|
||||||
|
aar.deployPath=/media/n8fr8/nate128/dev/repos/gpmaven/
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
|
@ -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')
|
||||||
|
}
|
|
@ -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
|
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
|
@ -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/
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 15 KiB |
|
@ -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>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">SampleTorApp</string>
|
||||||
|
</resources>
|
|
@ -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>
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
include ':tor-android-binary'
|
include ':tor-android-binary', ':sampletorapp'
|
||||||
|
|
|
@ -2,20 +2,21 @@ apply plugin: 'com.android.library'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 27
|
compileSdkVersion 27
|
||||||
buildToolsVersion '27.0.3'
|
buildToolsVersion '28.0.2'
|
||||||
|
|
||||||
|
/**
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
jni.srcDirs = []
|
jni.srcDirs = []
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}**/
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 3210
|
versionCode 34700
|
||||||
versionName "0.3.2.10"
|
versionName "0.3.4.7-rc"
|
||||||
|
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -39,7 +40,7 @@ uploadArchives {
|
||||||
pom.project {
|
pom.project {
|
||||||
groupId 'org.torproject'
|
groupId 'org.torproject'
|
||||||
artifactId 'tor-android-binary'
|
artifactId 'tor-android-binary'
|
||||||
version "0.3.2.10"
|
version "0.3.4.8-2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,4 @@
|
||||||
obfs4 154.35.22.10:15937 8FB9F4319E89E5C6223052AA525A192AFBC85D55 cert=GGGS1TX4R81m3r0HBl79wKy1OtPPNR2CZUIrHjkRg65Vc2VR8fOyo64f9kmT1UAFG7j0HQ iat-mode=0
|
obfs4 78.215.187.186:45675 AE907EE5FAA5D0D27E0C83EFA6ADF8E79FCC0FF1 cert=/TRjMo+RinKaixARMjMtZZBhystaBe+aDaapPrbiITFtWx3M/AJcvpjHjO54tJqLd1+IWQ iat-mode=0
|
||||||
obfs4 198.245.60.50:443 752CF7825B3B9EA6A98C83AC41F7099D67007EA5 cert=xpmQtKUqQ/6v5X7ijgYE/f03+l2/EuQ1dexjyUhh16wQlu/cpXUGalmhDIlhuiQPNEKmKw iat-mode=0
|
obfs4 107.160.7.24:443 7A0904F6D182B81BEFE0DEDAFEC974494672627B cert=a5/IlZMnDvb8d92LTHMfsBIgL7QlDLPiXiLwe85uedC80mGD0QerygzmsWnMEdwG9ER9Eg iat-mode=0
|
||||||
obfs4 192.99.11.54:443 7B126FAB960E5AC6A629C729434FF84FB5074EC2 cert=VW5f8+IBUWpPFxF+rsiVy2wXkyTQG7vEd+rHeN2jV5LIDNu8wMNEOqZXPwHdwMVEBdqXEw iat-mode=0
|
obfs4 79.136.160.201:46501 66AC975BF7CB429D057AE07FC0312C57D61BAEC1 cert=dCtn9Ya8z+R8YQikdWgC3XTAt58z5Apnm95QHrJwnhFSdnphPPEz+NMm6OawWc2srKLjJg 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
|
|
||||||
meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
RunAsDaemon 1
|
RunAsDaemon 1
|
||||||
AvoidDiskWrites 1
|
AvoidDiskWrites 0
|
||||||
ControlPort auto
|
ControlPort auto
|
||||||
SOCKSPort 0
|
SOCKSPort 0
|
||||||
DNSPort 0
|
DNSPort 0
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ public class TorResourceInstaller implements TorServiceConstants {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteDirectory(File file) {
|
private void deleteDirectory(File file) {
|
||||||
if( file.exists() ) {
|
if( file.exists() ) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
File[] files = file.listFiles();
|
File[] files = file.listFiles();
|
||||||
|
@ -58,21 +58,39 @@ public class TorResourceInstaller implements TorServiceConstants {
|
||||||
*/
|
*/
|
||||||
public boolean installResources () throws IOException, TimeoutException
|
public boolean installResources () throws IOException, TimeoutException
|
||||||
{
|
{
|
||||||
|
File fileTorLocalFile = new File(installFolder, TOR_ASSET_KEY);
|
||||||
|
|
||||||
deleteDirectory(installFolder);
|
deleteDirectory(installFolder);
|
||||||
|
|
||||||
installFolder.mkdirs();
|
installFolder.mkdirs();
|
||||||
|
|
||||||
|
installGeoIP();
|
||||||
assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, false, false);
|
assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, false, false);
|
||||||
|
|
||||||
InputStream is = new FileInputStream(new File(getNativeLibraryDir(context),TOR_ASSET_KEY + ".so"));
|
File fileNativeDir = new File(getNativeLibraryDir(context));
|
||||||
File outFile = new File(installFolder, TOR_ASSET_KEY);
|
Log.d(TAG,"listing native files");
|
||||||
streamToFile(is,outFile, false, true);
|
listf(fileNativeDir.getAbsolutePath());
|
||||||
setExecutable(outFile);
|
|
||||||
|
|
||||||
installGeoIP();
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +149,7 @@ public class TorResourceInstaller implements TorServiceConstants {
|
||||||
/*
|
/*
|
||||||
* Write the inputstream contents to the file
|
* 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];
|
byte[] buffer = new byte[FILE_WRITE_BUFFER_SIZE];
|
||||||
|
@ -176,4 +194,22 @@ public class TorResourceInstaller implements TorServiceConstants {
|
||||||
fileBin.setWritable(true, true);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,6 @@ public interface TorServiceConstants {
|
||||||
|
|
||||||
int FILE_WRITE_BUFFER_SIZE = 1024;
|
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";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|