Skip to content

Commit 52870ff

Browse files
committed
Minor Updates
1 parent c66a932 commit 52870ff

6 files changed

Lines changed: 80 additions & 4 deletions

File tree

InsecureBankv2.apk

272 Bytes
Binary file not shown.

InsecureBankv2/.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

InsecureBankv2/app/app-debug.apk

272 Bytes
Binary file not shown.

InsecureBankv2/app/app-release.apk

774 Bytes
Binary file not shown.

InsecureBankv2/app/src/main/java/com/android/insecurebankv2/PostLogin.java

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
import android.view.MenuItem;
88
import android.view.View;
99
import android.widget.Button;
10+
import android.widget.EditText;
11+
import android.widget.TextView;
12+
13+
import java.io.BufferedReader;
14+
import java.io.BufferedWriter;
15+
import java.io.File;
16+
import java.io.IOException;
17+
import java.io.InputStreamReader;
18+
import java.io.OutputStreamWriter;
19+
import java.util.ArrayList;
1020

1121
/*
1222
The page that allows gives the user below functionalities
@@ -18,6 +28,8 @@
1828
public class PostLogin extends Activity {
1929
// The Button that handles the transfer activity
2030
Button transfer_button;
31+
// The Textview that handles the root status display
32+
TextView root_status;
2133
// The Button that handles the view transaction history activity
2234
Button statement_button;
2335
// The Button that handles the change password activity
@@ -30,6 +42,13 @@ protected void onCreate(Bundle savedInstanceState) {
3042
setContentView(R.layout.activity_post_login);
3143
Intent intent = getIntent();
3244
uname = intent.getStringExtra("uname");
45+
46+
root_status =(TextView) findViewById(R.id.rootStatus);
47+
// Display root status
48+
showRootStatus();
49+
50+
51+
3352
transfer_button = (Button) findViewById(R.id.trf_button);
3453
transfer_button.setOnClickListener(new View.OnClickListener() {
3554

@@ -63,9 +82,51 @@ public void onClick(View v) {
6382
});
6483
}
6584

66-
/*
67-
The page that allows the user to allow password change for the logged in user
68-
*/
85+
void showRootStatus() {
86+
boolean isrooted = doesSuperuserApkExist("/system/app/Superuser.apk")||
87+
doesSUexist();
88+
if(isrooted==true)
89+
{
90+
root_status.setText("Rooted Device!!");
91+
}
92+
else
93+
{
94+
root_status.setText("Device not Rooted!!");
95+
}
96+
}
97+
98+
private boolean doesSUexist() {
99+
Process process = null;
100+
try {
101+
process = Runtime.getRuntime().exec(new String[] { "/system/xbin/which", "su" });
102+
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
103+
if (in.readLine() != null) return true;
104+
return false;
105+
} catch (Throwable t) {
106+
return false;
107+
} finally {
108+
if (process != null) process.destroy();
109+
}
110+
111+
}
112+
113+
private boolean doesSuperuserApkExist(String s) {
114+
115+
File rootFile = new File("/system/app/Superuser.apk");
116+
Boolean doesexist = rootFile.exists();
117+
if(doesexist == true)
118+
{
119+
return(true);
120+
}
121+
else
122+
{
123+
return(false);
124+
}
125+
}
126+
127+
/*
128+
The page that allows the user to allow password change for the logged in user
129+
*/
69130
protected void changePasswd() {
70131
// TODO Auto-generated method stub
71132
Intent cP = new Intent(getApplicationContext(), ChangePassword.class);

InsecureBankv2/app/src/main/res/layout/activity_post_login.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,19 @@
4646
android:background="@drawable/roundbutton" />
4747
</TableRow>
4848

49+
<TableRow android:paddingTop="20px" android:gravity="center"
50+
android:layout_width="match_parent"
51+
android:paddingLeft="5dp" android:paddingRight="5dp">
52+
53+
<TextView
54+
android:id="@+id/rootStatus"
55+
android:text="Root Status"
56+
android:layout_weight="1"
57+
android:padding="20dp"
58+
android:textSize="30sp"
59+
android:textStyle="bold"
60+
android:gravity="center"
61+
android:textColor="#ff000fff"/>
62+
</TableRow>
63+
4964
</TableLayout>

0 commit comments

Comments
 (0)