PhotoRoom v4.8.2版本的 MD5 值为:c40a01bb3380c0f75c0cb6ac6760f295
以下内容为反编译后的 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.io.PrintStream;
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.photoroom.app", "MIIFiTCCA3GgAwIBAgIVALtOPlo0yHgFkSUupxCKI5QEjlbNMA0GCSqGSIb3DQEBCwUAMHQxCzAJ\nBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQw\nEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAg\nFw0yMDEwMTQxNTAwMjlaGA8yMDUwMTAxNDE1MDAyOVowdDELMAkGA1UEBhMCVVMxEzARBgNVBAgT\nCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC0dvb2dsZSBJbmMu\nMRAwDgYDVQQLEwdBbmRyb2lkMRAwDgYDVQQDEwdBbmRyb2lkMIICIjANBgkqhkiG9w0BAQEFAAOC\nAg8AMIICCgKCAgEAwmhr6U/KbDGIYF5ojq6QvAyfb2TJbX69LRBpYXPUVayQVPxY6wPs04ls5/4u\nVkjLO1VQOJP0tI9pkQyaWGTnxgW+v1mWU3rGLCG2P4AB+1C6aLALw2rEceES3pAvS3lnfXQ7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E2xPGNY\nRcbP8MLKGLhSurwXX3zOCr1wSq3acCUxYg4bQjFYVIe0lBI5hJZvBi7b/p06D8+Tac1aT3njP4ZR\nppsQxPeT03q6F2ss81fr1tDI/bZXKT65R99gSMPbGeu+WgL6njWKk4CXEh03kwTNp2Ha+4xhbIIF\njuISi0jCJ3zLWyWsegrGAmB1y44+aBMvWFa1Fzc/ntxRNjC3lJPD+oiCgAmx9Vs5LMqY2Yg=\n");
killOpen("com.photoroom.app");
}
private static Field findField(Class<?> cls, String str) throws NoSuchFieldException {
try {
Field declaredField = cls.getDeclaredField(str);
declaredField.setAccessible(true);
return declaredField;
} catch (NoSuchFieldException e11) {
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 e11;
}
}
private static String getApkPath(String str) {
String str2;
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/self/maps"));
do {
String readLine = bufferedReader.readLine();
if (readLine == null) {
bufferedReader.close();
return null;
}
String[] split = readLine.split("\\s+");
str2 = split[split.length - 1];
} while (!isApkPath(str, str2));
bufferedReader.close();
return str2;
} catch (Exception e11) {
throw new RuntimeException(e11);
}
}
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);
ZipEntry entry = zipFile.getEntry("assets/SignatureKiller/origin.apk");
if (entry == null) {
PrintStream printStream = System.err;
printStream.println("Entry not found: assets/SignatureKiller/origin.apk");
zipFile.close();
return;
}
if (!file2.exists() || file2.length() != entry.getSize()) {
InputStream inputStream = zipFile.getInputStream(entry);
FileOutputStream fileOutputStream = new FileOutputStream(file2);
try {
byte[] bArr = new byte[102400];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
break;
}
fileOutputStream.write(bArr, 0, read);
}
fileOutputStream.close();
if (inputStream != null) {
inputStream.close();
}
} catch (Throwable th2) {
try {
fileOutputStream.close();
} catch (Throwable th3) {
th2.addSuppressed(th3);
}
throw th2;
}
}
zipFile.close();
hookApkPath(file.getAbsolutePath(), file2.getAbsolutePath());
} catch (IOException e11) {
throw new RuntimeException(e11);
}
} 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 i11) {
return (PackageInfo[]) creator.newArray(i11);
}
});
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 e11) {
throw new RuntimeException(e11);
}
}
}