Add 36c3 support. Add support for 3 connection profiles plus special
This commit is contained in:
parent
21e5605ec9
commit
d27b08f97c
6 changed files with 95 additions and 42 deletions
|
@ -32,10 +32,12 @@ import android.view.Menu;
|
|||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
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;
|
||||
import android.widget.ViewFlipper;
|
||||
|
@ -48,7 +50,12 @@ import java.util.List;
|
|||
|
||||
/* import android.util.Base64; */
|
||||
// API level 18 and up
|
||||
|
||||
enum Profile {
|
||||
PROFILE_UNFILTERED,
|
||||
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
|
||||
|
@ -88,6 +95,8 @@ public class WifiSetup extends Activity {
|
|||
private String s_username;
|
||||
private String s_password;
|
||||
private ViewFlipper flipper;
|
||||
Profile selected_profile;
|
||||
|
||||
|
||||
static String removeQuotes(String str) {
|
||||
int len = str.length();
|
||||
|
@ -141,23 +150,41 @@ public class WifiSetup extends Activity {
|
|||
}
|
||||
*/
|
||||
|
||||
ImageView img = (ImageView) findViewById(R.id.logo);
|
||||
img.setOnClickListener(new View.OnClickListener() {
|
||||
Spinner spinner = (Spinner) findViewById(R.id.profile);
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
logoclicks++;
|
||||
if (logoclicks == 4) {
|
||||
toastText("You're cute!");
|
||||
}
|
||||
if (logoclicks == 6) {
|
||||
toastText("Stop that!");
|
||||
}
|
||||
if (logoclicks == 7) {
|
||||
View logindata = findViewById(R.id.logindata);
|
||||
logindata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
public void onItemSelected(AdapterView<?> parent, View v, int position,
|
||||
long id) {
|
||||
View logindata = findViewById(R.id.logindata);;
|
||||
logindata.setVisibility(View.INVISIBLE);
|
||||
switch((int) id) {
|
||||
case 0:
|
||||
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?");
|
||||
break;
|
||||
case 3:
|
||||
selected_profile = Profile.PROFILE_SPECIAL;
|
||||
logindata.setVisibility(View.VISIBLE);
|
||||
toastText("Hi fellow special person!");
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btn = (Button) findViewById(R.id.button1);
|
||||
if (btn == null)
|
||||
|
@ -233,25 +260,37 @@ public class WifiSetup extends Activity {
|
|||
}
|
||||
|
||||
if (check5g.isChecked()) {
|
||||
ssid = "Camp2019";
|
||||
ssid = "36C3";
|
||||
} else {
|
||||
ssid = "Camp2019-legacy";
|
||||
ssid = "36C3-legacy";
|
||||
}
|
||||
subject_match = "/CN=radius.c3noc.net";
|
||||
altsubject_match = "DNS:radius.c3noc.net";
|
||||
|
||||
s_username = username.getText().toString();
|
||||
s_password = password.getText().toString();
|
||||
|
||||
realm = "";
|
||||
if (s_username.equals("") && s_password.equals("")) {
|
||||
s_username = "Camp2019";
|
||||
s_password = "Camp2019";
|
||||
} else {
|
||||
if (s_username.contains("@")) {
|
||||
int idx = s_username.indexOf("@");
|
||||
realm = s_username.substring(idx);
|
||||
}
|
||||
}
|
||||
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.
|
||||
|
@ -365,7 +404,7 @@ public class WifiSetup extends Activity {
|
|||
builder.setMessage(getString(R.string.ABOUT_CONTENT)+
|
||||
"\n\n"+pi.packageName+"\n"+
|
||||
"V"+pi.versionName+
|
||||
"C"+pi.versionCode+"-equi");
|
||||
"C"+pi.versionCode+"-syn");
|
||||
builder.setPositiveButton(getString(android.R.string.ok), null);
|
||||
builder.show();
|
||||
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/camp19logo.png
Normal file
BIN
app/src/main/res/drawable-hdpi/camp19logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/drawable-hdpi/ccc36c3.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ccc36c3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -27,7 +27,7 @@
|
|||
android:contentDescription="@string/LOGO"
|
||||
android:padding="0dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/camp19logo" />
|
||||
android:src="@drawable/ccc36c3" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -41,14 +41,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/c5ghz"/>
|
||||
<TextView
|
||||
android:id="@+id/label5g"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/l5ghz"
|
||||
android:textAlignment="center" />
|
||||
<TextView
|
||||
android:id="@+id/labelkeystore"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -58,6 +50,21 @@
|
|||
android:paddingRight="10dp"
|
||||
android:text="@string/lkeystore"
|
||||
android:textAlignment="center" />
|
||||
<TextView
|
||||
android:id="@+id/labelprofile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chooseprofile" />
|
||||
<Spinner
|
||||
android:id="@+id/profile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:prompt="@string/profile_select"
|
||||
android:entries="@array/profiles_array"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/logindata"
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<?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>Protect me = outbound traffic only</item>
|
||||
<item>I am special = custom username/password</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">CCC Camp 2019 Wifi Setup</string>
|
||||
<string name="app_name">36C3 Wifi Setup</string>
|
||||
|
||||
<string name="TITLE_LOGON">Please logon</string>
|
||||
<string name="Username">username@realm</string>
|
||||
|
@ -13,10 +13,11 @@
|
|||
<string name="l5ghz">(Unfortunately, autodetecting 5GHz support is broken…)</string>
|
||||
<string name="lkeystore">Note: if you have no screen lock, Android refuses to store the security settings!</string>
|
||||
|
||||
|
||||
<string name="chooseprofile">Choose your connection profile:</string>
|
||||
<string name="profile_select">Select profile</string>
|
||||
<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">Camp2019 Logo</string>
|
||||
<string name="LOGO">36c3 Logo</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue