ex 3 flag 1,2,4 done

This commit is contained in:
Mariano Sciacco
2021-03-11 11:45:03 +01:00
parent df6ac7bfb0
commit 80058a51fd
2 changed files with 38 additions and 27 deletions

View File

@@ -3,6 +3,7 @@ package com.example.justask;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity; import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@@ -12,10 +13,10 @@ import java.util.ArrayList;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
// FLAG 1: // FLAG 1: FLAG{Gutta_cavat_
// FLAG 2: lapidem_non_vi // FLAG 2: lapidem_non_vi
// FLAG 3: // FLAG 3:
// FLAG 4: // FLAG 4: _cadendo}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -23,8 +24,21 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
// "com.example.victimapp/.PartOne" // "com.example.victimapp/.PartOne"
Intent callIntent = new Intent("com.example.victimapp.intent.action.JUSTASK");
startActivityForResult(callIntent, 0); Intent callIntent1 = new Intent();
callIntent1.setComponent(ComponentName.unflattenFromString("com.example.victimapp/.PartOne"));
startActivityForResult(callIntent1, 1);
Intent callIntent2 = new Intent("com.example.victimapp.intent.action.JUSTASK");
startActivityForResult(callIntent2, 2);
Intent callIntent3 = new Intent();
callIntent3.setComponent(ComponentName.unflattenFromString("com.example.victimapp/.PartThree"));
startActivityForResult(callIntent3, 1);
Intent callIntent4 = new Intent("com.example.victimapp.intent.action.JUSTASKBUTNOTSOSIMPLE");
startActivityForResult(callIntent4, 4);
// Intent resultIntent = new Intent(); // Intent resultIntent = new Intent();
// setResult(Activity.RESULT_OK, resultIntent); // setResult(Activity.RESULT_OK, resultIntent);
@@ -40,30 +54,30 @@ public class MainActivity extends AppCompatActivity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
Log.d("MOBIOTSEC", "code: "+ resultCode); Log.d("MOBIOTSEC", "> Part Code: "+ resultCode);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
Log.d("MOBIOTSEC", "res: " + data.getExtras().toString());
// do your task
} else if (resultCode == RESULT_CANCELED) {
// do your task
Log.d("MOBIOTSEC", "error");
}
else
{
Bundle extra = data.getExtras(); Bundle extra = data.getExtras();
/*for (String key: extra.keySet()) /*
for (String key: extra.keySet())
{ {
Log.d ("MOBIOTSEC", key + " is a key in the bundle"); Log.d ("MOBIOTSEC", key + " is a key in the bundle");
}*/ }*/
Log.d("MOBIOTSEC", "Last"); if(resultCode == 4) {
Log.d("MOBIOTSEC", "res: " + extra.getString("flag"));
} int count = 1;
String currentVar = "follow";
while(!currentVar.equals("never ending story")) {
extra = extra.getBundle(currentVar);
currentVar = extra.keySet().iterator().next();
count++;
Log.d ("MOBIOTSEC", currentVar + " is a key in the bundle "+count);
} }
Log.d("MOBIOTSEC", ">> FLAG (follow the value... 6 TIMES RLY?): " + extra.getString("never ending story"));
} else {
Log.d("MOBIOTSEC", ">> FLAG: " + extra.getString("flag"));
}
} }
} }

View File

@@ -1,5 +1,2 @@
--------- beginning of system
--------- beginning of main --------- beginning of main
03-11 09:46:22.771 12254 12254 D MOBIOTSEC: code: 2 --------- beginning of system
03-11 09:46:22.771 12254 12254 D MOBIOTSEC: Last
03-11 09:46:22.771 12254 12254 D MOBIOTSEC: res: lapidem_non_vi