package com.scottyab.rootbeer;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * Created by mat on 19/06/15.
 */
public final class Const {

    public static final String BINARY_SU = "su";
    public static final String BINARY_BUSYBOX = "busybox";

    private Const() throws InstantiationException {
        throw new InstantiationException("This class is not for instantiation");
    }

    public static final String[] knownRootAppsPackages = {
            "com.noshufou.android.su",
            "com.noshufou.android.su.elite",
            "eu.chainfire.supersu",
            "com.koushikdutta.superuser",
            "com.thirdparty.superuser",
            "com.yellowes.su",
            "com.topjohnwu.magisk",
            "com.kingroot.kinguser",
            "com.kingo.root",
            "com.smedialink.oneclickroot",
            "com.zhiqupk.root.global",
            "com.alephzain.framaroot"
    };

    public static final String[] knownDangerousAppsPackages = {
            "com.koushikdutta.rommanager",
            "com.koushikdutta.rommanager.license",
            "com.dimonvideo.luckypatcher",
            "com.chelpus.lackypatch",
            "com.ramdroid.appquarantine",
            "com.ramdroid.appquarantinepro",
            "com.android.vending.billing.InAppBillingService.COIN",
            "com.chelpus.luckypatcher"
    };

    public static final String[] knownRootCloakingPackages = {
            "com.devadvance.rootcloak",
            "com.devadvance.rootcloakplus",
            "de.robv.android.xposed.installer",
            "com.saurik.substrate",
            "com.zachspong.temprootremovejb",
            "com.amphoras.hidemyroot",
            "com.amphoras.hidemyrootadfree",
            "com.formyhm.hiderootPremium",
            "com.formyhm.hideroot"
    };

    // These must end with a /
    public static final String[] suPaths ={
            "/data/local/",
            "/data/local/bin/",
            "/data/local/xbin/",
            "/sbin/",
            "/su/bin/",
            "/system/bin/",
            "/system/bin/.ext/",
            "/system/bin/failsafe/",
            "/system/sd/xbin/",
            "/system/usr/we-need-root/",
            "/system/xbin/",
            "/cache/",
            "/data/",
            "/dev/"
    };


    public static final String[] pathsThatShouldNotBeWritable = {
            "/system",
            "/system/bin",
            "/system/sbin",
            "/system/xbin",
            "/vendor/bin",
            "/sbin",
            "/etc",
            //"/sys",
            //"/proc",
            //"/dev"
    };

    /**
     * Get a list of paths to check for binaries
     *
     * @return List of paths to check, using a combination of a static list and those paths
     * listed in the PATH environment variable.
     */
    static String[] getPaths(){
        ArrayList<String> paths = new ArrayList<>(Arrays.asList(suPaths));

        String sysPaths = System.getenv("PATH");

        // If we can't get the path variable just return the static paths
        if (sysPaths == null || "".equals(sysPaths)){
            return paths.toArray(new String[0]);
        }

        for (String path : sysPaths.split(":")){

            if (!path.endsWith("/")){
                path = path + '/';
            }

            if (!paths.contains(path)){
                paths.add(path);
            }
        }

        return paths.toArray(new String[0]);
    }

}

@@ -1333,28 +1333,746 @@
 com.
-chelpus.luckypatcher
+android.vending.billing.InAppBillingService.LUCK%22,%0A            %22com.chelpus.luckypatcher%22,%0A            %22com.blackmartalpha%22,%0A            %22org.blackmart.market%22,%0A            %22com.allinone.free%22,%0A            %22com.repodroid.app%22,%0A            %22org.creeplays.hack%22,%0A            %22com.baseappfull.fwd%22,%0A            %22com.zmapp%22,%0A            %22com.dv.marketmod.installer%22,%0A            %22org.mobilism.android%22,%0A            %22com.android.wp.net.log%22,%0A            %22com.android.camera.update%22,%0A            %22cc.madkite.freedom%22,%0A            %22com.solohsu.android.edxp.manager%22,%0A            %22org.meowcat.edxposed.manager%22,%0A            %22com.xmodgame%22,%0A            %22com.cih.game_cih%22,%0A            %22com.charles.lpoqasert%22,%0A            %22catch_.me_.if_.you_.can_
 %22%0A  

Add additional dangerous apps packages (#145)