From 685da193ea29f3e7a8a42d55747dfb2f956f23b6 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 30 Sep 2019 23:10:01 +0200 Subject: remove hard coded demo setup, use real pt.demo.bitmask.net demo provider --- .../custom/assets/ptdemo.bitmask.eip-service.json | 49 ------------- app/src/custom/assets/ptdemo.bitmask.net.json | 43 ------------ app/src/custom/assets/ptdemo.bitmask.secrets.json | 5 -- .../java/se/leap/bitmaskclient/StartActivity.java | 82 ---------------------- 4 files changed, 179 deletions(-) delete mode 100644 app/src/custom/assets/ptdemo.bitmask.eip-service.json delete mode 100644 app/src/custom/assets/ptdemo.bitmask.net.json delete mode 100644 app/src/custom/assets/ptdemo.bitmask.secrets.json (limited to 'app/src') diff --git a/app/src/custom/assets/ptdemo.bitmask.eip-service.json b/app/src/custom/assets/ptdemo.bitmask.eip-service.json deleted file mode 100644 index d804d032..00000000 --- a/app/src/custom/assets/ptdemo.bitmask.eip-service.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "serial": 3, - "version": 3, - "locations": { - "Amsterdam": { - "name": "Amsterdam", - "country_code": "NL", - "hemisphere": "N", - "timezone": "-1" - } - }, - "gateways": [ - { - "host": "pt.demo.bitmask.net", - "ip_address": "37.218.247.60", - "location": "Amsterdam", - "capabilities": { - "adblock": false, - "filter_dns": false, - "limited": false, - "transport": [ - {"type": "openvpn", - "protocols": ["tcp"], - "ports": ["443"] - }, - {"type": "obfs4", - "protocols": ["tcp"], - "options": {"cert": "gZlp9k6br2vn2MLnmjXpNh8D/CrR5wtackwZof/iICv1QzPwkkTUa+7JVOKtPiD0NFwCMw", "iat-mode": "0"}, - "ports": ["23042"] - } - ] - } - } - ], - "openvpn_configuration": { - "auth": "SHA1", - "cipher": "AES-256-CBC", - "dev": "tun", - "keepalive": "10 30", - "key-direction": "1", - "nobind": "True", - "persist-key": "True", - "rcvbuf": "0", - "sndbuf": "0", - "tls-cipher": "DHE-RSA-AES128-SHA", - "tun-ipv6": "True", - "verb": "3" - } -} \ No newline at end of file diff --git a/app/src/custom/assets/ptdemo.bitmask.net.json b/app/src/custom/assets/ptdemo.bitmask.net.json deleted file mode 100644 index 98afaa54..00000000 --- a/app/src/custom/assets/ptdemo.bitmask.net.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "api_uri": "https://leech.demo.bitmask.net:8000", - "api_version": "3", - "ca_cert_fingerprint": "SHA256: 0f17c033115f6b76ff67871872303ff65034efe7dd1b910062ca323eb4da5c7e", - "ca_cert_uri": "https://leech.demo.bitmask.net:8000/ca.crt", - "default_language": "en", - "description": { - "el": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", - "en": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", - "es": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted." - }, - "domain": "demo.bitmask.net", - "enrollment_policy": "open", - "languages": [ - "de", - "en", - "es", - "pt" - ], - "name": { - "de": "Bitmask Pluggable Transports", - "en": "Bitmask Pluggable Transports" - }, - "service": { - "allow_anonymous": true, - "allow_free": true, - "allow_limited_bandwidth": false, - "allow_paid": false, - "allow_registration": true, - "allow_unlimited_bandwidth": true, - "bandwidth_limit": 102400, - "default_service_level": 1, - "levels": { - "1": { - "description": "Please donate.", - "name": "free" - } - } - }, - "services": [ - "openvpn" - ] -} \ No newline at end of file diff --git a/app/src/custom/assets/ptdemo.bitmask.secrets.json b/app/src/custom/assets/ptdemo.bitmask.secrets.json deleted file mode 100644 index 85900ea3..00000000 --- a/app/src/custom/assets/ptdemo.bitmask.secrets.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ca_cert":"-----BEGIN CERTIFICATE-----\nMIIFbzCCA1egAwIBAgIBATANBgkqhkiG9w0BAQ0FADBKMRgwFgYDVQQDDA9CaXRt\nYXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNVBAsME2h0dHBzOi8v\nYml0bWFzay5uZXQwHhcNMTIxMTA2MDAwMDAwWhcNMjIx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GBANzz\nDxWpFsvnKWRrvwQunUrPYO3s9MNFE2ak1/gjfBnS/5oBcGY0gUIrsr/qQOP6kQHx\n21gjZsLq0oHW57dQhs+288YS+hOBkP3pW9X8y38sViu9H4qCbn5AByxdhMNzooHQ\n9AFVx7rU7t8o+8YdNwLmKtuut1tzhoML3b/jU3RpAoGAU7xl3nCnNQJ8N9spoTn9\nfhwct7cQd6JIfMZlWq8bUvnhhJ/3W0AqB/GRuzvw6MJRqxPLsvuOx1ddNgmJvjXy\nAbZhNdgiESo56EQABZr5jaG0k6qOTWuk9nY/CNHflIkXsyJH0GfWdHOEBQacb/NV\nklqdRW9QjFcs6bN9bNw5QL0CgYBRiH/whk0bQVpM7FW4vVrd2Fj0c5R+2mamYf4w\nWyfYf7xCoHVRwd5RBL8ZguAfQL9x8EX46FdrZiv4Lc2kH9sfm2uplCckO5O9nvd8\np6SQcVP7H/cbrbYIcKg0/u2XEnzNWsYwF+90Sk87mmwOV4mNUFJQbtDKtn7UrPRP\ncxvAwQKBgD+wKwZWM/yEBaJKHA6XLbKlTrb27bKDBNTt8Pk8BK0uYcZLryIQtZY5\nokyJniA9rv38R5URRAIRwXXDxxIumuWk69CY92dYA5y1tm0ooPG8OFEbSWTBIh74\n3dKEnhNvHVpNQkUd67LlfWsS51YbMCpwqyxI9YPtRwWMGho8R+Ty\n-----END RSA PRIVATE KEY-----" -} \ No newline at end of file diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index 945429fd..b89363b2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -25,36 +25,20 @@ import android.support.annotation.IntDef; import android.support.annotation.Nullable; import android.util.Log; -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import de.blinkt.openvpn.core.Preferences; import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.eip.EipCommand; -import se.leap.bitmaskclient.utils.PreferenceHelper; -import static se.leap.bitmaskclient.BuildConfig.useDemoConfig; import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE; import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION; -import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.MainActivity.ACTION_SHOW_VPN_FRAGMENT; -import static se.leap.bitmaskclient.Provider.CA_CERT; -import static se.leap.bitmaskclient.Provider.MAIN_URL; import static se.leap.bitmaskclient.utils.ConfigHelper.isDefaultBitmask; import static se.leap.bitmaskclient.utils.PreferenceHelper.getSavedProviderFromSharedPreferences; import static se.leap.bitmaskclient.utils.PreferenceHelper.providerInSharedPreferences; @@ -106,10 +90,6 @@ public class StartActivity extends Activity{ // initialize app necessities VpnStatus.initLogCache(getApplicationContext().getCacheDir()); - if (useDemoConfig) { - demoSetup(); - } - prepareEIP(); } @@ -235,66 +215,4 @@ public class StartActivity extends Activity{ startActivity(intent); finish(); } - - private String getInputAsString(InputStream fileAsInputStream) throws IOException { - BufferedReader br = new BufferedReader(new InputStreamReader(fileAsInputStream)); - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - while (line != null) { - sb.append(line); - line = br.readLine(); - } - - return sb.toString(); - } - - private void demoSetup() { - try { - //set demo data - String demoEipServiceJson = getInputAsString(getAssets().open("ptdemo.bitmask.eip-service.json")); - String secrets = getInputAsString(getAssets().open("ptdemo.bitmask.secrets.json")); - String provider = getInputAsString(getAssets().open("ptdemo.bitmask.net.json")); - - Log.d(TAG, "setup provider: " + provider); - Log.d(TAG, "setup eip json: " + demoEipServiceJson); - JSONObject secretsJson = new JSONObject(secrets); - - preferences.edit().putString(PROVIDER_EIP_DEFINITION+".demo.bitmask.net", demoEipServiceJson). - putString(PROVIDER_EIP_DEFINITION, demoEipServiceJson). - putString(CA_CERT, secretsJson.getString(CA_CERT)). - putString(PROVIDER_PRIVATE_KEY, secretsJson.getString(PROVIDER_PRIVATE_KEY)). - putString(PROVIDER_VPN_CERTIFICATE, secretsJson.getString(PROVIDER_VPN_CERTIFICATE)). - putString(Provider.KEY, provider). - putString(MAIN_URL, "https://demo.bitmask.net"). - putBoolean(PROVIDER_CONFIGURED, true).commit(); - - PreferenceHelper.getSavedProviderFromSharedPreferences(preferences); - ProviderObservable.getInstance().updateProvider(PreferenceHelper.getSavedProviderFromSharedPreferences(preferences)); - - // remove last used profiles - SharedPreferences prefs = Preferences.getDefaultSharedPreferences(this); - SharedPreferences.Editor prefsedit = prefs.edit(); - prefsedit.remove("lastConnectedProfile").commit(); - File f = new File(this.getCacheDir().getAbsolutePath() + "/android.conf"); - if (f.exists()) { - Log.d(TAG, "android.conf exists -> delete:" + f.delete()); - } - - File filesDirectory = new File(this.getFilesDir().getAbsolutePath()); - if (filesDirectory.exists() && filesDirectory.isDirectory()) { - File[] filesInDirectory = filesDirectory.listFiles(); - for (File file : filesInDirectory) { - Log.d(TAG, "delete profile: " + file.getName() + ": "+ file.delete()); - - } - } else Log.d(TAG, "file folder doesn't exist"); - - } catch (IOException e) { - e.printStackTrace(); - } catch (JSONException e) { - e.printStackTrace(); - } - - } - } -- cgit v1.2.3