Skip to content

Commit 4c9230c

Browse files
author
Sébastiaan
committed
Initial commit
0 parents  commit 4c9230c

File tree

211 files changed

+13235
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+13235
-0
lines changed

.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Built application files
2+
*.apk
3+
*.ap_
4+
5+
# Files for the Dalvik VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# Generated files
12+
bin/
13+
gen/
14+
.idea/
15+
*.iml
16+
17+
# Gradle files
18+
.gradle/
19+
build/
20+
21+
# Local configuration file (sdk path, etc)
22+
local.properties
23+
24+
# Proguard folder generated by Eclipse
25+
proguard/
26+
27+
# Log Files
28+
*.log
29+
30+
# Keystore
31+
*.jks
32+
com_crashlytics_export_strings.xml
33+
crashlytics-build.properties
34+
build_release.sh
35+
password-keystore

LICENSE

+678
Large diffs are not rendered by default.

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#VPN.ht for Android
2+
3+
## Contributing
4+
5+
### Build Instructions
6+
7+
The [gradle build system](http://tools.android.com/tech-docs/new-build-system/user-guide) will fetch all dependencies and generate
8+
files you need to build the project. You first need to generate the
9+
local.properties (replace YOUR_SDK_DIR by your actual android sdk dir)
10+
file:
11+
12+
$ echo "sdk.dir=YOUR_SDK_DIR" > local.properties
13+
14+
You can now sync, build and install the project:
15+
16+
$ ./gradlew assembleDebug # assemble the debug .apk
17+
$ ./gradlew installDebug # install the debug .apk if you have an
18+
# emulator or an Android device connected
19+
20+
You can use [Android Studio](http://developer.android.com/sdk/installing/studio.html) by importing the project as a Gradle project.
21+
22+
##Copyright and License
23+
Code released under the [GPLv3](LICENSE). Images and user interface are copyrighted by VPN.ht Limited

app/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
fabric.properties

app/build.gradle

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
import groovy.swing.SwingBuilder
2+
3+
buildscript {
4+
repositories {
5+
jcenter()
6+
maven { url 'https://maven.fabric.io/public' }
7+
}
8+
9+
dependencies {
10+
classpath 'io.fabric.tools:gradle:1.19.1'
11+
classpath 'com.ofg:uptodate-gradle-plugin:1.5.0'
12+
}
13+
}
14+
15+
apply plugin: 'com.ofg.uptodate'
16+
apply plugin: 'com.android.application'
17+
apply plugin: 'io.fabric'
18+
19+
repositories {
20+
maven { url 'https://maven.fabric.io/public' }
21+
}
22+
23+
24+
android {
25+
compileSdkVersion 23
26+
buildToolsVersion "23.0.0"
27+
28+
defaultConfig {
29+
applicationId "ht.vpn.android"
30+
minSdkVersion 15
31+
targetSdkVersion 23
32+
versionCode 15
33+
versionName "1.2.2"
34+
resValue "string", "geokey", System.getenv("VPNHT_GEO_KEY").toString()
35+
}
36+
37+
signingConfigs {
38+
mainConfig {
39+
storeFile file(System.getenv("VPNHT_SIGN_STORE_FILE").toString())
40+
keyAlias System.getenv("VPNHT_KEY_ALIAS").toString()
41+
keyPassword 'password' // Fictive password to pass Gradle check
42+
storePassword 'password' // Fictive password to pass Gradle check
43+
}
44+
}
45+
46+
buildTypes {
47+
release {
48+
signingConfig signingConfigs.mainConfig
49+
minifyEnabled false
50+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
51+
}
52+
debug {
53+
applicationIdSuffix ".dev"
54+
}
55+
}
56+
}
57+
58+
dependencies {
59+
compile fileTree(dir: 'libs', include: ['*.jar'])
60+
compile 'com.android.support:support-v13:23.0.1'
61+
compile 'com.android.support:appcompat-v7:23.0.1'
62+
compile 'com.android.support:cardview-v7:23.0.1'
63+
compile 'com.android.support:recyclerview-v7:23.0.1'
64+
compile 'com.android.support:design:23.0.1'
65+
compile 'com.android.support:support-annotations:23.0.1'
66+
compile 'com.google.android.gms:play-services-maps:7.8.0'
67+
compile 'com.github.johnkil.android-robototextview:robototextview:2.4.0'
68+
compile 'com.jakewharton:butterknife:7.0.1'
69+
compile 'com.mobsandgeeks:android-saripaar:2.0.2'
70+
compile 'com.squareup.retrofit:retrofit:1.9.0'
71+
compile 'com.jakewharton.timber:timber:3.1.0'
72+
compile('com.crashlytics.sdk.android:crashlytics:2.2.4@aar') {
73+
transitive = true;
74+
}
75+
}
76+
77+
gradle.taskGraph.whenReady { taskGraph ->
78+
if(taskGraph.hasTask(':app:assembleRelease')) {
79+
80+
def pass = System.getenv("VPNHT_ALIAS_KEY") ? System.getenv("VPNHT_ALIAS_KEY").toString() : ''
81+
def store_pass = System.getenv("VPNHT_STORE_KEY") ? System.getenv("VPNHT_STORE_KEY").toString() : ''
82+
if(pass == '' || store_pass == '') {
83+
if (System.console() == null) {
84+
new SwingBuilder().edt {
85+
dialog(modal: true, // Otherwise the build will continue running before you closed the dialog
86+
title: 'Enter password', // Dialog title
87+
alwaysOnTop: true, // pretty much what the name says
88+
resizable: false, // Don't allow the user to resize the dialog
89+
locationRelativeTo: null, // Place dialog in center of the screen
90+
pack: true, // We need to pack the dialog (so it will take the size of it's children)
91+
show: true // Let's show it
92+
) {
93+
vbox { // Put everything below each other
94+
label(text: "Please enter storage passphrase:")
95+
input = passwordField()
96+
button(defaultButton: true, text: 'OK', actionPerformed: {
97+
store_pass = input.password;
98+
// Set pass variable to value of input field
99+
dispose(); // Close dialog
100+
})
101+
} // vbox end
102+
vbox { // Put everything below each other
103+
label(text: "Please enter key passphrase:")
104+
input = passwordField()
105+
button(defaultButton: true, text: 'OK', actionPerformed: {
106+
pass = input.password; // Set pass variable to value of input field
107+
dispose(); // Close dialog
108+
})
109+
} // vbox end
110+
} // dialog end
111+
} // edt end
112+
} else {
113+
store_pass = System.console().readPassword("\nPlease enter storage passphrase: ")
114+
store_pass = new String(store_pass)
115+
pass = System.console().readPassword("\nPlease enter key passphrase: ")
116+
pass = new String(pass)
117+
}
118+
119+
if (pass.size() <= 0) {
120+
throw new InvalidUserDataException("You must enter a password to proceed.")
121+
}
122+
}
123+
124+
android.signingConfigs.mainConfig.keyPassword = pass
125+
android.signingConfigs.mainConfig.storePassword = store_pass
126+
127+
} // end if has task
128+
} // end whenReady

app/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/Sebastiaan/Development/Android/SDK/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
package="ht.vpn.android">
4+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
8+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
9+
10+
<application
11+
android:name=".VPNhtApplication"
12+
android:allowBackup="true"
13+
android:icon="@mipmap/ic_launcher"
14+
android:label="@string/app_name"
15+
android:theme="@style/Theme.VPNht">
16+
17+
<activity
18+
android:name=".activities.MainActivity"
19+
android:screenOrientation="sensorPortrait">
20+
<intent-filter>
21+
<action android:name="android.intent.action.MAIN" />
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
26+
<activity
27+
android:name=".activities.LoginActivity"
28+
android:theme="@style/Theme.VPNht.Login"
29+
android:screenOrientation="sensorPortrait"
30+
/>
31+
<activity android:name=".activities.PreferencesActivity"
32+
android:screenOrientation="sensorPortrait" />
33+
<activity android:name=".activities.LogActivity"
34+
android:screenOrientation="sensorPortrait" />
35+
36+
<activity android:name=".activities.GrantPermissionsActivity">
37+
<intent-filter>
38+
<action android:name="android.intent.action.MAIN" />
39+
</intent-filter>
40+
</activity>
41+
<activity android:name=".activities.ConfirmAPIActivity">
42+
<intent-filter>
43+
<action android:name="android.intent.action.MAIN" />
44+
</intent-filter>
45+
</activity>
46+
<activity
47+
android:name=".LaunchVPN"
48+
android:autoRemoveFromRecents="true"
49+
android:excludeFromRecents="true"
50+
android:label="@string/vpn_launch_title"
51+
android:theme="@android:style/Theme.DeviceDefault.Light.Panel"
52+
tools:ignore="ExportedActivity">
53+
<intent-filter>
54+
<action android:name="android.intent.action.MAIN" />
55+
<category android:name="android.intent.category.DEFAULT" />-
56+
</intent-filter>
57+
</activity>
58+
59+
<activity
60+
android:name=".activities.DisconnectVPN"
61+
android:autoRemoveFromRecents="true"
62+
android:excludeFromRecents="true"
63+
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />
64+
65+
<service
66+
android:name="de.blinkt.openvpn.core.OpenVPNService"
67+
android:permission="android.permission.BIND_VPN_SERVICE">
68+
<intent-filter>
69+
<action android:name="android.net.VpnService" />
70+
</intent-filter>
71+
</service>
72+
73+
<service
74+
android:name=".api.ExternalOpenVPNService"
75+
tools:ignore="ExportedService">
76+
<intent-filter>
77+
<action android:name="ht.vpn.android.api.IOpenVPNAPIService" />
78+
</intent-filter>
79+
</service>
80+
81+
<receiver android:name=".OnBootReceiver" android:enabled="true" android:exported="true">
82+
<intent-filter android:priority="999">
83+
<action android:name="android.intent.action.BOOT_COMPLETED" />
84+
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
85+
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
86+
</intent-filter>
87+
</receiver>
88+
89+
<meta-data
90+
android:name="com.google.android.gms.version"
91+
android:value="@integer/google_play_services_version" />
92+
<meta-data
93+
android:name="com.google.android.geo.API_KEY"
94+
android:value="@string/geokey" />
95+
</application>
96+
97+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package ht.vpn.android.api;
2+
3+
parcelable APIVpnProfile;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// IOpenVPNAPIService.aidl
2+
package ht.vpn.android.api;
3+
4+
import ht.vpn.android.api.APIVpnProfile;
5+
import ht.vpn.android.api.IOpenVPNStatusCallback;
6+
7+
import android.content.Intent;
8+
import android.os.ParcelFileDescriptor;
9+
10+
interface IOpenVPNAPIService {
11+
List<APIVpnProfile> getProfiles();
12+
13+
void startProfile (String profileUUID);
14+
15+
/** Use a profile with all certificates etc. embedded,
16+
* old version which does not return the UUID of the addded profile, see
17+
* below for a version that return the UUID on add */
18+
boolean addVPNProfile (String name, String config);
19+
20+
/** start a profile using a config as inline string. Make sure that all needed data is inlined,
21+
* e.g., using <ca>...</ca> or <auth-user-data>...</auth-user-data>
22+
* See the OpenVPN manual page for more on inlining files */
23+
void startVPN (String name, String inlineconfig);
24+
25+
/** This permission framework is used to avoid confused deputy style attack to the VPN
26+
* calling this will give null if the app is allowed to use the external API and an Intent
27+
* that can be launched to request permissions otherwise */
28+
Intent prepare (String packagename);
29+
30+
/** Used to trigger to the Android VPN permission dialog (VPNService.prepare()) in advance,
31+
* if this return null OpenVPN for ANdroid already has the permissions otherwise you can start the returned Intent
32+
* to let OpenVPN for Android request the permission */
33+
Intent prepareVPNService ();
34+
35+
/* Disconnect the VPN */
36+
void disconnect();
37+
38+
/* Pause the VPN (same as using the pause feature in the notifcation bar) */
39+
void pause();
40+
41+
/* Resume the VPN (same as using the pause feature in the notifcation bar) */
42+
void resume();
43+
44+
boolean isConnectedOrConnecting();
45+
46+
/**
47+
* Registers to receive OpenVPN Status Updates
48+
*/
49+
void registerStatusCallback(IOpenVPNStatusCallback cb);
50+
51+
/**
52+
* Remove a previously registered callback interface.
53+
*/
54+
void unregisterStatusCallback(IOpenVPNStatusCallback cb);
55+
56+
/** Remove a profile by UUID */
57+
void removeProfile (String profileUUID);
58+
59+
/** Request a socket to be protected as a VPN socket would be. Useful for creating
60+
* a helper socket for an app controlling OpenVPN
61+
* Before calling this function you should make sure OpenVPN for Android may actually
62+
* this function by checking if prepareVPNService returns null; */
63+
boolean protectSocket(in ParcelFileDescriptor fd);
64+
65+
66+
/** Use a profile with all certificates etc. embedded */
67+
APIVpnProfile addNewVPNProfile (String name, boolean userEditable, String config);
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package ht.vpn.android.api;
2+
3+
/**
4+
* Example of a callback interface used by IRemoteService to send
5+
* synchronous notifications back to its clients. Note that this is a
6+
* one-way interface so the server does not block waiting for the client.
7+
*/
8+
oneway interface IOpenVPNStatusCallback {
9+
/**
10+
* Called when the service has a new status for you.
11+
*/
12+
void newStatus(String uuid, String state, String message, String level);
13+
}
5.31 KB
Binary file not shown.
5.05 KB
Binary file not shown.
5.07 KB
Binary file not shown.
5.19 KB
Binary file not shown.

app/src/main/assets/nopie_openvpn.x86

5.11 KB
Binary file not shown.
5.65 KB
Binary file not shown.
5.31 KB
Binary file not shown.
5.05 KB
Binary file not shown.
5.07 KB
Binary file not shown.

app/src/main/assets/pie_openvpn.mips

5.19 KB
Binary file not shown.

app/src/main/assets/pie_openvpn.x86

5.11 KB
Binary file not shown.
5.65 KB
Binary file not shown.

0 commit comments

Comments
 (0)