整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3

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


package com.kuaishou.weapon.p0;

import android.content.Context;
import android.os.Build;
import android.os.Process;
import android.text.TextUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import org.json.JSONArray;
public class ac {
    public boolean a() {
        return Process.myUid() / 100000 != 0;
    }

    public String b(Context context) {
        try {
            return context.getFilesDir().getParentFile().getAbsolutePath();
        } catch (Throwable unused) {
            return "";
        }
    }

    public String c(Context context) {
        try {
            Object invoke = Class.forName("android.app.ActivityThread").getMethod("currentActivityThread", new Class[0]).invoke(null, new Object[0]);
            Field declaredField = invoke.getClass().getDeclaredField("mPackages");
            declaredField.setAccessible(true);
            Map map = (Map) declaredField.get(invoke);
            if (map != null && map.size() > 0) {
                for (Object obj : map.keySet()) {
                    if (obj.toString().length() > 1 && !obj.toString().equals(context.getPackageName())) {
                        File file = new File("/data/data" + File.separator + obj.toString());
                        if (file.exists() && file.canWrite()) {
                            return obj.toString();
                        }
                    }
                }
            }
        } catch (Throwable unused) {
        }
        return null;
    }

    public JSONArray d(Context context) {
        BufferedReader bufferedReader;
        try {
            bufferedReader = new BufferedReader(new FileReader("/proc/self/maps"));
            try {
                HashSet hashSet = new HashSet();
                String packageName = context.getPackageName();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine != null) {
                        if (!readLine.contains("@Hw") && !readLine.contains(".apk@classes.dex") && !readLine.contains("WebViewGoogle") && !readLine.contains("FeatureFramework") && !readLine.contains("framework@oppo") && !readLine.contains("framework@mediatek")) {
                            if (hashSet.size() > 15) {
                                break;
                            } else if (!readLine.contains(packageName) && readLine.contains("/data/") && readLine.contains(".so")) {
                                hashSet.add(readLine.substring(readLine.indexOf("/data/"), readLine.indexOf(".so") + 3));
                            } else if (!readLine.contains(packageName) && readLine.contains("/data/") && readLine.contains(".dex")) {
                                hashSet.add(readLine.substring(readLine.indexOf("/data/"), readLine.indexOf(".dex") + 4));
                            }
                        }
                    } else {
                        break;
                    }
                }
                if (hashSet.size() > 0) {
                    JSONArray jSONArray = new JSONArray((Collection) hashSet);
                    try {
                        bufferedReader.close();
                    } catch (IOException unused) {
                    }
                    return jSONArray;
                }
            } catch (Throwable unused2) {
            }
        } catch (Throwable unused3) {
            bufferedReader = null;
        }
        try {
            bufferedReader.close();
        } catch (IOException unused4) {
            return null;
        }
    }

    public int e(Context context) {
        FileOutputStream fileOutputStream;
        try {
            if (Build.VERSION.SDK_INT >= 26) {
                String absolutePath = context.getFilesDir().getParentFile().getAbsolutePath();
                String str = "fk_w_" + System.currentTimeMillis();
                StringBuilder sb = new StringBuilder();
                sb.append(absolutePath);
                String str2 = File.separator;
                sb.append(str2);
                sb.append(str);
                fileOutputStream = new FileOutputStream(sb.toString());
                try {
                    FileDescriptor fd = fileOutputStream.getFD();
                    Field declaredField = fd.getClass().getDeclaredField("descriptor");
                    declaredField.setAccessible(true);
                    declaredField.get(fd);
                    String absolutePath2 = Files.readSymbolicLink(Paths.get(String.format("/proc/self/fd/%d", Integer.valueOf(((Integer) declaredField.get(fd)).intValue())), new String[0])).toFile().getAbsolutePath();
                    if (!absolutePath2.substring(absolutePath2.lastIndexOf(str2)).equals(str2 + str)) {
                        try {
                            fileOutputStream.close();
                        } catch (Exception unused) {
                        }
                        return 1;
                    }
                    boolean canRead = new File(absolutePath2.replace(str, "")).getParentFile().canRead();
                    File file = new File(absolutePath2);
                    if (file.exists()) {
                        file.delete();
                    }
                    if (canRead) {
                        try {
                            fileOutputStream.close();
                        } catch (Exception unused2) {
                        }
                        return 1;
                    }
                    try {
                        fileOutputStream.close();
                    } catch (Exception unused3) {
                    }
                    return 0;
                } catch (Throwable unused4) {
                    if (fileOutputStream != null) {
                        try {
                            fileOutputStream.close();
                        } catch (Exception unused5) {
                        }
                    }
                    return 0;
                }
            }
            return a(context) ? 1 : 0;
        } catch (Throwable unused6) {
            fileOutputStream = null;
        }
    }

    public boolean f(Context context) {
        try {
            int i = context.getApplicationInfo().targetSdkVersion;
            Class<?> cls = Class.forName("android.os.SELinux");
            String str = (String) cls.getDeclaredMethod("getContext", new Class[0]).invoke(cls, new Object[0]);
            String a = a(i, Build.VERSION.SDK_INT);
            if (TextUtils.isEmpty(str)) {
                return false;
            }
            return !str.startsWith(a);
        } catch (Exception unused) {
            return false;
        }
    }

    public boolean a(Context context) {
        try {
            String absolutePath = context.getFilesDir().getParentFile().getAbsolutePath();
            return new File(absolutePath + File.separator + "..").canRead();
        } catch (Throwable unused) {
            return false;
        }
    }

    private String a(int i, int i2) {
        if (i2 < 26) {
            return "u:r:untrusted_app";
        }
        if (i >= i2) {
            return "u:r:untrusted_app:s0";
        } else if (i < 26) {
            return "u:r:untrusted_app_25:s0";
        } else {
            if (i2 == 27) {
                if (i >= 26) {
                    return "u:r:untrusted_app:s0";
                }
            } else if (i2 == 28 || i2 == 29) {
                if (i >= 26) {
                    return "u:r:untrusted_app_27:s0";
                }
            } else if (i2 == 30) {
                if (i >= 29) {
                    return "u:r:untrusted_app_29:s0";
                }
                return "u:r:untrusted_app_27:s0";
            }
            return "u:r:untrusted_app";
        }
    }
}