Compare commits
67 Commits
tor-androi
...
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 | |
n8fr8 | 51c7a076a5 | |
n8fr8 | 1b1f64d376 | |
n8fr8 | 9abac285db | |
n8fr8 | 808f9594f5 | |
n8fr8 | 810eafd6e5 | |
n8fr8 | c0bca9f762 | |
Nathan Freitas | 9897c1208e | |
Nathan Freitas | d194eb8064 | |
Unpublished | 97990103aa | |
Unpublished | 8383c1abbc | |
Unpublished | d43fbf96b9 | |
Unpublished | 99eb75aeaf | |
Unpublished | 5e0169d762 | |
n8fr8 | 93f5239bea | |
n8fr8 | 57ba718e75 | |
n8fr8 | b4cdbff06b | |
n8fr8 | b9a30b71d0 | |
n8fr8 | 3d0e9a93a6 | |
n8fr8 | 1ebf0a5c2c | |
n8fr8 | 3403b02dd8 | |
n8fr8 | 13d0bddc8c | |
n8fr8 | fa5aff40cc | |
Igor Oliveira | 1b1c0b9537 | |
n8fr8 | d64f15533f |
|
@ -10,10 +10,6 @@
|
|||
path = external/openssl
|
||||
url = https://github.com/openssl/openssl.git
|
||||
ignore = dirty
|
||||
[submodule "external/polipo"]
|
||||
path = external/polipo
|
||||
url = https://github.com/jech/polipo.git
|
||||
ignore = dirty
|
||||
[submodule "external/zstd"]
|
||||
path = external/zstd
|
||||
url = https://github.com/facebook/zstd.git
|
||||
|
|
28
BUILD
|
@ -8,8 +8,6 @@ Orbot includes, in the external directory, git repo submodules of:
|
|||
- LibEvent
|
||||
- JTorControl: The Tor Control Library for Java
|
||||
|
||||
The Orbot repo also includes the Polipo source code of a recent stable release.
|
||||
|
||||
Please install the following prerequisites (instructions for each follows):
|
||||
ant: http://ant.apache.org/
|
||||
Android Native Dev Kit or NDK (for C/C++ code):
|
||||
|
@ -26,30 +24,12 @@ Android platform supports (ICS 4.x or android-15)
|
|||
|
||||
Be sure that you have all of the git submodules up-to-date:
|
||||
|
||||
git submodule update --init --recursive
|
||||
./tor-droid-make.sh fetch
|
||||
|
||||
To begin building, from the Orbot root directory, you first need to build all
|
||||
external C/native dependencies:
|
||||
To begin building, from the Orbot root directory, it builds all submodules and
|
||||
the project.
|
||||
|
||||
export ANDROID_NDK_HOME={PATH TO YOUR NDK INSTALL}
|
||||
make -C external
|
||||
|
||||
At this point, you'll have Tor and Polipo binaries that can be run on an
|
||||
Android handset. You can verify the ARM binary was properly built using the
|
||||
following command:
|
||||
|
||||
file external/bin/tor external/bin/polipo
|
||||
|
||||
You should see something like:
|
||||
external/bin/tor: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
|
||||
dynamically linked (uses shared libs), not stripped
|
||||
external/bin/polipo: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
|
||||
dynamically linked (uses shared libs), not stripped
|
||||
|
||||
This isn't enough though and we'll now sew up the binary into a small package
|
||||
that will handle basic Tor controlling features.
|
||||
|
||||
android update project --name Orbot --target android-15 --path .
|
||||
./tor-droid-make.sh build
|
||||
|
||||
Now build the Android app
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath 'com.android.tools.build:gradle:3.2.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)),)
|
||||
|
@ -103,8 +105,7 @@ endif
|
|||
libevent libevent-clean \
|
||||
lzma lzma-clean \
|
||||
zstd zstd-clean \
|
||||
tor tor-clean \
|
||||
polipo polipo-clean
|
||||
tor tor-clean
|
||||
|
||||
all: assets
|
||||
|
||||
|
@ -126,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
|
||||
|
||||
|
@ -137,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
|
||||
|
||||
|
@ -255,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
|
||||
|
@ -281,45 +281,22 @@ tor-clean:
|
|||
git reset HEAD --hard
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# polipo
|
||||
#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
|
||||
|
||||
polipo-build-stamp:
|
||||
CC="$(CC)" CFLAGS="$(PIEFLAGS)" LDFLAGS="$(PIEFLAGS)" $(MAKE) -C polipo
|
||||
touch polipo-build-stamp
|
||||
|
||||
polipo: polipo-build-stamp
|
||||
test -d bin || mkdir bin
|
||||
cp polipo/polipo bin
|
||||
|
||||
polipo-clean:
|
||||
$(MAKE) -C polipo clean
|
||||
-rm -f polipo/polipo
|
||||
-rm -f bin/polipo
|
||||
-rm -f polipo-build-stamp
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
#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
|
||||
|
||||
assets: tor polipo
|
||||
install -d ../tor-android-binary/src/main/assets/$(APP_ABI)
|
||||
-$(STRIP) bin/polipo
|
||||
-zip ../tor-android-binary/src/main/assets/$(APP_ABI)/polipo.mp3 bin/polipo
|
||||
assets: tor
|
||||
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)/polipo.mp3
|
||||
-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
|
||||
|
||||
##clean: openssl-clean libevent-clean tor-clean polipo-clean assets-clean
|
||||
clean: openssl-clean libevent-clean lzma-clean zstd-clean tor-clean polipo-clean
|
||||
clean: openssl-clean libevent-clean lzma-clean zstd-clean tor-clean
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# debugging stuff
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c51b159cff9f5e86696f5b9a4c6f517276056258
|
||||
Subproject commit 90ae4c5013032158bafad41279823d90eec4d206
|
|
@ -1 +1 @@
|
|||
Subproject commit 081314d07705aa58912845c213a48414d8f616a9
|
||||
Subproject commit e71ebf275da66dfd601c92e0e80a35114c32f6f8
|
|
@ -1 +0,0 @@
|
|||
Subproject commit bdbc1603d05801205dcf47898c9f07dbcfc6febf
|
|
@ -1 +1 @@
|
|||
Subproject commit 727d3f1b5e6eeda721339151e3cd49ffa7efbb29
|
||||
Subproject commit da95b91355248ad8f3a6aa6733cc6d24915f59ce
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#Tue Oct 31 09:37:18 EDT 2017
|
||||
#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.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
|
@ -6,42 +6,6 @@
|
|||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
|
@ -60,6 +24,46 @@ cd "`dirname \"$PRG\"`/" >/dev/null
|
|||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
|
@ -85,7 +89,7 @@ location of your Java installation."
|
|||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
|
@ -150,11 +154,19 @@ if $cygwin ; then
|
|||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
|
@ -46,10 +46,9 @@ echo location of your Java installation.
|
|||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
|
@ -60,11 +59,6 @@ set _SKIP=2
|
|||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/bash
|
||||
# bash is required because we need bash's printf to guarantee a cross-platform
|
||||
# timestamp format.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ -z $ANDROID_HOME ]; then
|
||||
if [ -e ~/.android/bashrc-ant-build ]; then
|
||||
. ~/.android/bashrc-ant-build
|
||||
else
|
||||
echo "ANDROID_HOME must be set!"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z $ANDROID_NDK_HOME ]; then
|
||||
if which ndk-build 2>&1 /dev/null; then
|
||||
ANDROID_NDK_HOME=`which ndk-build | sed 's,/ndk-build,,'`
|
||||
else
|
||||
echo "ANDROID_NDK_HOME not set and 'ndk-build' not in PATH"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# reset version code/name to current date
|
||||
versionCodeDate=`date +%s`
|
||||
versionNameDate=`date +%Y-%m-%d_%H.%M.%S`
|
||||
|
||||
sed -i \
|
||||
-e "s,android:versionCode=\"[0-9][0-9]*\",android:versionCode=\"$versionCodeDate\"," \
|
||||
-e "s,android:versionName=\"\([^\"][^\"]*\)\",android:versionName=\"\1.$versionNameDate\"," \
|
||||
AndroidManifest.xml
|
||||
|
||||
ndk-build
|
||||
make -C external
|
||||
./setup-ant
|
|
@ -1,103 +0,0 @@
|
|||
#!/bin/bash
|
||||
# bash is required because we need bash's printf to guarantee a cross-platform
|
||||
# timestamp format.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# make sure we're on a signed tag that matches the version name
|
||||
versionName=`sed -n 's,.*versionName="\([^"]*\)".*,\1,p' AndroidManifest.xml`
|
||||
describe=`git describe`
|
||||
if [ $versionName != $describe ]; then
|
||||
echo "WARNING: building $describe, which is not the latest release ($versionName)"
|
||||
else
|
||||
# make a clearer warning above by putting this here
|
||||
set +x
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Checking git tag signature for release build:"
|
||||
gpg --list-key 9F0FE587374BBE81 || gpg --recv-key 9F0FE587374BBE81
|
||||
gpg --list-key E9E28DEA00AA5556 || gpg --recv-key E9E28DEA00AA5556
|
||||
gpg --list-key A801183E69B37AA9 || gpg --recv-key A801183E69B37AA9
|
||||
git tag -v $versionName
|
||||
echo ""
|
||||
echo ""
|
||||
set -x
|
||||
fi
|
||||
|
||||
|
||||
if [ -z $ANDROID_HOME ]; then
|
||||
if [ -e ~/.android/bashrc-ant-build ]; then
|
||||
. ~/.android/bashrc-ant-build
|
||||
else
|
||||
echo "ANDROID_HOME must be set!"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z $ANDROID_NDK_HOME ]; then
|
||||
if which ndk-build 2>&1 /dev/null; then
|
||||
ANDROID_NDK_HOME=`which ndk-build | sed 's,/ndk-build,,'`
|
||||
else
|
||||
echo "ANDROID_NDK_HOME not set and 'ndk-build' not in PATH"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
projectroot=`pwd`
|
||||
projectname=`sed -n 's,.*name="app_name">\(.*\)<.*,\1,p' app/src/main/res/values/strings.xml`
|
||||
|
||||
# standardize timezone to reduce build differences
|
||||
export TZ=UTC
|
||||
TIMESTAMP=`printf '%(%Y-%m-%d %H:%M:%S)T' \
|
||||
$(git log -n1 --format=format:%at)`
|
||||
|
||||
git reset --hard
|
||||
git clean -fdx
|
||||
git submodule foreach git reset --hard
|
||||
git submodule foreach git clean -fdx
|
||||
git submodule sync
|
||||
git submodule foreach git submodule sync
|
||||
git submodule update --init --recursive
|
||||
|
||||
|
||||
if [ -e ~/.android/ant.properties ]; then
|
||||
cp ~/.android/ant.properties $projectroot/
|
||||
else
|
||||
echo "skipping release ant.properties"
|
||||
fi
|
||||
|
||||
cd $projectroot/orbotservice/src/main
|
||||
faketime "$TIMESTAMP" $ANDROID_NDK_HOME/ndk-build
|
||||
cd $projectroot
|
||||
|
||||
#clean, build, clean and build!
|
||||
make -C external clean
|
||||
APP_ABI=armeabi faketime "$TIMESTAMP" make -C external
|
||||
#make -C external clean
|
||||
#APP_ABI=x86 faketime "$TIMESTAMP" make -C external
|
||||
|
||||
./gradlew assembleRelease
|
||||
#./setup-ant
|
||||
#ant release
|
||||
|
||||
#apk=$projectroot/bin/$projectname-v$describe.apk
|
||||
apk=$projectroot/app/build/outputs/apk/app-release-unsigned.apk
|
||||
|
||||
# standardize timestamps in ZIP headers, requires strip-nondeterminism 0.014
|
||||
if which strip-nondeterminism > /dev/null; then
|
||||
strip-nondeterminism -t zip -T $(git log -n1 --format=format:%at) $apk
|
||||
fi
|
||||
|
||||
# echo the checksum to build logs
|
||||
sha256sum $apk
|
||||
|
||||
if which gpg > /dev/null; then
|
||||
if [ -z "`gpg --list-secret-keys`" ]; then
|
||||
echo "No GPG secret keys found, not signing APK"
|
||||
else
|
||||
gpg --armor --detach-sign $apk
|
||||
fi
|
||||
else
|
||||
echo "gpg not found, not signing APK"
|
||||
fi
|
|
@ -10,3 +10,4 @@
|
|||
|
||||
# Project target.
|
||||
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'
|
||||
|
|
|
@ -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 319
|
||||
versionName "0.3.1.9"
|
||||
targetSdkVersion 27
|
||||
versionCode 34700
|
||||
versionName "0.3.4.7-rc"
|
||||
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -27,10 +28,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:appcompat-v7:25.4.0'
|
||||
compile 'com.jrummyapps:android-shell:1.0.1'
|
||||
compile fileTree(dir: 'libs', include: ['*.jar','*.so'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
implementation fileTree(dir: 'libs', include: ['*.so'])
|
||||
}
|
||||
|
||||
apply plugin: 'maven'
|
||||
|
@ -42,7 +40,7 @@ uploadArchives {
|
|||
pom.project {
|
||||
groupId 'org.torproject'
|
||||
artifactId 'tor-android-binary'
|
||||
version "0.3.1.9"
|
||||
version "0.3.4.8-2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package org.torproject.android.service;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
proxyAddress = "127.0.0.1"
|
||||
proxyPort = 8118
|
||||
allowedClients = 127.0.0.1
|
||||
allowedPorts = 1-65535
|
||||
proxyName = "127.0.0.1"
|
||||
cacheIsShared = false
|
||||
socksParentProxy = "127.0.0.1:9050"
|
||||
socksProxyType = socks5
|
||||
diskCacheRoot = ""
|
||||
localDocumentRoot = ""
|
||||
disableLocalInterface = true
|
||||
disableConfiguration = true
|
||||
dnsUseGethostbyname = yes
|
||||
disableVia = true
|
||||
censoredHeaders = from,accept-language,x-pad,link
|
||||
censorReferer = maybe
|
||||
maxConnectionAge = 5m
|
||||
maxConnectionRequests = 120
|
||||
serverMaxSlots = 8
|
||||
serverSlots = 2
|
||||
tunnelAllowedPorts = 1-65535
|
||||
chunkHighMark = 512000
|
||||
objectHighMark = 128
|
|
@ -1,8 +1,8 @@
|
|||
RunAsDaemon 1
|
||||
AvoidDiskWrites 1
|
||||
AvoidDiskWrites 0
|
||||
ControlPort auto
|
||||
SOCKSPort 0
|
||||
DNSPort 0
|
||||
TransPort 0
|
||||
CookieAuthentication 1
|
||||
DisableNetwork 1
|
||||
DisableNetwork 1
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -3,21 +3,20 @@
|
|||
|
||||
package org.torproject.android.binary;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.StringBufferInputStream;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
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;
|
||||
|
||||
|
@ -35,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();
|
||||
|
@ -52,51 +51,56 @@ public class TorResourceInstaller implements TorServiceConstants {
|
|||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
private final static String COMMAND_RM_FORCE = "rm -f ";
|
||||
private final static String MP3_EXT = ".mp3";
|
||||
|
||||
//
|
||||
/*
|
||||
* Extract the Tor resources from the APK file using ZIP
|
||||
*/
|
||||
public boolean installResources () throws IOException, FileNotFoundException, TimeoutException
|
||||
public boolean installResources () throws IOException, TimeoutException
|
||||
{
|
||||
|
||||
InputStream is;
|
||||
File outFile;
|
||||
|
||||
String cpuPath = "armeabi";
|
||||
|
||||
if (Build.CPU_ABI.contains("x86"))
|
||||
cpuPath = "x86";
|
||||
File fileTorLocalFile = new File(installFolder, TOR_ASSET_KEY);
|
||||
|
||||
deleteDirectory(installFolder);
|
||||
|
||||
installFolder.mkdirs();
|
||||
|
||||
is = context.getAssets().open(COMMON_ASSET_KEY + TORRC_ASSET_KEY);
|
||||
outFile = new File(installFolder, TORRC_ASSET_KEY);
|
||||
streamToFile(is,outFile, false, false);
|
||||
|
||||
is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY);
|
||||
outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY);
|
||||
streamToFile(is,outFile, false, false);
|
||||
|
||||
is = context.getAssets().open(cpuPath + '/' + TOR_ASSET_KEY + MP3_EXT);
|
||||
outFile = new File(installFolder, TOR_ASSET_KEY);
|
||||
streamToFile(is,outFile, false, true);
|
||||
setExecutable(outFile);
|
||||
|
||||
is = context.getAssets().open(cpuPath + '/' + POLIPO_ASSET_KEY + MP3_EXT);
|
||||
outFile = new File(installFolder, POLIPO_ASSET_KEY);
|
||||
streamToFile(is,outFile, false, true);
|
||||
setExecutable(outFile);
|
||||
|
||||
installGeoIP();
|
||||
|
||||
return true;
|
||||
assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, false, false);
|
||||
|
||||
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())
|
||||
|
@ -114,64 +118,38 @@ public class TorResourceInstaller implements TorServiceConstants {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean updatePolipoConfig (File filePolipo, String extraLines) throws IOException, FileNotFoundException, TimeoutException
|
||||
{
|
||||
|
||||
InputStream is;
|
||||
|
||||
is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY);
|
||||
streamToFile(is,filePolipo, false, false);
|
||||
|
||||
if (extraLines != null && extraLines.length() > 0)
|
||||
{
|
||||
StringBufferInputStream sbis = new StringBufferInputStream('\n' + extraLines + '\n');
|
||||
streamToFile(sbis,filePolipo,true,false);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean installPolipoConf () throws IOException, FileNotFoundException, TimeoutException
|
||||
{
|
||||
|
||||
InputStream is;
|
||||
File outFile;
|
||||
|
||||
is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY);
|
||||
outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY);
|
||||
streamToFile(is,outFile, false, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the Tor binary from the APK file using ZIP
|
||||
*/
|
||||
|
||||
private boolean installGeoIP () throws IOException, FileNotFoundException
|
||||
private boolean installGeoIP () throws IOException
|
||||
{
|
||||
|
||||
InputStream is;
|
||||
File outFile;
|
||||
|
||||
outFile = new File(installFolder, GEOIP_ASSET_KEY);
|
||||
is = context.getAssets().open(COMMON_ASSET_KEY + GEOIP_ASSET_KEY + MP3_EXT);
|
||||
streamToFile(is, outFile, false, true);
|
||||
|
||||
is = context.getAssets().open(COMMON_ASSET_KEY + GEOIP6_ASSET_KEY + MP3_EXT);
|
||||
outFile = new File(installFolder, GEOIP6_ASSET_KEY);
|
||||
streamToFile(is, outFile, false, true);
|
||||
|
||||
assetToFile(COMMON_ASSET_KEY + GEOIP_ASSET_KEY, GEOIP_ASSET_KEY, false, false);
|
||||
|
||||
assetToFile(COMMON_ASSET_KEY + GEOIP6_ASSET_KEY, GEOIP6_ASSET_KEY, false, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads file from assetPath/assetKey writes it to the install folder
|
||||
*/
|
||||
private void assetToFile(String assetPath, String assetKey, boolean isZipped, boolean isExecutable) throws IOException {
|
||||
InputStream is = context.getAssets().open(assetPath);
|
||||
File outFile = new File(installFolder, assetKey);
|
||||
streamToFile(is, outFile, false, isZipped);
|
||||
if (isExecutable) {
|
||||
setExecutable(outFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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];
|
||||
|
@ -216,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,19 +14,12 @@ public interface TorServiceConstants {
|
|||
|
||||
String COMMON_ASSET_KEY = "common/";
|
||||
|
||||
//privoxy
|
||||
String POLIPO_ASSET_KEY = "polipo";
|
||||
|
||||
//privoxy.config
|
||||
String POLIPOCONFIG_ASSET_KEY = "torpolipo.conf";
|
||||
|
||||
//geoip data file asset key
|
||||
String GEOIP_ASSET_KEY = "geoip";
|
||||
String GEOIP6_ASSET_KEY = "geoip6";
|
||||
|
||||
int FILE_WRITE_BUFFER_SIZE = 1024;
|
||||
|
||||
String BINARY_TOR_VERSION = "0.3.1.9-openssl1.0.2k";
|
||||
|
||||
String BINARY_TOR_VERSION = "0.3.4.8-openssl1.0.2p-1";
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
libs
|
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
fetch_submodules()
|
||||
{
|
||||
if [ -n "$1" ]; then
|
||||
echo "Cleaning repository"
|
||||
git reset --hard
|
||||
git clean -fdx
|
||||
git submodule foreach git reset --hard
|
||||
git submodule foreach git clean -fdx
|
||||
fi
|
||||
echo "Fetching git submodules"
|
||||
git submodule sync
|
||||
git submodule foreach git submodule sync
|
||||
git submodule update --init --recursive
|
||||
}
|
||||
|
||||
check_android_dependencies()
|
||||
{
|
||||
if [ -z $ANDROID_HOME ]; then
|
||||
echo "ANDROID_HOME must be set!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -z $ANDROID_NDK_HOME ]; then
|
||||
echo "ANDROID_NDK_HOME not set and 'ndk-build' not in PATH"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
build_external_dependencies()
|
||||
{
|
||||
check_android_dependencies
|
||||
APP_ABI=armeabi make -C external clean
|
||||
APP_ABI=armeabi make -C external
|
||||
APP_ABI=x86 make -C external clean
|
||||
APP_ABI=x86 make -C external
|
||||
}
|
||||
|
||||
build_app()
|
||||
{
|
||||
echo "Building tor-android"
|
||||
build_external_dependencies
|
||||
$ANDROID_HOME/tools/android update project --name $2 --target $3 --path ./tor-android-binary/src/main/
|
||||
|
||||
if [ -z $1 ] || [ $1 = 'debug' ]; then
|
||||
./gradlew assembleDebug
|
||||
else
|
||||
./gradlew assembleRelease
|
||||
fi
|
||||
}
|
||||
|
||||
show_options()
|
||||
{
|
||||
echo "usage: ./tor-droid-make.sh command arguments"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " fetch Fetch git submodules"
|
||||
echo " build Build the project"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -b Build type, it can be release or debug (default: debug)"
|
||||
echo " -c Clean the repository (Used together with the fetch command)"
|
||||
echo " -n Project name (default: tor-android-binary)"
|
||||
echo " -t Project target (default: android-23)"
|
||||
echo ""
|
||||
exit
|
||||
}
|
||||
|
||||
option=$1
|
||||
build_type="debug"
|
||||
name="tor-android-binary"
|
||||
target="android-23"
|
||||
|
||||
if [ -z $option ]; then
|
||||
show_options
|
||||
fi
|
||||
shift
|
||||
|
||||
while getopts 'c:b:n:t' opts; do
|
||||
case $opts in
|
||||
c) clean=clean ;;
|
||||
b) build_type=${OPTARG:-$build_type} ;;
|
||||
n) name=${OPTARG:-$Orbot} ;;
|
||||
t) target=${OPTARG:-$target} ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$option" in
|
||||
"fetch") fetch_submodules $clean ;;
|
||||
"build") build_app $build_type $name $target ;;
|
||||
*) show_options ;;
|
||||
esac
|