Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/main/java/com/devadvance/rootcloak2/DefaultLists.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class DefaultLists {
"root", "busybox", "titanium",
".tmpsu", "su", "rootcloak2"};

public static final String[] DEFAULT_COMMAND_LIST = new String[]{"su", "which", "busybox", "pm", "am", "sh", "ps"};
public static final String[] DEFAULT_COMMAND_LIST = new String[]{"su", "which", "busybox", "pm", "am", "sh", "ps", "getprop"};

public static final String[] DEFAULT_LIBNAME_LIST = new String[]{"tool-checker"}; // RootBearNative
public static final String[] DEFAULT_LIBNAME_LIST = new String[]{}; // off
}
133 changes: 129 additions & 4 deletions app/src/main/java/com/devadvance/rootcloak2/RootCloak.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import de.robv.android.xposed.callbacks.XCallback;


import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedHelpers.findConstructorExact;

Expand Down Expand Up @@ -101,12 +100,12 @@ private void initOther(final LoadPackageParam lpparam) {
}
}

// Tell the app that SELinux is enforcing, even if it is not.
// Tell the app that SELinux is disabled
findAndHookMethod("android.os.SystemProperties", lpparam.classLoader, "get", String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
if (((String) param.args[0]).equals("ro.build.selinux")) {
param.setResult("1");
param.setResult("");
if (debugPref) {
XposedBridge.log("SELinux is enforced.");
}
Expand All @@ -128,6 +127,130 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
}
});

// RootBeer hooks

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeerNative", lpparam.classLoader, "checkForRoot",
Object[].class,
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "detectRootManagementApps",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "detectPotentiallyDangerousApps",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "checkForBinary",
String.class,
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "checkForDangerousProps",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "checkForRWPaths",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "detectTestKeys",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "checkSuExists",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "checkForRootNative",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}

try {
findAndHookMethod("com.scottyab.rootbeer.RootBeer", lpparam.classLoader, "detectRootCloakingApps",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return false;
}
});
} catch (XposedHelpers.ClassNotFoundError e) {
e.printStackTrace();
}
}

/**
Expand Down Expand Up @@ -248,7 +371,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { // Ho
}

List<ApplicationInfo> packages = (List<ApplicationInfo>) param.getResult(); // Get the results from the method call
Iterator<ApplicationInfo> iter = packages.iterator();
Iterator<ApplicationInfo> iter = packages.iterator();
ApplicationInfo tempAppInfo;
String tempPackageName;

Expand Down Expand Up @@ -519,6 +642,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.setThrowable(new IOException());
} else if (commandSet.contains("sh") && (firstParam.equals("sh") || firstParam.endsWith("/sh"))) {
param.setThrowable(new IOException());
} else if (commandSet.contains("getprop") && (firstParam.equals("getprop") || firstParam.endsWith("/getprop"))) {
param.setResult(Runtime.getRuntime().exec("echo"));
} else {
param.setThrowable(new IOException());
}
Expand Down