APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Cuto
版本号:2.6.10
包名称:com.sspai.cuto.android

MD5 校验值:9a3607a8b6a643c932183399cb0ea25c

反编译源代码说明

KillerApplication.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package bin.mt.signature;

import android.app.Application;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Build;
import android.os.Environment;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Base64;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.lsposed.hiddenapibypass.HiddenApiBypass;

public class KillerApplication extends Application {
    public static final String URL = "https://github.com/L-JINBIN/ApkSignatureKillerEx";

    static {
        killPM("com.sspai.cuto.android", "MIIDTzCCAjegAwIBAgIERMOiMzANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwI4NjESMBAGA1UE\nCBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEOMAwGA1UEChMFU3NwYWkxEjAQBgNVBAsT\nCUN1dG8gVGVhbTAeFw0xNjA4MTIwNTEwMjFaFw00MTA4MDYwNTEwMjFaMFgxCzAJBgNVBAYTAjg2\nMRIwEAYDVQQIEwlHdWFuZ2RvbmcxETAPBgNVBAcTCFNoZW56aGVuMQ4wDAYDVQQKEwVTc3BhaTES\nMBAGA1UECxMJQ3V0byBUZWFtMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAobAlk++P\nxbwGFbcUC+aWyyylydDlCwzV85BEp210G/J2MslgVpguAHo8sgGGAduIzMU2rVN0cl6yOBwMGAk3\ntdXXRxtHgdAGeIwHOjv3ZVpGXeFcGrd8hv4WwQ4RBal3aMB+hD+46hX94iaU8CMDJbqA2+cytvSo\nil12h+BFICw2bAZ1IUisq04ius1KX/zolfPAELguOpTR20DpbJqqvyItSv/D+f9lYNQi9NsjPBxO\nR9jFa1dZ+8e2xfYuOToPfQPEymk7yRIGVGCgoB/gajo/qd7A9wZGhrFRmsveYi8PeEPgP1sPtJjB\nrv8TqP7HKtVrfRZNt1lRAqyhbSGLVQIDAQABoyEwHzAdBgNVHQ4EFgQUaQQWMCqpfTEDazGbr62N\n+OCaeuUwDQYJKoZIhvcNAQELBQADggEBAFlVHjG79s1L0MTr1dRtnGggq+PmbO7aHcJ9l0KNNJIj\nIiMgyiSaEbfvgB+MLzobyvzvPxQIISSSiXVnuYMLGw0SBtm4ScXvpklHi3+eFSmAaAqdnr6bHPWQ\nR2/90qayJGGXcOioK57NSVayCw1Ipsb5EwUQZzV46F2w6gaYcAnlkx8Ev3x2RN7cQVeVywMdOehG\noXpS2oNT6aCmRRZiqSbN+ZVBS2263zhvjp5RCEZI0H01wCLCwBAXuEDmDADlDjWatHTjqLPi0nhS\nGbmSpqz6LiPVBtv/dBHtUF6JptmnkzKLD5NwW85Y0foMaPCepc7EYhXVUqm3WaS4vuMhA7Q=\n");
        killOpen("com.sspai.cuto.android");
    }

    private static Field findField(Class<?> cls, String str) throws NoSuchFieldException {
        try {
            Field declaredField = cls.getDeclaredField(str);
            declaredField.setAccessible(true);
            return declaredField;
        } catch (NoSuchFieldException e8) {
            while (true) {
                cls = cls.getSuperclass();
                if (cls == null || cls.equals(Object.class)) {
                    break;
                }
                try {
                    Field declaredField2 = cls.getDeclaredField(str);
                    declaredField2.setAccessible(true);
                    return declaredField2;
                } catch (NoSuchFieldException unused) {
                }
            }
            throw e8;
        }
    }

