From c3270a0b24ce793f6be662ea5e8e4de5f5f3e0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Wed, 8 May 2024 16:02:44 +0200 Subject: [PATCH] Disable some broken activities --- .../secuso/phishedu2/AwarenessActivity.java | 2 +- .../secuso/phishedu2/LevelIntroActivity.java | 6 +- .../backend/networkTasks/GetUrlsTask.java | 76 ++++++++----------- 3 files changed, 37 insertions(+), 47 deletions(-) diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java index cbabb7a..3765959 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/AwarenessActivity.java @@ -120,7 +120,7 @@ public void sendEmail(View view) { } else { // Input is OK send email // invoke Backendcontroller - BackendControllerImpl.getInstance().sendMail(from, to, userMessage); + //BackendControllerImpl.getInstance().sendMail(from, to, userMessage); // Pop up with go to E-Mail on your Smartphone showAlertDialog(); diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java index 06bad51..142dea1 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/LevelIntroActivity.java @@ -133,10 +133,12 @@ protected void onStartClick() { Class next_activity = URLTaskActivity.class; if (this.getLevel() == 0) { BackendControllerImpl.getInstance().skipLevel0(); - next_activity = AwarenessActivity.class; + BackendControllerImpl.getInstance().startLevel(1); + next_activity = LevelIntroActivity.class; } else if (this.getLevel() == 1) { - next_activity = FindAddressBarActivity.class; BackendControllerImpl.getInstance().skipLevel1(); + BackendControllerImpl.getInstance().startLevel(2); + next_activity = LevelIntroActivity.class; } else if (this.getLevel() == BackendControllerImpl.getInstance() .getLevelCount() - 1) { next_activity = AppEndActivity.class; diff --git a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java index 97ca6cd..6e800c0 100644 --- a/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java +++ b/app/src/main/java/de/tudarmstadt/informatik/secuso/phishedu2/backend/networkTasks/GetUrlsTask.java @@ -22,18 +22,6 @@ import android.os.AsyncTask; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.StatusLine; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Arrays; - -import de.tudarmstadt.informatik.secuso.phishedu2.backend.BackendControllerImpl; -import de.tudarmstadt.informatik.secuso.phishedu2.backend.BasePhishURL; import de.tudarmstadt.informatik.secuso.phishedu2.backend.PhishAttackType; import de.tudarmstadt.informatik.secuso.phishedu2.backend.PhishURL; @@ -56,38 +44,38 @@ public GetUrlsTask(UrlsLoadedListener controller){ protected PhishURL[] doInBackground(Integer... params) { - if(false){ - int count = params[0]; - this.type = PhishAttackType.NoPhish; - for(PhishAttackType type : PhishAttackType.values()){ - if(type.getValue() == params[1]){ - this.type=type; - break; - } - } - try { - String url = "https://api.no-phish.de/urls/"+this.type.toString()+".json"; - HttpResponse response = new DefaultHttpClient().execute(new HttpGet(url)); - StatusLine statusLine = response.getStatusLine(); - if(statusLine.getStatusCode() == HttpStatus.SC_OK){ - ByteArrayOutputStream out = new ByteArrayOutputStream(); - response.getEntity().writeTo(out); - out.close(); - BasePhishURL[] result = BackendControllerImpl.deserializeURLs(out.toString()); - if(result.length > count){ - result = Arrays.copyOf(result, count); - } - return result; - } else{ - //Closes the connection. - response.getEntity().getContent().close(); - throw new IOException(statusLine.getReasonPhrase()); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } +// if(false){ +// int count = params[0]; +// this.type = PhishAttackType.NoPhish; +// for(PhishAttackType type : PhishAttackType.values()){ +// if(type.getValue() == params[1]){ +// this.type=type; +// break; +// } +// } +// try { +// String url = "https://api.no-phish.de/urls/"+this.type.toString()+".json"; +// HttpResponse response = new DefaultHttpClient().execute(new HttpGet(url)); +// StatusLine statusLine = response.getStatusLine(); +// if(statusLine.getStatusCode() == HttpStatus.SC_OK){ +// ByteArrayOutputStream out = new ByteArrayOutputStream(); +// response.getEntity().writeTo(out); +// out.close(); +// BasePhishURL[] result = BackendControllerImpl.deserializeURLs(out.toString()); +// if(result.length > count){ +// result = Arrays.copyOf(result, count); +// } +// return result; +// } else{ +// //Closes the connection. +// response.getEntity().getContent().close(); +// throw new IOException(statusLine.getReasonPhrase()); +// } +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } return new PhishURL[0]; }