Delete signature verification log
This commit is contained in:
parent
6d80cd62fd
commit
323fb7a501
|
|
@ -26,17 +26,15 @@ import de.robv.android.xposed.XposedHelpers;
|
|||
|
||||
public class InstallerVerifier {
|
||||
|
||||
public static boolean sendBinderToManager(final ClassLoader classLoader, IBinder binder) {
|
||||
Utils.logI("Found LSPosed Manager");
|
||||
public static void sendBinderToManager(final ClassLoader classLoader, IBinder binder) {
|
||||
try {
|
||||
var clazz = XposedHelpers.findClass("org.lsposed.manager.Constants", classLoader);
|
||||
var ret = (boolean) XposedHelpers.callStaticMethod(clazz, "setBinder",
|
||||
var ok = (boolean) XposedHelpers.callStaticMethod(clazz, "setBinder",
|
||||
new Class[]{IBinder.class}, binder);
|
||||
Utils.logI("Send binder to LSPosed Manager: " + ret);
|
||||
return ret;
|
||||
if (ok) return;
|
||||
throw new RuntimeException("setBinder: " + false);
|
||||
} catch (Throwable t) {
|
||||
Utils.logW("Could not send binder to LSPosed Manager", t);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class ConfigFileManager {
|
|||
|
||||
static ParcelFileDescriptor getManagerApk() throws IOException {
|
||||
if (fd != null) return fd.dup();
|
||||
if (!InstallerVerifier.verifyInstallerSignature(managerApkPath.toString())) return null;
|
||||
InstallerVerifier.verifyInstallerSignature(managerApkPath.toString());
|
||||
|
||||
SELinux.setFileContext(managerApkPath.toString(), "u:object_r:system_file:s0");
|
||||
fd = ParcelFileDescriptor.open(managerApkPath.toFile(), ParcelFileDescriptor.MODE_READ_ONLY);
|
||||
|
|
|
|||
|
|
@ -1,29 +1,31 @@
|
|||
package org.lsposed.lspd.util;
|
||||
|
||||
import static org.lsposed.lspd.util.SignInfo.CERTIFICATE;
|
||||
|
||||
import com.android.apksig.ApkVerifier;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.lsposed.lspd.util.SignInfo.CERTIFICATE;
|
||||
|
||||
public class InstallerVerifier {
|
||||
|
||||
public static boolean verifyInstallerSignature(String path) {
|
||||
public static void verifyInstallerSignature(String path) throws IOException {
|
||||
ApkVerifier verifier = new ApkVerifier.Builder(new File(path))
|
||||
.setMinCheckedPlatformVersion(27)
|
||||
.build();
|
||||
try {
|
||||
ApkVerifier.Result result = verifier.verify();
|
||||
if (!result.isVerified()) {
|
||||
return false;
|
||||
throw new IOException("apk signature not verified");
|
||||
}
|
||||
boolean ret = Arrays.equals(result.getSignerCertificates().get(0).getEncoded(), CERTIFICATE);
|
||||
Utils.logI("verifyInstallerSignature: " + ret);
|
||||
return ret;
|
||||
} catch (Throwable t) {
|
||||
Utils.logE("verifyInstallerSignature: ", t);
|
||||
return false;
|
||||
var mainCert = result.getSignerCertificates().get(0);
|
||||
if (!Arrays.equals(mainCert.getEncoded(), CERTIFICATE)) {
|
||||
var dname = mainCert.getSubjectX500Principal().getName();
|
||||
throw new IOException("apk signature mismatch: " + dname);
|
||||
}
|
||||
} catch (Exception t) {
|
||||
throw new IOException(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ public class ParasiticManagerHooker {
|
|||
}
|
||||
if (param.method.getName().equals("scheduleLaunchActivity")) {
|
||||
ActivityInfo aInfo = null;
|
||||
var parameters = ((Method)param.method).getParameterTypes();
|
||||
var parameters = ((Method) param.method).getParameterTypes();
|
||||
for (var i = 0; i < parameters.length; ++i) {
|
||||
if (parameters[i] == ActivityInfo.class) {
|
||||
aInfo = (ActivityInfo) param.args[i];
|
||||
|
|
@ -317,9 +317,8 @@ public class ParasiticManagerHooker {
|
|||
|
||||
|
||||
static public boolean start() {
|
||||
try {
|
||||
List<IBinder> binder = new ArrayList<>(1);
|
||||
var managerParcelFd = serviceClient.requestInjectedManagerBinder(binder);
|
||||
List<IBinder> binder = new ArrayList<>(1);
|
||||
try (var managerParcelFd = serviceClient.requestInjectedManagerBinder(binder)) {
|
||||
if (binder.size() > 0 && binder.get(0) != null && managerParcelFd != null) {
|
||||
managerFd = managerParcelFd.detachFd();
|
||||
var managerService = ILSPManagerService.Stub.asInterface(binder.get(0));
|
||||
|
|
|
|||
Loading…
Reference in New Issue