Skip to content

Commit

Permalink
medium_rasp_level_bug_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
effortlessdevsec committed Dec 11, 2023
1 parent 0001b72 commit c6a8f4b
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 18 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />


<permission
android:name="com.BugBazaar.permission.contacts"
android:protectionLevel="signature" />

<uses-feature
android:name="android.hardware.telephony"
android:required="false" />

<queries>
<intent>
<action android:name="android.intent.action.PICK" />
Expand All @@ -44,17 +47,18 @@
tools:replace="android:fullBackupContent"
tools:targetApi="31">
<activity
android:name=".ExternalAuthLogin" android:launchMode="singleTask"
android:exported="true">
android:name=".ExternalAuthLogin"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<data android:scheme="bugbazaar" />
<data android:host="externalAuthentication" />

<intent-filter>
<data android:scheme="bugbazaar"/>
<data android:host="externalAuthentication"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name="com.lingzhiyi.detectfridaxp.MainActivity"
Expand Down Expand Up @@ -160,10 +164,11 @@
<action android:name="com.BugBazaar.CUSTOMACT" />
</intent-filter>
</receiver>
<service android:name=".ui.components.SMSService"
android:exported="true"
android:enabled="true"/>

<service
android:name=".ui.components.SMSService"
android:enabled="true"
android:exported="true" />
<service
android:name="com.darvin.security.IsolatedService"
android:enabled="true"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/BugBazaar/ui/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ else if (switch3State) {


alertDialogManager.showRootedDeviceAlert(SplashActivity.this,"WE ARE IN PROGRESS");
finishAffinity();

}

Expand Down Expand Up @@ -145,8 +146,6 @@ public void onMagiskNotDetected() {
checkdetect.someMethod(SplashActivity.this);




}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void showRootedDeviceAlert(final Context context, String message) {
public void run() {
alertDialog.dismiss(); // Dismiss the dialog if it's still visible
((Activity) context).finish();
System.exit(0);

}
}, 2000);
}
Expand Down
39 changes: 39 additions & 0 deletions app/src/main/java/com/bug/hook/EmulatorCheckUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.bug.hook;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Vibrator;
import android.util.Log;

public class EmulatorCheckUtil {

public static boolean emulatorCheck(Context context) {
PackageManager packageManager = context.getPackageManager();

boolean hasCameraFlash = packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
boolean hasFingerprintSensor = packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT);
boolean hasVibration = hasVibrationCapability(context);

return !(hasCameraFlash && hasFingerprintSensor && hasVibration);
}

private static boolean hasVibrationCapability(Context context) {
try {
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator != null) {
// Check if the device supports vibration
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return vibrator.hasVibrator();
} else {
return true; // For devices before Android O, assume vibration support
}
}
} catch (Exception e) {
Log.e("EmulatorCheckUtil", "Error checking vibration capability: " + e.getMessage());
}

return false;
}
}

3 changes: 1 addition & 2 deletions app/src/main/java/com/bug/hook/checkdetect.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class checkdetect {

public void someMethod(final Context context) {

if ( emultorcheck.isEmulator(context)) {
if ( emultorcheck.isEmulator() || AdbEnabled.AdbEnabled1(context)) {

if (Looper.myLooper() == Looper.getMainLooper()) {
// You are on the UI thread, you can show the dialog directly
Expand All @@ -39,7 +39,6 @@ public void run() {
launchapp(context);
}


}

private void launchapp(Context context) {
Expand Down
53 changes: 32 additions & 21 deletions app/src/main/java/com/bug/hook/emultorcheck.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package com.bug.hook;

import android.app.ActivityManager;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.util.Log;

import java.util.HashSet;
import java.util.Set;

public class emultorcheck {


public static boolean isEmulator() {
return Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
|| Build.MODEL.contains("Android SDK built for x86")
|| Build.MANUFACTURER.contains("Genymotion")
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|| "google_sdk".equals(Build.PRODUCT);
}

static int[] sensorTypes = {
Sensor.TYPE_ACCELEROMETER,
Sensor.TYPE_AMBIENT_TEMPERATURE,
Expand All @@ -33,29 +49,33 @@ public class emultorcheck {
// Add more sensor types as needed
};

public static boolean isEmulator(Context context) {
Log.d("cool","hello");
SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
Sensor accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

static Set<Integer> emulatorSensorTypes = new HashSet<>();

static {
// Add sensor types that are commonly not available in emulators
emulatorSensorTypes.add(Sensor.TYPE_AMBIENT_TEMPERATURE);
emulatorSensorTypes.add(Sensor.TYPE_HEART_RATE);
emulatorSensorTypes.add(Sensor.TYPE_STEP_COUNTER);
emulatorSensorTypes.add(Sensor.TYPE_STEP_DETECTOR);
// Add more sensor types as needed
}

public static boolean isEmulator(Context context) {
Log.d("cool", "hello");
SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);

for (int sensorType : sensorTypes) {
Sensor sensor = sensorManager.getDefaultSensor(sensorType);
Log.d("hellocool", String.valueOf(sensor));

if (sensor == null) {

if (emulatorSensorTypes.contains(sensorType)) {

Log.d("hellocool", String.valueOf(sensorType));
// Sensor of the specified type is not available on this device (likely an emulator)
return true;
}


}


ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();

Expand All @@ -66,16 +86,7 @@ public static boolean isEmulator(Context context) {
isEmulator = true;
}

ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);



if (memoryInfo.lowMemory) {
// Low memory condition (may indicate emulator)
isEmulator = true;
}
// Add other checks if needed

return isEmulator;
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/darvin/security/DetectMagisk.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ private void checkForMagisk() {
try {
Log.d(TAG, "UID:" + Os.getuid());
if (serviceBinder.isMagiskPresent() || Native.isMagiskPresentNative() ) {
Log.d("hacker","detect");


if (listener != null) {
Log.d("hacker","detect");


listener.onMagiskDetected();
}
Expand All @@ -60,7 +60,7 @@ private void checkForMagisk() {
}
}
} catch (RemoteException e) {
Log.d("hacker","error");

}
}

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_main2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.darvin.security.MainActivity">

</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ buildscript {
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {

id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '8.1.0' apply false
id 'com.android.application' version '8.0.0' apply false
id 'com.android.library' version '8.0.0' apply false
}

0 comments on commit c6a8f4b

Please sign in to comment.