Prepare for EMF 2022 and MCH 2022

This commit is contained in:
Wilco Baan Hofman 2022-05-24 14:20:50 +02:00
parent fb248d405c
commit 6baf5196f7
9 changed files with 80 additions and 51 deletions

View file

@ -137,6 +137,7 @@ public class WifiSetup extends Activity {
username = (EditText) findViewById(R.id.username); username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password); password = (EditText) findViewById(R.id.password);
check5g = (CheckBox) findViewById(R.id.check5g); check5g = (CheckBox) findViewById(R.id.check5g);
check5g.setChecked(true); check5g.setChecked(true);
/* /*
@ -159,13 +160,14 @@ public class WifiSetup extends Activity {
logindata.setVisibility(View.INVISIBLE); logindata.setVisibility(View.INVISIBLE);
switch((int) id) { switch((int) id) {
case 0: case 0:
selected_profile = Profile.PROFILE_UNFILTERED;
toastText("Don't filter me!");
break;
case 1:
selected_profile = Profile.PROFILE_SITEONLY; selected_profile = Profile.PROFILE_SITEONLY;
toastText("You trust people on-site more than the internet! Thank you!"); toastText("You trust people on-site more than the internet! Thank you!");
break; break;
case 1:
selected_profile = Profile.PROFILE_UNFILTERED;
toastText("Don't filter me!");
break;
case 2: case 2:
selected_profile = Profile.PROFILE_PROTECTME; selected_profile = Profile.PROFILE_PROTECTME;
toastText("You don't trust anyone? Or maybe not your device?"); toastText("You don't trust anyone? Or maybe not your device?");
@ -240,43 +242,20 @@ public class WifiSetup extends Activity {
} }
private void saveWifiConfig() { private void saveWifiConfig() {
WifiManager wifiManager = (WifiManager) this.getApplicationContext().getSystemService(WIFI_SERVICE);
if (wifiManager == null) {
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) {
// Do nothing ;-)
}
}
if (check5g.isChecked()) {
ssid = "36C3";
} else {
ssid = "36C3-legacy";
}
subject_match = "/CN=radius.c3noc.net";
altsubject_match = "DNS:radius.c3noc.net";
subject_match = "/CN=radius.emf.camp";
altsubject_match = "DNS:radius.emf.camp";
realm = ""; realm = "";
switch (selected_profile) { switch (selected_profile) {
case PROFILE_UNFILTERED: case PROFILE_UNFILTERED:
s_username = "36C3"; s_username = "allowany";
s_password = "36C3"; s_password = "allowany";
break; break;
case PROFILE_SITEONLY: case PROFILE_SITEONLY:
s_username = "congressonly"; s_username = "emf";
s_password = "congressonly"; s_password = "emf";
break; break;
case PROFILE_PROTECTME: case PROFILE_PROTECTME:
s_username = "outboundonly"; s_username = "outboundonly";
@ -291,8 +270,60 @@ public class WifiSetup extends Activity {
} }
break; break;
} }
StoreWifiProfile(ssid, subject_match, altsubject_match, s_username, s_password);
// MCH2022
if (check5g.isChecked()) {
ssid = "MCH2022";
} else {
ssid = "MCH2022-legacy";
}
subject_match = "/CN=radius.mch2022.nl";
altsubject_match = "DNS:radius.mch2022.nl";
realm = "";
switch (selected_profile) {
case PROFILE_UNFILTERED:
s_username = "allowany";
s_password = "allowany";
break;
case PROFILE_SITEONLY:
s_username = "mch2022";
s_password = "mch2022";
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) {
WifiManager wifiManager = (WifiManager) this.getApplicationContext().getSystemService(WIFI_SERVICE);
if (wifiManager == null) {
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) {
// Do nothing ;-)
}
}
// Use the existing ssid profile if it exists. // Use the existing ssid profile if it exists.
boolean ssidExists = false; boolean ssidExists = false;
if (configs != null) { if (configs != null) {
@ -304,7 +335,6 @@ public class WifiSetup extends Activity {
} }
} }
} }
currentConfig.SSID = surroundWithQuotes(ssid); currentConfig.SSID = surroundWithQuotes(ssid);
currentConfig.hiddenSSID = false; currentConfig.hiddenSSID = false;
currentConfig.priority = 40; currentConfig.priority = 40;

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -24,10 +24,10 @@
android:id="@+id/logo" android:id="@+id/logo"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="200dp" android:layout_height="200dp"
android:contentDescription="@string/LOGO" android:contentDescription="EMF logo"
android:padding="0dp" android:padding="0dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ccc36c3" /> android:src="@drawable/emfmch2022" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -84,7 +84,6 @@
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
android:padding="5dp" android:padding="5dp"
> >
<requestFocus />
</EditText> </EditText>
<EditText <EditText

Binary file not shown.

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string-array name="profiles_array"> <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 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>Protect me = outbound traffic only</item>
<item>I am special = custom username/password</item> <item>I am special = custom username/password</item>
</string-array> </string-array>

View file

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">36C3 Wifi Setup</string> <string name="app_name">EMF/MCH 2022 Wifi Setup</string>
<string name="TITLE_LOGON">Please logon</string> <string name="TITLE_LOGON">Please logon</string>
<string name="Username">username@realm</string> <string name="Username">username@realm</string>
<string name="Password">password</string> <string name="Password">password</string>
<string name="Logon">Create connection entry</string> <string name="Logon">Create connection entry</string>
<string name="twitter">https://twitter.com/c3noc</string> <string name="twitter">https://twitter.com/emfnoc\nhttps://twitter.com/mch2022noc</string>
<string name="c5ghz">This device supports the 5GHz band</string> <string name="c5ghz">This device supports the 5GHz band</string>
<string name="l5ghz">(Unfortunately, autodetecting 5GHz support is broken&#8230;)</string> <string name="l5ghz">(Unfortunately, autodetecting 5GHz support is broken&#8230;)</string>
@ -18,6 +18,6 @@
<string name="ABOUT_TITLE">About</string> <string name="ABOUT_TITLE">About</string>
<string name="EXIT_TITLE">Exit</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="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">36c3 Logo</string> <string name="LOGO">EMF / MCH 2022 Logos</string>
</resources> </resources>