柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b

以下内容为反编译后的 b.java 源代码,内容仅作参考


package com.mobile.auth.y;

import android.net.Network;
import android.os.Build;
import android.text.TextUtils;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.mobile.auth.z.e;
import com.mobile.auth.z.f;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import net.duohuo.core.fresco.FrescoController;
import org.json.JSONObject;

public class b {

    public class a implements X509TrustManager {
        public a() {
        }

        @Override
        public void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
        }

        @Override
        public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
            try {
                try {
                    for (X509Certificate x509Certificate : x509CertificateArr) {
                        x509Certificate.checkValidity();
                    }
                } catch (Exception unused) {
                    throw new CertificateException("bad certificate");
                }
            } catch (Throwable th) {
                try {
                    ExceptionProcessor.processException(th);
                } catch (Throwable th2) {
                    ExceptionProcessor.processException(th2);
                }
            }
        }

        @Override
        public X509Certificate[] getAcceptedIssuers() {
            try {
                return new X509Certificate[0];
            } catch (Throwable th) {
                try {
                    ExceptionProcessor.processException(th);
                    return null;
                } catch (Throwable th2) {
                    ExceptionProcessor.processException(th2);
                    return null;
                }
            }
        }
    }

    private String a(InputStream inputStream) {
        ByteArrayOutputStream byteArrayOutputStream;
        Throwable th;
        try {
            try {
                byteArrayOutputStream = new ByteArrayOutputStream();
                try {
                    byte[] bArr = new byte[1024];
                    while (true) {
                        int read = inputStream.read(bArr);
                        if (read == -1) {
                            break;
                        }
                        byteArrayOutputStream.write(bArr, 0, read);
                    }
                    String str = new String(byteArrayOutputStream.toByteArray());
                    try {
                        byteArrayOutputStream.close();
                        if (inputStream != null) {
                            inputStream.close();
                        }
                    } catch (Exception unused) {
                    }
                    return str;
                } catch (Exception unused2) {
                    if (byteArrayOutputStream != null) {
                        try {
                            byteArrayOutputStream.close();
                        } catch (Exception unused3) {
                            return null;
                        }
                    }
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    return null;
                } catch (Throwable th2) {
                    th = th2;
                    if (byteArrayOutputStream != null) {
                        try {
                            byteArrayOutputStream.close();
                        } catch (Exception unused4) {
                            throw th;
                        }
                    }
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    throw th;
                }
            } catch (Throwable th3) {
                try {
                    ExceptionProcessor.processException(th3);
                    return null;
                } catch (Throwable th4) {
                    ExceptionProcessor.processException(th4);
                    return null;
                }
            }
        } catch (Exception unused5) {
            byteArrayOutputStream = null;
        } catch (Throwable th5) {
            byteArrayOutputStream = null;
            th = th5;
        }
    }

    public String a(String str, String str2) {
        HttpsURLConnection httpsURLConnection;
        HttpsURLConnection httpsURLConnection2 = null;
        try {
            try {
                SSLContext sSLContext = SSLContext.getInstance("TLS");
                sSLContext.init(null, new TrustManager[]{new a()}, new SecureRandom());
                httpsURLConnection = (HttpsURLConnection) new URL(str).openConnection();
                try {
                    try {
                        httpsURLConnection.setDoInput(true);
                        httpsURLConnection.setDoOutput(true);
                        httpsURLConnection.setUseCaches(false);
                        httpsURLConnection.setInstanceFollowRedirects(true);
                        httpsURLConnection.setReadTimeout(30000);
                        httpsURLConnection.setConnectTimeout(30000);
                        httpsURLConnection.setRequestMethod("POST");
                        httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
                        httpsURLConnection.setHostnameVerifier(new HostnameVerifier() {
                            @Override
                            public boolean verify(String str3, SSLSession sSLSession) {
                                try {
                                    HostnameVerifier defaultHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
                                    if (defaultHostnameVerifier.verify("wostore.cn", sSLSession)) {
                                        return true;
                                    }
                                    return defaultHostnameVerifier.verify("10010.com", sSLSession);
                                } catch (Throwable th) {
                                    try {
                                        ExceptionProcessor.processException(th);
                                        return false;
                                    } catch (Throwable th2) {
                                        ExceptionProcessor.processException(th2);
                                        return false;
                                    }
                                }
                            }
                        });
                        httpsURLConnection.addRequestProperty("Connection", "close");
                        httpsURLConnection.addRequestProperty("Content-Type", "application/json;charset=UTF-8");
                        httpsURLConnection.connect();
                        DataOutputStream dataOutputStream = new DataOutputStream(httpsURLConnection.getOutputStream());
                        if (str2 != null) {
                            dataOutputStream.write(str2.getBytes("UTF-8"));
                        }
                        dataOutputStream.flush();
                        dataOutputStream.close();
                        String a2 = httpsURLConnection.getResponseCode() == 200 ? a(httpsURLConnection.getInputStream()) : "";
                        if (httpsURLConnection != null) {
                            httpsURLConnection.disconnect();
                        }
                        return a2;
                    } catch (Exception e) {
                        e = e;
                        e.printStackTrace();
                        if (httpsURLConnection != null) {
                            httpsURLConnection.disconnect();
                        }
                        return "";
                    }
                } catch (Throwable th) {
                    th = th;
                    httpsURLConnection2 = httpsURLConnection;
                    if (httpsURLConnection2 != null) {
                        httpsURLConnection2.disconnect();
                    }
                    throw th;
                }
            } catch (Throwable th2) {
                try {
                    ExceptionProcessor.processException(th2);
                    return null;
                } catch (Throwable th3) {
                    ExceptionProcessor.processException(th3);
                    return null;
                }
            }
        } catch (Exception e2) {
            e = e2;
            httpsURLConnection = null;
        } catch (Throwable th4) {
            th = th4;
            if (httpsURLConnection2 != null) {
            }
            throw th;
        }
    }

    public String a(String str, HashMap<String, String> hashMap, Network network) {
        try {
            String str2 = "";
            e.a("url:".concat(String.valueOf(str)));
            try {
                str2 = FrescoController.HTTPS_PERFIX + new URL(str).getHost();
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
            f.c(str);
            try {
                SSLContext sSLContext = SSLContext.getInstance("TLS");
                sSLContext.init(null, new TrustManager[]{new a()}, new SecureRandom());
                URL url = new URL(str);
                HttpsURLConnection httpsURLConnection = (HttpsURLConnection) ((network == null || Build.VERSION.SDK_INT < 21) ? url.openConnection() : network.openConnection(url));
                httpsURLConnection.setDoInput(true);
                httpsURLConnection.setDoOutput(false);
                httpsURLConnection.setUseCaches(false);
                httpsURLConnection.setInstanceFollowRedirects(false);
                httpsURLConnection.setReadTimeout(30000);
                httpsURLConnection.setConnectTimeout(30000);
                httpsURLConnection.setRequestMethod("GET");
                httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
                httpsURLConnection.setHostnameVerifier(new HostnameVerifier() {
                    @Override
                    public boolean verify(String str3, SSLSession sSLSession) {
                        try {
                            HostnameVerifier defaultHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
                            if (defaultHostnameVerifier.verify("wostore.cn", sSLSession)) {
                                return true;
                            }
                            return defaultHostnameVerifier.verify("10010.com", sSLSession);
                        } catch (Throwable th) {
                            try {
                                ExceptionProcessor.processException(th);
                                return false;
                            } catch (Throwable th2) {
                                ExceptionProcessor.processException(th2);
                                return false;
                            }
                        }
                    }
                });
                if (hashMap != null) {
                    for (String str3 : hashMap.keySet()) {
                        httpsURLConnection.setRequestProperty(str3, hashMap.get(str3));
                    }
                }
                if (str.startsWith("https://opencloud.wostore.cn/openapi/netauth/precheck/wp?")) {
                    e.a("Keep-Alive");
                    httpsURLConnection.addRequestProperty("Connection", "Keep-Alive");
                } else {
                    httpsURLConnection.addRequestProperty("Connection", "close");
                }
                httpsURLConnection.connect();
                if (httpsURLConnection.getResponseCode() == 200) {
                    String a2 = a(httpsURLConnection.getInputStream());
                    if (!TextUtils.isEmpty(a2)) {
                        return a2;
                    }
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("code", 10012);
                    jSONObject.put("msg", "10012");
                    jSONObject.put("data", str2);
                    return jSONObject.toString();
                }
                if (httpsURLConnection.getResponseCode() != 302) {
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put("code", 10010);
                    jSONObject2.put("msg", "https状态码" + httpsURLConnection.getResponseCode());
                    jSONObject2.put("data", str2);
                    return jSONObject2.toString();
                }
                String headerField = httpsURLConnection.getHeaderField("Location");
                if (!TextUtils.isEmpty(headerField)) {
                    return headerField.startsWith("https") ? a(headerField, null, network) : b(headerField, null, network);
                }
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put("code", 10013);
                jSONObject3.put("msg", "无跳转地址");
                jSONObject3.put("data", str2);
                return jSONObject3.toString();
            } catch (Exception e2) {
                e2.printStackTrace();
                try {
                    JSONObject jSONObject4 = new JSONObject();
                    jSONObject4.put("code", 10011);
                    jSONObject4.put("msg", "https异常" + e2.getMessage());
                    jSONObject4.put("data", str2);
                    return jSONObject4.toString();
                } catch (Exception unused) {
                    return null;
                }
            }
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public String b(String str, HashMap<String, String> hashMap, Network network) {
        String str2;
        HttpURLConnection httpURLConnection;
        HttpURLConnection httpURLConnection2 = null;
        try {
            try {
                str2 = FrescoController.HTTP_PERFIX + new URL(str).getHost();
            } catch (MalformedURLException e) {
                e.printStackTrace();
                str2 = str;
            }
            f.c(str);
            e.a(str);
            try {
                URL url = new URL(str);
                HttpURLConnection httpURLConnection3 = (HttpURLConnection) ((network == null || Build.VERSION.SDK_INT < 21) ? url.openConnection() : network.openConnection(url));
                try {
                    httpURLConnection3.setDoInput(true);
                    httpURLConnection3.setDoOutput(false);
                    httpURLConnection3.setUseCaches(false);
                    httpURLConnection3.setInstanceFollowRedirects(false);
                    httpURLConnection3.setReadTimeout(30000);
                    httpURLConnection3.setConnectTimeout(30000);
                    httpURLConnection3.setRequestMethod("GET");
                    if (hashMap != null) {
                        for (String str3 : hashMap.keySet()) {
                            httpURLConnection3.setRequestProperty(str3, hashMap.get(str3));
                        }
                    }
                    httpURLConnection3.addRequestProperty("Connection", "close");
                    httpURLConnection3.connect();
                    if (httpURLConnection3.getResponseCode() == 200) {
                        String a2 = a(httpURLConnection3.getInputStream());
                        if (!TextUtils.isEmpty(a2)) {
                            if (httpURLConnection3 != null) {
                                httpURLConnection3.disconnect();
                            }
                            return a2;
                        }
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("code", 10012);
                        jSONObject.put("msg", "10012");
                        jSONObject.put("data", str2);
                        String jSONObject2 = jSONObject.toString();
                        if (httpURLConnection3 != null) {
                            httpURLConnection3.disconnect();
                        }
                        return jSONObject2;
                    }
                    if (httpURLConnection3.getResponseCode() != 302) {
                        JSONObject jSONObject3 = new JSONObject();
                        jSONObject3.put("code", 10010);
                        jSONObject3.put("msg", "https状态码" + httpURLConnection3.getResponseCode());
                        jSONObject3.put("data", str2);
                        String jSONObject4 = jSONObject3.toString();
                        if (httpURLConnection3 != null) {
                            httpURLConnection3.disconnect();
                        }
                        return jSONObject4;
                    }
                    String headerField = httpURLConnection3.getHeaderField("Location");
                    if (TextUtils.isEmpty(headerField)) {
                        JSONObject jSONObject5 = new JSONObject();
                        jSONObject5.put("code", 10013);
                        jSONObject5.put("msg", "无跳转地址");
                        jSONObject5.put("data", str2);
                        String jSONObject6 = jSONObject5.toString();
                        if (httpURLConnection3 != null) {
                            httpURLConnection3.disconnect();
                        }
                        return jSONObject6;
                    }
                    if (headerField.startsWith("https")) {
                        String a3 = a(headerField, null, network);
                        if (httpURLConnection3 != null) {
                            httpURLConnection3.disconnect();
                        }
                        return a3;
                    }
                    String b = b(headerField, null, network);
                    if (httpURLConnection3 != null) {
                        httpURLConnection3.disconnect();
                    }
                    return b;
                } catch (Exception e2) {
                    httpURLConnection = httpURLConnection3;
                    e = e2;
                    try {
                        e.printStackTrace();
                        try {
                            JSONObject jSONObject7 = new JSONObject();
                            jSONObject7.put("code", 10024);
                            jSONObject7.put("msg", "http异常" + e.getMessage());
                            jSONObject7.put("data", str2);
                            String jSONObject8 = jSONObject7.toString();
                            if (httpURLConnection != null) {
                                httpURLConnection.disconnect();
                            }
                            return jSONObject8;
                        } catch (Exception unused) {
                            if (httpURLConnection != null) {
                                httpURLConnection.disconnect();
                            }
                            return null;
                        }
                    } catch (Throwable th) {
                        th = th;
                        httpURLConnection2 = httpURLConnection;
                        if (httpURLConnection2 != null) {
                            httpURLConnection2.disconnect();
                        }
                        throw th;
                    }
                } catch (Throwable th2) {
                    httpURLConnection2 = httpURLConnection3;
                    th = th2;
                    if (httpURLConnection2 != null) {
                    }
                    throw th;
                }
            } catch (Exception e3) {
                e = e3;
                httpURLConnection = null;
            } catch (Throwable th3) {
                th = th3;
            }
        } catch (Throwable th4) {
            try {
                ExceptionProcessor.processException(th4);
                return null;
            } catch (Throwable th5) {
                ExceptionProcessor.processException(th5);
                return null;
            }
        }
    }
}