Add other function to bypass

These function aren't currently hooked by JustTrustMe, but they are used in some applications.
This commit is contained in:
MagicWizz
2020-10-08 01:29:42 +02:00
committed by GitHub
parent dc1c1a4ffe
commit f0aaebff62

View File

@@ -2,6 +2,7 @@ package just.trust.me;
import android.content.Context;
import android.net.http.SslError;
import android.net.http.X509TrustManagerExtensions;
import android.util.Log;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
@@ -34,6 +35,7 @@ import java.util.List;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
@@ -102,6 +104,20 @@ public class Main implements IXposedHookLoadPackage {
}
});
findAndHookMethod(X509TrustManagerExtensions.class, "checkServerTrusted", X509Certificate[].class, String.class, String.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
return param.args[0];
}
});
findAndHookMethod("android.security.net.config.NetworkSecurityTrustManager", lpparam.classLoader, "checkPins", List.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
return null;
}
});
/* external/apache-http/src/org/apache/http/conn/ssl/SSLSocketFactory.java */
/* public SSLSocketFactory( ... ) */
Log.d(TAG, "Hooking SSLSocketFactory(String, KeyStore, String, KeyStore) for: " + currentPackageName);
@@ -303,6 +319,23 @@ public class Main implements IXposedHookLoadPackage {
return list;
}
});
findAndHookMethod("com.android.org.conscrypt.TrustManagerImpl", lpparam.classLoader, "checkTrusted", X509Certificate[].class, String.class, SSLSession.class, SSLParameters.class, boolean.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
return list;
}
});
findAndHookMethod("com.android.org.conscrypt.TrustManagerImpl", lpparam.classLoader, "checkTrusted", X509Certificate[].class, byte[].class, byte[].class, String.class, String.class, boolean.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
return list;
}
});
}
} // End Hooks
@@ -556,10 +589,10 @@ public class Main implements IXposedHookLoadPackage {
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public List<X509Certificate> checkServerTrusted(X509Certificate[] chain, String authType, String host) throws CertificateException {
ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
return list;
}
public List<X509Certificate> checkServerTrusted(X509Certificate[] chain, String authType, String host) throws CertificateException {
ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
return list;
}
@Override
public X509Certificate[] getAcceptedIssuers() {