Compare commits
12 commits
9ddc4af9bb
...
7a61d9f952
Author | SHA1 | Date | |
---|---|---|---|
|
7a61d9f952 | ||
|
1dd59eedb1 | ||
|
2310c95640 | ||
|
b42a127f47 | ||
|
b34c9e9674 | ||
|
052983b67d | ||
|
2870b97b89 | ||
|
6baf5196f7 | ||
|
fb248d405c | ||
|
f6574b00d0 | ||
|
6034026940 | ||
|
3342817dc3 |
3
.gitignore
vendored
|
@ -3,3 +3,6 @@
|
|||
build
|
||||
app/build
|
||||
app/release
|
||||
*.iml
|
||||
local.properties
|
||||
*.swp
|
||||
|
|
119
app/app.iml
|
@ -1,119 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,13 +1,12 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "27.0.2"
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
applicationId "nl.eventinfra.wifisetup"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 28
|
||||
targetSdkVersion 33
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="nl.eventinfra.wifisetup" android:installLocation="auto" android:versionCode="20191205" android:versionName="0.31">
|
||||
package="nl.eventinfra.wifisetup"
|
||||
android:installLocation="auto"
|
||||
android:versionCode="20231222"
|
||||
android:versionName="0.37">
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.wifi" android:required="true"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
|
@ -9,6 +12,7 @@
|
|||
<application android:allowBackup="false" android:label="@string/app_name" android:icon="@drawable/icon">
|
||||
<activity android:name="nl.eventinfra.wifisetup.WifiSetup"
|
||||
android:label="@string/app_name"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.Holo.Light">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.net.wifi.WifiEnterpriseConfig;
|
|||
import android.net.wifi.WifiEnterpriseConfig.Eap;
|
||||
import android.net.wifi.WifiEnterpriseConfig.Phase2;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wifi.WifiNetworkSuggestion;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -36,7 +37,6 @@ import android.widget.AdapterView;
|
|||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -45,6 +45,7 @@ import android.widget.ViewFlipper;
|
|||
import java.io.InputStream;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -55,7 +56,8 @@ enum Profile {
|
|||
PROFILE_SITEONLY,
|
||||
PROFILE_PROTECTME,
|
||||
PROFILE_SPECIAL
|
||||
};
|
||||
}
|
||||
|
||||
public class WifiSetup extends Activity {
|
||||
protected static final int SHOW_PREFERENCES = 0;
|
||||
// FIXME This should be a configuration setting somehow
|
||||
|
@ -133,13 +135,14 @@ public class WifiSetup extends Activity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.logon);
|
||||
|
||||
flipper = (ViewFlipper) findViewById(R.id.viewflipper);
|
||||
username = (EditText) findViewById(R.id.username);
|
||||
password = (EditText) findViewById(R.id.password);
|
||||
flipper = findViewById(R.id.viewflipper);
|
||||
username = findViewById(R.id.username);
|
||||
password = findViewById(R.id.password);
|
||||
|
||||
/*
|
||||
check5g = (CheckBox) findViewById(R.id.check5g);
|
||||
check5g.setChecked(true);
|
||||
/*
|
||||
|
||||
TextView label5g = (TextView) findViewById(R.id.label5g);
|
||||
if (android.os.Build.VERSION.SDK_INT >= 21) {
|
||||
check5g.setChecked(get5G());
|
||||
|
@ -150,22 +153,23 @@ public class WifiSetup extends Activity {
|
|||
}
|
||||
*/
|
||||
|
||||
Spinner spinner = (Spinner) findViewById(R.id.profile);
|
||||
Spinner spinner = findViewById(R.id.profile);
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View v, int position,
|
||||
long id) {
|
||||
View logindata = findViewById(R.id.logindata);;
|
||||
View logindata = findViewById(R.id.logindata);
|
||||
logindata.setVisibility(View.INVISIBLE);
|
||||
switch((int) id) {
|
||||
case 0:
|
||||
case 0:
|
||||
selected_profile = Profile.PROFILE_SITEONLY;
|
||||
toastText("You trust people on-site more than the internet! Thank you!");
|
||||
break;
|
||||
case 1:
|
||||
selected_profile = Profile.PROFILE_UNFILTERED;
|
||||
toastText("Don't filter me!");
|
||||
break;
|
||||
case 1:
|
||||
selected_profile = Profile.PROFILE_SITEONLY;
|
||||
toastText("You trust people on-site more than the internet! Thank you!");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
selected_profile = Profile.PROFILE_PROTECTME;
|
||||
toastText("You don't trust anyone? Or maybe not your device?");
|
||||
|
@ -186,7 +190,7 @@ public class WifiSetup extends Activity {
|
|||
}
|
||||
});
|
||||
|
||||
btn = (Button) findViewById(R.id.button1);
|
||||
btn = findViewById(R.id.button1);
|
||||
if (btn == null)
|
||||
throw new RuntimeException("button1 not found. Odd");
|
||||
btn.setOnClickListener(new Button.OnClickListener() {
|
||||
|
@ -199,9 +203,11 @@ public class WifiSetup extends Activity {
|
|||
|
||||
// Most of this stuff runs in the background
|
||||
Thread t = new Thread() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 18) {
|
||||
saveWifiConfig();
|
||||
resultStatus(true, "You should now have a wifi connection entry with correct security settings and certificate verification.\n\nMake sure to actually use it!");
|
||||
|
@ -240,59 +246,120 @@ public class WifiSetup extends Activity {
|
|||
}
|
||||
|
||||
private void saveWifiConfig() {
|
||||
/*
|
||||
ssid = "emfcamp";
|
||||
|
||||
subject_match = "/CN=radius.emf.camp";
|
||||
altsubject_match = "DNS:radius.emf.camp";
|
||||
// subject_match = "/CN=radius.synnack.net";
|
||||
// altsubject_match = "DNS:radius.synnack.net";
|
||||
|
||||
|
||||
realm = "";
|
||||
switch (selected_profile) {
|
||||
case PROFILE_UNFILTERED:
|
||||
s_username = "allowany";
|
||||
s_password = "allowany";
|
||||
break;
|
||||
case PROFILE_SITEONLY:
|
||||
s_username = "emf";
|
||||
s_password = "emf";
|
||||
break;
|
||||
case PROFILE_PROTECTME:
|
||||
s_username = "outboundonly";
|
||||
s_password = "outboundonly";
|
||||
break;
|
||||
case PROFILE_SPECIAL:
|
||||
s_username = username.getText().toString();
|
||||
s_password = password.getText().toString();
|
||||
if (s_username.contains("@")) {
|
||||
int idx = s_username.indexOf("@");
|
||||
realm = s_username.substring(idx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
StoreWifiProfile(ssid, subject_match, altsubject_match, s_username, s_password);
|
||||
*/
|
||||
|
||||
/*if (check5g.isChecked()) {
|
||||
ssid = "MCH2022";
|
||||
} else {
|
||||
ssid = "MCH2022-legacy";
|
||||
}*/
|
||||
ssid = "37C3";
|
||||
subject_match = "/CN=radius.c3noc.net";
|
||||
altsubject_match = "DNS:radius.c3noc.net";
|
||||
|
||||
realm = "";
|
||||
switch (selected_profile) {
|
||||
case PROFILE_UNFILTERED:
|
||||
s_username = "allowany";
|
||||
s_password = "allowany";
|
||||
break;
|
||||
case PROFILE_SITEONLY:
|
||||
s_username = "37c3";
|
||||
s_password = "37c3";
|
||||
break;
|
||||
case PROFILE_PROTECTME:
|
||||
s_username = "outboundonly";
|
||||
s_password = "outboundonly";
|
||||
break;
|
||||
case PROFILE_SPECIAL:
|
||||
s_username = username.getText().toString();
|
||||
s_password = password.getText().toString();
|
||||
if (s_username.contains("@")) {
|
||||
int idx = s_username.indexOf("@");
|
||||
realm = s_username.substring(idx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
StoreWifiProfile(ssid, subject_match, altsubject_match, s_username, s_password);
|
||||
}
|
||||
void StoreWifiProfile(String ssid, String subject_match, String altsubject_match, String s_username, String s_password) {
|
||||
|
||||
|
||||
// Enterprise Settings
|
||||
HashMap<String,String> configMap = new HashMap<>();
|
||||
configMap.put(INT_SUBJECT_MATCH, subject_match);
|
||||
configMap.put(INT_ALTSUBJECT_MATCH, altsubject_match);
|
||||
configMap.put(INT_ANONYMOUS_IDENTITY, "anonymous" + realm);
|
||||
configMap.put(INT_IDENTITY, s_username);
|
||||
configMap.put(INT_PASSWORD, s_password);
|
||||
configMap.put(INT_EAP, "TTLS");
|
||||
configMap.put(INT_PHASE2, "auth=PAP");
|
||||
configMap.put(INT_ENGINE, "0");
|
||||
|
||||
WifiManager wifiManager = (WifiManager) this.getApplicationContext().getSystemService(WIFI_SERVICE);
|
||||
if (wifiManager == null) {
|
||||
return;
|
||||
}
|
||||
WifiConfiguration currentConfig = new WifiConfiguration();
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 29) {
|
||||
try {
|
||||
|
||||
WifiNetworkSuggestion suggestion = new WifiNetworkSuggestion.Builder()
|
||||
.setSsid(ssid)
|
||||
.setWpa2EnterpriseConfig(applyAndroid43EnterpriseSettings(configMap)).build();
|
||||
wifiManager.addNetworkSuggestions(Arrays.asList(suggestion));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
wifiManager.setWifiEnabled(true);
|
||||
|
||||
WifiConfiguration currentConfig = new WifiConfiguration();
|
||||
|
||||
List<WifiConfiguration> configs = null;
|
||||
for (int i = 0; i < 10 && configs == null; i++) {
|
||||
configs = wifiManager.getConfiguredNetworks();
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
} catch (InterruptedException e) {
|
||||
// Do nothing ;-)
|
||||
}
|
||||
}
|
||||
|
||||
if (check5g.isChecked()) {
|
||||
ssid = "36C3";
|
||||
} else {
|
||||
ssid = "36C3-legacy";
|
||||
}
|
||||
subject_match = "/CN=radius.c3noc.net";
|
||||
altsubject_match = "DNS:radius.c3noc.net";
|
||||
|
||||
|
||||
realm = "";
|
||||
switch(selected_profile) {
|
||||
case PROFILE_UNFILTERED:
|
||||
s_username = "36C3";
|
||||
s_password = "36C3";
|
||||
break;
|
||||
case PROFILE_SITEONLY:
|
||||
s_username = "congressonly";
|
||||
s_password = "congressonly";
|
||||
break;
|
||||
case PROFILE_PROTECTME:
|
||||
s_username = "outboundonly";
|
||||
s_password = "outboundonly";
|
||||
break;
|
||||
case PROFILE_SPECIAL:
|
||||
s_username = username.getText().toString();
|
||||
s_password = password.getText().toString();
|
||||
if (s_username.contains("@")) {
|
||||
int idx = s_username.indexOf("@");
|
||||
realm = s_username.substring(idx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Use the existing ssid profile if it exists.
|
||||
boolean ssidExists = false;
|
||||
if (configs != null) {
|
||||
|
@ -304,7 +371,10 @@ public class WifiSetup extends Activity {
|
|||
}
|
||||
}
|
||||
}
|
||||
// This sets the CA certificate.
|
||||
currentConfig.enterpriseConfig = applyAndroid43EnterpriseSettings(configMap);
|
||||
|
||||
// General (old) config settings
|
||||
currentConfig.SSID = surroundWithQuotes(ssid);
|
||||
currentConfig.hiddenSSID = false;
|
||||
currentConfig.priority = 40;
|
||||
|
@ -332,19 +402,6 @@ public class WifiSetup extends Activity {
|
|||
currentConfig.allowedProtocols.clear();
|
||||
currentConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
|
||||
|
||||
// Enterprise Settings
|
||||
HashMap<String,String> configMap = new HashMap<>();
|
||||
configMap.put(INT_SUBJECT_MATCH, subject_match);
|
||||
configMap.put(INT_ALTSUBJECT_MATCH, altsubject_match);
|
||||
configMap.put(INT_ANONYMOUS_IDENTITY, "anonymous" + realm);
|
||||
configMap.put(INT_IDENTITY, s_username);
|
||||
configMap.put(INT_PASSWORD, s_password);
|
||||
configMap.put(INT_EAP, "TTLS");
|
||||
configMap.put(INT_PHASE2, "auth=PAP");
|
||||
configMap.put(INT_ENGINE, "0");
|
||||
|
||||
// This sets the CA certificate.
|
||||
applyAndroid43EnterpriseSettings(currentConfig, configMap);
|
||||
|
||||
if (!ssidExists) {
|
||||
int networkId = wifiManager.addNetwork(currentConfig);
|
||||
|
@ -358,7 +415,7 @@ public class WifiSetup extends Activity {
|
|||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
private void applyAndroid43EnterpriseSettings(WifiConfiguration currentConfig, HashMap<String,String> configMap) {
|
||||
private WifiEnterpriseConfig applyAndroid43EnterpriseSettings(HashMap<String,String> configMap) {
|
||||
try {
|
||||
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
|
||||
InputStream in = getResources().openRawResource(R.raw.cacert);
|
||||
|
@ -374,11 +431,14 @@ public class WifiSetup extends Activity {
|
|||
enterpriseConfig.setIdentity(s_username);
|
||||
enterpriseConfig.setPassword(s_password);
|
||||
enterpriseConfig.setSubjectMatch(configMap.get(INT_SUBJECT_MATCH));
|
||||
currentConfig.enterpriseConfig = enterpriseConfig;
|
||||
enterpriseConfig.setAltSubjectMatch(configMap.get(INT_ALTSUBJECT_MATCH));
|
||||
|
||||
return enterpriseConfig;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -420,8 +480,8 @@ public class WifiSetup extends Activity {
|
|||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TextView res_title = (TextView) findViewById(R.id.resulttitle);
|
||||
TextView res_text = (TextView) findViewById(R.id.result);
|
||||
TextView res_title = findViewById(R.id.resulttitle);
|
||||
TextView res_text = findViewById(R.id.result);
|
||||
|
||||
System.out.println(text);
|
||||
res_text.setText(text);
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/camp23logo.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/drawable-hdpi/ccc37c3logo.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
app/src/main/res/drawable-hdpi/emfmch2022.png
Normal file
After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 10 KiB |
|
@ -24,23 +24,23 @@
|
|||
android:id="@+id/logo"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="200dp"
|
||||
android:contentDescription="@string/LOGO"
|
||||
android:contentDescription="37C3 logo"
|
||||
android:padding="0dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ccc36c3" />
|
||||
android:src="@drawable/ccc37c3logo" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:autoLink="web"
|
||||
android:text="@string/twitter"/>
|
||||
android:text="@string/fediverse"/>
|
||||
|
||||
<CheckBox android:id="@+id/check5g"
|
||||
<!--<CheckBox android:id="@+id/check5g"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/c5ghz"/>
|
||||
android:text="@string/c5ghz"/>-->
|
||||
<TextView
|
||||
android:id="@+id/labelkeystore"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -84,7 +84,6 @@
|
|||
android:inputType="textEmailAddress"
|
||||
android:padding="5dp"
|
||||
>
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<EditText
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="profiles_array">
|
||||
<item>Enable me - no filters = full inbound/outbound</item>
|
||||
<item>Enable me on-site = outbound only, inbound from event</item>
|
||||
<item>Enable me - no filters = full inbound/outbound</item>
|
||||
<item>Protect me = outbound traffic only</item>
|
||||
<item>I am special = custom username/password</item>
|
||||
</string-array>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">36C3 Wifi Setup</string>
|
||||
<string name="app_name">37C3 Wifi Setup</string>
|
||||
|
||||
<string name="TITLE_LOGON">Please logon</string>
|
||||
<string name="Username">username@realm</string>
|
||||
<string name="Password">password</string>
|
||||
<string name="Logon">Create connection entry</string>
|
||||
|
||||
<string name="twitter">https://twitter.com/c3noc</string>
|
||||
<string name="fediverse">https://chaos.social/@c3noc</string>
|
||||
|
||||
<string name="c5ghz">This device supports the 5GHz band</string>
|
||||
<string name="l5ghz">(Unfortunately, autodetecting 5GHz support is broken…)</string>
|
||||
|
@ -18,6 +18,6 @@
|
|||
<string name="ABOUT_TITLE">About</string>
|
||||
<string name="EXIT_TITLE">Exit</string>
|
||||
|
||||
<string name="ABOUT_CONTENT">This small helper app creates a Wifi connection entry for the CCC/EMF/SHA2017 networks. It configures the correct SSL CA and subject name match, making it a little more secure than a hand-created entry.</string>
|
||||
<string name="LOGO">36c3 Logo</string>
|
||||
<string name="ABOUT_CONTENT">This small helper app creates a Wifi connection entry for the CCC/EMF/MCH2022 networks. It configures the correct SSL CA and subject name match, making it a little more secure than a hand-created entry.</string>
|
||||
<string name="LOGO">Chaos Communication Camp Logo</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Fri Dec 22 12:53:58 CET 2017
|
||||
#Fri Aug 16 14:23:16 CEST 2019
|
||||
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-6.0.1-all.zip
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
## This file is automatically generated by Android Studio.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Fri Dec 22 13:13:03 CET 2017
|
||||
ndk.dir=/home/wilco/Android/Sdk/ndk-bundle
|
||||
sdk.dir=/home/wilco/Android/Sdk
|