Skip to content
This repository was archived by the owner on May 13, 2023. It is now read-only.

Commit bb10e2f

Browse files
committed
Fix broken hook method check
1 parent aa0abc0 commit bb10e2f

File tree

1 file changed

+12
-3
lines changed
  • app/src/main/java/com/virb3/trustmealready

1 file changed

+12
-3
lines changed

app/src/main/java/com/virb3/trustmealready/Main.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717

1818
public class Main implements IXposedHookZygoteInit {
1919

20-
private final String SSL_CLASS_NAME = "com.android.org.conscrypt.TrustManagerImpl";
21-
private final String SSL_METHOD_NAME = "checkTrustedRecursive";
20+
private static final String SSL_CLASS_NAME = "com.android.org.conscrypt.TrustManagerImpl";
21+
private static final String SSL_METHOD_NAME = "checkTrustedRecursive";
22+
private static final Class<?> SSL_RETURN_TYPE = List.class;
23+
private static final Class<?> SSL_RETURN_PARAM_TYPE = X509Certificate.class;
2224

2325
@Override
2426
public void initZygote(StartupParam startupParam) throws Throwable {
@@ -53,13 +55,20 @@ private boolean checkSSLMethod(Method method) {
5355
return false;
5456
}
5557

58+
// check return type
59+
if (!SSL_RETURN_TYPE.isAssignableFrom(method.getReturnType())) {
60+
return false;
61+
}
62+
63+
// check if parameterized return type
5664
Type returnType = method.getGenericReturnType();
5765
if (!(returnType instanceof ParameterizedType)) {
5866
return false;
5967
}
6068

69+
// check parameter type
6170
Type[] args = ((ParameterizedType) returnType).getActualTypeArguments();
62-
if (args.length != 1 || args[0] instanceof X509Certificate) {
71+
if (args.length != 1 || !(args[0].equals(SSL_RETURN_PARAM_TYPE))) {
6372
return false;
6473
}
6574

0 commit comments

Comments
 (0)