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 class InstallerVerifier {
|
||||||
|
|
||||||
public static boolean sendBinderToManager(final ClassLoader classLoader, IBinder binder) {
|
public static void sendBinderToManager(final ClassLoader classLoader, IBinder binder) {
|
||||||
Utils.logI("Found LSPosed Manager");
|
|
||||||
try {
|
try {
|
||||||
var clazz = XposedHelpers.findClass("org.lsposed.manager.Constants", classLoader);
|
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);
|
new Class[]{IBinder.class}, binder);
|
||||||
Utils.logI("Send binder to LSPosed Manager: " + ret);
|
if (ok) return;
|
||||||
return ret;
|
throw new RuntimeException("setBinder: " + false);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Utils.logW("Could not send binder to LSPosed Manager", 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 {
|
static ParcelFileDescriptor getManagerApk() throws IOException {
|
||||||
if (fd != null) return fd.dup();
|
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");
|
SELinux.setFileContext(managerApkPath.toString(), "u:object_r:system_file:s0");
|
||||||
fd = ParcelFileDescriptor.open(managerApkPath.toFile(), ParcelFileDescriptor.MODE_READ_ONLY);
|
fd = ParcelFileDescriptor.open(managerApkPath.toFile(), ParcelFileDescriptor.MODE_READ_ONLY);
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,31 @@
|
||||||
package org.lsposed.lspd.util;
|
package org.lsposed.lspd.util;
|
||||||
|
|
||||||
|
import static org.lsposed.lspd.util.SignInfo.CERTIFICATE;
|
||||||
|
|
||||||
import com.android.apksig.ApkVerifier;
|
import com.android.apksig.ApkVerifier;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static org.lsposed.lspd.util.SignInfo.CERTIFICATE;
|
|
||||||
|
|
||||||
public class InstallerVerifier {
|
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))
|
ApkVerifier verifier = new ApkVerifier.Builder(new File(path))
|
||||||
.setMinCheckedPlatformVersion(27)
|
.setMinCheckedPlatformVersion(27)
|
||||||
.build();
|
.build();
|
||||||
try {
|
try {
|
||||||
ApkVerifier.Result result = verifier.verify();
|
ApkVerifier.Result result = verifier.verify();
|
||||||
if (!result.isVerified()) {
|
if (!result.isVerified()) {
|
||||||
return false;
|
throw new IOException("apk signature not verified");
|
||||||
}
|
}
|
||||||
boolean ret = Arrays.equals(result.getSignerCertificates().get(0).getEncoded(), CERTIFICATE);
|
var mainCert = result.getSignerCertificates().get(0);
|
||||||
Utils.logI("verifyInstallerSignature: " + ret);
|
if (!Arrays.equals(mainCert.getEncoded(), CERTIFICATE)) {
|
||||||
return ret;
|
var dname = mainCert.getSubjectX500Principal().getName();
|
||||||
} catch (Throwable t) {
|
throw new IOException("apk signature mismatch: " + dname);
|
||||||
Utils.logE("verifyInstallerSignature: ", t);
|
}
|
||||||
return false;
|
} catch (Exception t) {
|
||||||
|
throw new IOException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,9 +317,8 @@ public class ParasiticManagerHooker {
|
||||||
|
|
||||||
|
|
||||||
static public boolean start() {
|
static public boolean start() {
|
||||||
try {
|
|
||||||
List<IBinder> binder = new ArrayList<>(1);
|
List<IBinder> binder = new ArrayList<>(1);
|
||||||
var managerParcelFd = serviceClient.requestInjectedManagerBinder(binder);
|
try (var managerParcelFd = serviceClient.requestInjectedManagerBinder(binder)) {
|
||||||
if (binder.size() > 0 && binder.get(0) != null && managerParcelFd != null) {
|
if (binder.size() > 0 && binder.get(0) != null && managerParcelFd != null) {
|
||||||
managerFd = managerParcelFd.detachFd();
|
managerFd = managerParcelFd.detachFd();
|
||||||
var managerService = ILSPManagerService.Stub.asInterface(binder.get(0));
|
var managerService = ILSPManagerService.Stub.asInterface(binder.get(0));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue