Skip to content

Commit 335b384

Browse files
committed
added Emulator Detection logic
1 parent ef0735c commit 335b384

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

InsecureBankv2.apk

511 Bytes
Binary file not shown.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ public void onClick(View v) {
116116
protected void createUser() {
117117
Toasteroid.show(this, "Create User functionality is still Work-In-Progress!!", Toasteroid.STYLES.WARNING, Toasteroid.LENGTH_LONG);
118118

119-
120119
}
121120

122121
/*

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

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Activity;
44
import android.content.Intent;
5+
import android.os.Build;
56
import android.os.Bundle;
67
import android.view.Menu;
78
import android.view.MenuItem;
@@ -17,6 +18,8 @@
1718
import java.io.InputStreamReader;
1819
import java.io.OutputStreamWriter;
1920
import java.util.ArrayList;
21+
import com.marcohc.toasteroid.Toasteroid;
22+
2023

2124
/*
2225
The page that allows gives the user below functionalities
@@ -44,10 +47,10 @@ protected void onCreate(Bundle savedInstanceState) {
4447
uname = intent.getStringExtra("uname");
4548

4649
root_status =(TextView) findViewById(R.id.rootStatus);
47-
// Display root status
50+
// Display root status
4851
showRootStatus();
49-
50-
52+
// Display emulator status
53+
checkEmulatorStatus();
5154

5255
transfer_button = (Button) findViewById(R.id.trf_button);
5356
transfer_button.setOnClickListener(new View.OnClickListener() {
@@ -82,7 +85,36 @@ public void onClick(View v) {
8285
});
8386
}
8487

85-
void showRootStatus() {
88+
private void checkEmulatorStatus() {
89+
Boolean isEmulator = checkIfDeviceIsEmulator();
90+
if(isEmulator==true)
91+
{
92+
Toasteroid.show(this, "Application running on Emulator", Toasteroid.STYLES.ERROR, Toasteroid.LENGTH_LONG);
93+
}
94+
else
95+
{
96+
Toasteroid.show(this, "Application running on Real device", Toasteroid.STYLES.SUCCESS, Toasteroid.LENGTH_LONG);
97+
}
98+
}
99+
100+
private Boolean checkIfDeviceIsEmulator() {
101+
102+
if(Build.FINGERPRINT.startsWith("generic")
103+
|| Build.FINGERPRINT.startsWith("unknown")
104+
|| Build.MODEL.contains("google_sdk")
105+
|| Build.MODEL.contains("Emulator")
106+
|| Build.MODEL.contains("Android SDK built for x86")
107+
|| Build.MANUFACTURER.contains("Genymotion")
108+
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
109+
|| "google_sdk".equals(Build.PRODUCT))
110+
{
111+
return true;
112+
}
113+
return false;
114+
}
115+
116+
117+
void showRootStatus() {
86118
boolean isrooted = doesSuperuserApkExist("/system/app/Superuser.apk")||
87119
doesSUexist();
88120
if(isrooted==true)

README.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This is a major update to one of my previous projects - "InsecureBank". This vul
1313
* Local Encryption issues
1414
* Vulnerable Activity Components
1515
* Root Detection and Bypass
16+
* Emulator Detection and Bypass
1617
* Insecure Content Provider access
1718
* Insecure Webview implementation
1819
* Weak Cryptography implementation

0 commit comments

Comments
 (0)