Skip to content

Commit

Permalink
Disable some broken activities
Browse files Browse the repository at this point in the history
  • Loading branch information
udenr committed May 8, 2024
1 parent 31c865a commit c3270a0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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];
}

Expand Down

0 comments on commit c3270a0

Please sign in to comment.