    private static String getApkPath(String str) {
        String str2;
        try {
            BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/self/maps"));
            do {
                try {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        bufferedReader.close();
                        return null;
                    }
                    str2 = readLine.split("\\s+")[r1.length - 1];
                } finally {
                }
            } while (!isApkPath(str, str2));
            bufferedReader.close();
            return str2;
        } catch (Exception e8) {
            throw new RuntimeException(e8);
        }
    }

    private static File getDataFile(String str) {
        String name = Environment.getExternalStorageDirectory().getName();
        if (name.matches("\\d+")) {
            File file = new File("/data/user/" + name + "/" + str);
            if (file.canWrite()) {
                return file;
            }
        }
        return new File("/data/data/" + str);
    }

    private static native void hookApkPath(String str, String str2);

    private static boolean isApkPath(String str, String str2) {
        if (str2.startsWith("/") && str2.endsWith(".apk")) {
            String[] split = str2.substring(1).split("/", 6);
            int length = split.length;
            if (length == 4 || length == 5) {
                if (split[0].equals("data") && split[1].equals("app") && split[length - 1].equals("base.apk")) {
                    return split[length - 2].startsWith(str);
                }
                if (split[0].equals("mnt") && split[1].equals("asec") && split[length - 1].equals("pkg.apk")) {
                    return split[length - 2].startsWith(str);
                }
            } else if (length == 3) {
                if (split[0].equals("data") && split[1].equals("app")) {
                    return split[2].startsWith(str);
                }
            } else if (length == 6 && split[0].equals("mnt") && split[1].equals("expand") && split[3].equals("app") && split[5].equals("base.apk")) {
                return split[4].endsWith(str);
            }
        }
        return false;
    }

    private static void killOpen(String str) {
        try {
            System.loadLibrary("SignatureKiller");
            String apkPath = getApkPath(str);
            if (apkPath == null) {
                System.err.println("Get apk path failed");
                return;
            }
            File file = new File(apkPath);
            File file2 = new File(getDataFile(str), "origin.apk");
            try {
                ZipFile zipFile = new ZipFile(file);
                try {
                    ZipEntry entry = zipFile.getEntry("assets/SignatureKiller/origin.apk");
                    if (entry == null) {
                        System.err.println("Entry not found: assets/SignatureKiller/origin.apk");
                        zipFile.close();
                        return;
                    }
                    if (!file2.exists() || file2.length() != entry.getSize()) {
                        InputStream inputStream = zipFile.getInputStream(entry);
                        try {
                            FileOutputStream fileOutputStream = new FileOutputStream(file2);
                            try {
                                byte[] bArr = new byte[102400];
                                while (true) {
                                    int read = inputStream.read(bArr);
                                    if (read == -1) {
                                        break;
                                    } else {
                                        fileOutputStream.write(bArr, 0, read);
                                    }
                                }
                                fileOutputStream.close();
                                if (inputStream != null) {
                                    inputStream.close();
                                }
                            } finally {
                            }
                        } finally {
                        }
                    }
                    zipFile.close();
                    hookApkPath(file.getAbsolutePath(), file2.getAbsolutePath());
                } finally {
                }
            } catch (IOException e8) {
                throw new RuntimeException(e8);
            }
        } catch (Throwable unused) {
            System.err.println("Load SignatureKiller library failed");
        }
    }

    private static void killPM(final String str, String str2) {
        final Signature signature = new Signature(Base64.decode(str2, 0));
        final Parcelable.Creator creator = PackageInfo.CREATOR;
        try {
            findField(PackageInfo.class, "CREATOR").set(null, new Parcelable.Creator<PackageInfo>() {
                @Override
                public PackageInfo createFromParcel(Parcel parcel) {
                    Signature[] apkContentsSigners;
                    PackageInfo packageInfo = (PackageInfo) creator.createFromParcel(parcel);
                    if (packageInfo.packageName.equals(str)) {
                        if (packageInfo.signatures != null && packageInfo.signatures.length > 0) {
                            packageInfo.signatures[0] = signature;
                        }
                        if (Build.VERSION.SDK_INT >= 28 && packageInfo.signingInfo != null && (apkContentsSigners = packageInfo.signingInfo.getApkContentsSigners()) != null && apkContentsSigners.length > 0) {
                            apkContentsSigners[0] = signature;
                        }
                    }
                    return packageInfo;
                }

                @Override
                public PackageInfo[] newArray(int i8) {
                    return (PackageInfo[]) creator.newArray(i8);
                }
            });
            if (Build.VERSION.SDK_INT >= 28) {
                HiddenApiBypass.addHiddenApiExemptions("Landroid/os/Parcel;", "Landroid/content/pm", "Landroid/app");
            }
            try {
                Object obj = findField(PackageManager.class, "sPackageInfoCache").get(null);
                obj.getClass().getMethod("clear", new Class[0]).invoke(obj, new Object[0]);
            } catch (Throwable unused) {
            }
            try {
                ((Map) findField(Parcel.class, "mCreators").get(null)).clear();
            } catch (Throwable unused2) {
            }
            try {
                ((Map) findField(Parcel.class, "sPairedCreators").get(null)).clear();
            } catch (Throwable unused3) {
            }
        } catch (Exception e8) {
            throw new RuntimeException(e8);
        }
    }
}