Skip to content

Commit

Permalink
Merged ApiAdd & HealthCheck in HealthCheck button
Browse files Browse the repository at this point in the history
jaiswalakshansh committed Nov 16, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 2ada02c commit af038ad
Showing 5 changed files with 18 additions and 24 deletions.
Binary file modified DamnVulnerableBank/app/release/dvba.apk
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@@ -97,14 +98,7 @@ protected void onCreate(Bundle savedInstanceState) {

}

public void addApi(View view){
SharedPreferences pref = getApplicationContext().getSharedPreferences("apiurl", MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
EditText ed=findViewById(R.id.apiurl);
final String api =ed.getText().toString().trim();
editor.putString("apiurl", api);
editor.apply();
}


public void loginPage(View view){
Intent intent =new Intent(getApplicationContext(), BankLogin.class);
@@ -117,6 +111,12 @@ public void signupPage(View view){
}

public void healthCheck(View v){
SharedPreferences pref = getApplicationContext().getSharedPreferences("apiurl", MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
EditText ed=findViewById(R.id.apiurl);
final String api =ed.getText().toString().trim();
editor.putString("apiurl", api);
editor.apply();
final View vButton = findViewById(R.id.healthc);
final Button bButton = (Button) findViewById(R.id.healthc);
RequestQueue queue = Volley.newRequestQueue(this);
@@ -147,11 +147,14 @@ public void healthCheck(View v){
@Override
public void onResponse(String response) {
bButton.setText("Api is Up");
bButton.setTextColor(Color.GREEN);

}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
bButton.setText("Api is Down");
bButton.setTextColor(Color.RED);
}
});
queue.add(stringRequest);
23 changes: 7 additions & 16 deletions DamnVulnerableBank/app/src/main/res/layout/activity_banklogin.xml
Original file line number Diff line number Diff line change
@@ -69,17 +69,6 @@
</LinearLayout>


<Button
android:id="@+id/healthc"
android:layout_width="98dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="healthCheck"
android:text="Health Check"
android:textColor="@color/white" />


<EditText
@@ -91,13 +80,15 @@
android:hint="API URL e.g http://127.0.0.1:8000" />

<Button
android:id="@+id/addapi"
android:layout_width="wrap_content"
android:id="@+id/healthc"
android:layout_width="98dp"
android:layout_height="wrap_content"
android:layout_marginLeft="150dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addApi"
android:text="Add API"
android:onClick="healthCheck"
android:text="Health Check"
android:textColor="@color/white" />


Binary file modified dvba.apk
Binary file not shown.
Binary file modified images/screen1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit af038ad

Please sign in to comment.