Auto clicker v2.8.5版本的 MD5 值为:23db090d65f60ed8999bca7ef16207e2

以下内容为反编译后的 SecurityCheckUtil.java 源代码,内容仅作参考


package com.lahm.library;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Debug;
import android.os.Process;
import com.baidu.android.common.util.HanziToPinyin;
import com.baidu.mobstat.PropertyType;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.HashSet;
import java.util.Iterator;

public class SecurityCheckUtil {
    private static final String XPOSED_BRIDGE = "de.robv.android.xposed.XposedBridge";
    private static final String XPOSED_HELPERS = "de.robv.android.xposed.XposedHelpers";

    private static class SingletonHolder {
        private static final SecurityCheckUtil singleInstance = new SecurityCheckUtil();

        private SingletonHolder() {
        }
    }

    private SecurityCheckUtil() {
    }

    public static final SecurityCheckUtil getSingleInstance() {
        return SingletonHolder.singleInstance;
    }

    private int getroDebugProp() {
        String property = CommandUtil.getSingleInstance().getProperty("ro.debuggable");
        return (property != null && PropertyType.UID_PROPERTRY.equals(property)) ? 0 : 1;
    }

    private int getroSecureProp() {
        String property = CommandUtil.getSingleInstance().getProperty("ro.secure");
        return (property != null && PropertyType.UID_PROPERTRY.equals(property)) ? 0 : 1;
    }

    private boolean isSUExist() {
        String[] strArr = {"/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 (int i = 0; i < 8; i++) {
            if (new File(strArr[i]).exists()) {
                return true;
            }
        }
        return false;
    }

    public boolean checkIsDebugVersion(Context context) {
        return (context.getApplicationInfo().flags & 2) != 0;
    }

    public boolean checkIsDebuggerConnected() {
        return Debug.isDebuggerConnected();
    }

    public boolean checkIsUsbCharging(Context context) {
        Intent registerReceiver = context.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
        return registerReceiver != null && registerReceiver.getIntExtra("plugged", -1) == 2;
    }

    public String getApplicationMetaValue(Context context, String str) {
        return context.getApplicationInfo().metaData.getString(str);
    }

    public String getSignature(Context context) {
        try {
            Signature[] signatureArr = context.getPackageManager().getPackageInfo(context.getPackageName(), 64).signatures;
            StringBuilder sb = new StringBuilder();
            for (Signature signature : signatureArr) {
                sb.append(signature.toCharsString());
            }
            return sb.toString();
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            return "";
        }
    }

    public boolean hasReadProcMaps(String str) {
        try {
            HashSet hashSet = new HashSet();
            BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/" + Process.myPid() + "/maps"));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                if (readLine.endsWith(".so") || readLine.endsWith(".jar")) {
                    hashSet.add(readLine.substring(readLine.lastIndexOf(HanziToPinyin.Token.SEPARATOR) + 1));
                }
            }
            bufferedReader.close();
            Iterator it = hashSet.iterator();
            while (it.hasNext()) {
                if (((String) it.next()).contains(str)) {
                    return true;
                }
            }
            return false;
        } catch (Exception unused) {
            return false;
        }
    }

    public boolean isLocalPortUsing(int i) {
        try {
            return isPortUsing("127.0.0.1", i);
        } catch (Exception unused) {
            return true;
        }
    }

    public boolean isPortUsing(String str, int i) throws UnknownHostException {
        try {
            new Socket(InetAddress.getByName(str), i);
            return true;
        } catch (IOException unused) {
            return false;
        }
    }

    public boolean isRoot() {
        if (getroSecureProp() == 0) {
            return true;
        }
        return isSUExist();
    }

    public boolean isXposedExistByThrow() {
        try {
            throw new Exception("gg");
        } catch (Exception e) {
            for (StackTraceElement stackTraceElement : e.getStackTrace()) {
                if (stackTraceElement.getClassName().contains("de.robv.android.xposed.XposedBridge")) {
                    return true;
                }
            }
            return false;
        }
    }

    @Deprecated
    public boolean isXposedExists() {
        try {
            ClassLoader.getSystemClassLoader().loadClass("de.robv.android.xposed.XposedHelpers").newInstance();
            try {
                ClassLoader.getSystemClassLoader().loadClass("de.robv.android.xposed.XposedBridge").newInstance();
                return true;
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                return false;
            } catch (IllegalAccessException e2) {
                e2.printStackTrace();
                return true;
            } catch (InstantiationException e3) {
                e3.printStackTrace();
                return true;
            }
        } catch (ClassNotFoundException e4) {
            e4.printStackTrace();
            return false;
        } catch (IllegalAccessException e5) {
            e5.printStackTrace();
            return true;
        } catch (InstantiationException e6) {
            e6.printStackTrace();
            return true;
        }
    }

    public boolean readProcStatus() {
        try {
            BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/" + Process.myPid() + "/status"));
            String str = "";
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine.contains("TracerPid")) {
                    str = readLine.substring(readLine.indexOf(":") + 1, readLine.length()).trim();
                    break;
                }
                if (readLine == null) {
                    break;
                }
            }
            bufferedReader.close();
            return !PropertyType.UID_PROPERTRY.equals(str);
        } catch (Exception unused) {
            return false;
        }
    }

    public boolean tryShutdownXposed() {
        try {
            Field declaredField = ClassLoader.getSystemClassLoader().loadClass("de.robv.android.xposed.XposedBridge").getDeclaredField("disableHooks");
            declaredField.setAccessible(true);
            declaredField.set(null, Boolean.TRUE);
            return true;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return false;
        } catch (IllegalAccessException e2) {
            e2.printStackTrace();
            return false;
        } catch (NoSuchFieldException e3) {
            e3.printStackTrace();
            return false;
        }
    }
}