Peach VPN v4.0版本的 MD5 值为:44c7a87caba90fec9b7945dd44651111
以下内容为反编译后的 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 com.peacholo.peach.BuildConfig;
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(BuildConfig.APPLICATION_ID, "MIIFiTCCA3GgAwIBAgIVAJ9/wQZuE7tvluTIgM3EZSHQ3ZE9MA0GCSqGSIb3DQEBCwUAMHQxCzAJ\nBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQw\nEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAg\nFw0yNDAzMDQxNTA4MzVaGA8yMDU0MDMwNDE1MDgzNVowdDELMAkGA1UEBhMCVVMxEzARBgNVBAgT\nCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC0dvb2dsZSBJbmMu\nMRAwDgYDVQQLEwdBbmRyb2lkMRAwDgYDVQQDEwdBbmRyb2lkMIICIjANBgkqhkiG9w0BAQEFAAOC\nAg8AMIICCgKCAgEAjYNRX5S8DsOPdJO8LOJFq6iUJDj0/aKOYx1KkiOJAPGOqBXZQqSxYnv125QV\nG19j98ErOI9+KTg5A5WxoukIJEW5j3i5LTa51VNE49Jkpo0r/octNOb4cLLZo+0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Q/THuzqVsQR4bsgYcqEwnk3UD5nolp6asPOnKsiVnOW++RR7a/JBExSTp\nu7quNwvcWD+U6I2MqIg4xoUuX7NpWxy7qT6C4QrBkYJpVYXMLNJhMZsBDK1ealX77g3XYW4Hchfa\nKhC7WkwLU4k4e51Ye4xCmpPSdraHYrBjdpre5xFFj0L0K4lYYrAOaKCfaJrGJa9TARuOe1OK0sPY\nCvCRADyp3clGus8VOVmphggPL0OtK8toIefDvQJNnxN81sXrcypjUdWI/TM5V5fgxUMuFR8=\n");
killOpen(BuildConfig.APPLICATION_ID);
}
private static Field findField(Class<?> cls, String str) throws NoSuchFieldException {
try {
Field declaredField = cls.getDeclaredField(str);
declaredField.setAccessible(true);
return declaredField;
} catch (NoSuchFieldException e) {
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 e;
}
}
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 e) {
throw new RuntimeException(e);
}
}
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 e) {
throw new RuntimeException(e);
}
} 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 i) {
return (PackageInfo[]) creator.newArray(i);
}
});
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 e) {
throw new RuntimeException(e);
}
}
}