Help! Root Protection

JohnnyCappucino

Platinian
Aug 26, 2023
20
5
3
24
Sweden
You can either codify simple root-checks in the main activity of lgl, or utilize tools specifically created to protect APKs, so it could implement an algorithm to verify if rooted or not.
 

Kaorin333

Solid & Active Platinian
Jun 11, 2022
89
9
8
34
Germany
write it in any language you want...

C:
string pathFile = "/system/bin/su";
if(pathFile.Exist()){
    print("Root detected");
}
if you cannot write a simple check like this, then you have bigger problems than root detection.
 

JohnnyCappucino

Platinian
Aug 26, 2023
20
5
3
24
Sweden
Could you send me the code for the si.ple root checks? Idk how to do it
Simple exemplification:
Java:
     if (isDeviceRooted()) {
            Toast.makeText(this, "This device is rooted. App cannot run on rooted devices.", Toast.LENGTH_SHORT).show();
            finish();
        } else {
 // implement your logic
        }


    }

    private boolean isDeviceRooted() {

        String[] rootIndicators = {
                "/system/app/Superuser.apk",
                "/sbin/su",
                "/system/bin/su",
                "/system/xbin/su",
                "/data/local/xbin/su",
                "/data/local/bin/su",
                "/system/sd/xbin/su",
                "/system/bin/failsafe/su",
                "/data/local/su"
        };

        for (String indicator : rootIndicators) {
            if (new File(indicator).exists()) {
                return true;
            }
        }

        return false;
 
  • Like
Reactions: Geno Modz

Geno Modz

Platinian
Original poster
Aug 16, 2023
11
2
3
23
your moms house
write it in any language you want...

C:
string pathFile = "/system/bin/su";
if(pathFile.Exist()){
    print("Root detected");
}
if you cannot write a simple check like this, then you have bigger problems than root detection.
Which library do i import for this
 

Kaorin333

Solid & Active Platinian
Jun 11, 2022
89
9
8
34
Germany
Which library do i import for this
i did not even write in one language i just used i guess 3 languages in this 2 liners lol.

for this kind of stuff you do not need any libs it is 100% possible to write it just with the language itself

for Android App use JAVA
for Android Native use CPP

just write in any language you are using, a simple check IF the file "su" exist

@JohnnyCappucino just wrote you a list here of all possible things


Java:
        String[] rootIndicators = {
                "/system/app/Superuser.apk",
                "/sbin/su",
                "/system/bin/su",
                "/system/xbin/su",
                "/data/local/xbin/su",
                "/data/local/bin/su",
                "/system/sd/xbin/su",
                "/system/bin/failsafe/su",
                "/data/local/su"
        };
like i said if you cannot do it then this is your smallest problem, first of all learn the language you are using.