鳯华 v4.0.0版本的 MD5 值为:e66eea5d0a772ef117f7e252dfbb1dfc

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


package t6;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import c6.g1;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.UnknownHostException;
import java.security.SecureRandom;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLHandshakeException;
import org.apache.http.conn.ssl.SSLSocketFactory;
public class g {
    private static boolean f18992e = false;
    private static boolean f18993f = false;
    private static boolean f18994g = false;
    private String f18995a = "10.0.0.172";
    private int f18996b = 80;
    private Context f18997c;
    private f f18998d;

    public class a implements t6.c {
        a() {
        }

        @Override
        public void onImprintValueChanged(String str, String str2) {
            if (h6.a.f()) {
                h6.a.b().d(g.this.f18997c, str2);
                i6.h.b("MobclickRT", "--->>> apply imprint change and exit: key=" + str + "; value= " + str2);
                j6.f.m(g.this.f18997c, 32788, k6.b.a(g.this.f18997c).b(), null);
            }
        }
    }

    public class b implements d {
        b() {
        }

        @Override
        public boolean b(String str, String str2) {
            i6.h.b("MobclickRT", "--->>> onImprintValueChanged: key=" + str + "; value= " + str2);
            h6.a.b().c(g.this.f18997c);
            j6.f.m(g.this.f18997c, 32784, k6.b.a(g.this.f18997c).b(), null);
            s6.b.u(g.this.f18997c).g("iscfg");
            return true;
        }
    }

    public class c implements t6.c {
        c() {
        }

        @Override
        public void onImprintValueChanged(String str, String str2) {
            i6.h.b("MobclickRT", "--->>> first onImprintValueChanged: key=" + str + "; value= " + str2);
            h6.a.b().d(g.this.f18997c, str2);
            j6.f.m(g.this.f18997c, 32784, k6.b.a(g.this.f18997c).b(), null);
            if (h6.a.e("header_foreground_count")) {
                i6.h.c("MobclickRT", "--->>> recv zcfg response: foregound count timer enabled.");
                if (!j6.f.e()) {
                    j6.f.n(g.this.f18997c, 8213, a6.b.f(g.this.f18997c), null, 0L);
                }
            }
            if (h6.a.e("header_first_resume")) {
                i6.h.c("MobclickRT", "--->>> recv zcfg response: FirstResumeTrigger enabled.");
                g1.b(g.this.f18997c).k(g.this.f18997c);
            }
            s6.b.u(g.this.f18997c).x("cfgfd", this);
        }
    }

    public g(Context context) {
        this.f18997c = context;
    }

    private void b() {
        String h9 = j6.a.h(this.f18997c, "domain_p", "");
        String h10 = j6.a.h(this.f18997c, "domain_s", "");
        if (!TextUtils.isEmpty(h9)) {
            q6.d.f18088b = r6.a.b(h9);
        }
        if (!TextUtils.isEmpty(h10)) {
            q6.d.f18089c = r6.a.b(h10);
        }
        q6.a.f18081c = new String[]{q6.d.f18088b, q6.d.f18089c};
    }

    private void f() {
        String h9 = j6.a.h(this.f18997c, "domain_p", "");
        String h10 = j6.a.h(this.f18997c, "domain_s", "");
        if (!TextUtils.isEmpty(h9)) {
            q6.d.f18088b = r6.a.b(h9);
        }
        if (!TextUtils.isEmpty(h10)) {
            q6.d.f18089c = r6.a.b(h10);
        }
        String h11 = j6.a.h(this.f18997c, "oversea_domain_p", "");
        String h12 = j6.a.h(this.f18997c, "oversea_domain_s", "");
        if (!TextUtils.isEmpty(h11)) {
            q6.d.f18096j = r6.a.b(h11);
        }
        if (!TextUtils.isEmpty(h12)) {
            q6.d.f18097k = r6.a.b(h12);
        }
        q6.a.f18081c = new String[]{q6.d.f18096j, q6.d.f18097k};
        if (TextUtils.isEmpty(q6.f.f18104f)) {
            return;
        }
        if (q6.f.f18104f.startsWith("460") || q6.f.f18104f.startsWith("461")) {
            q6.a.f18081c = new String[]{q6.d.f18088b, q6.d.f18089c};
        }
    }

    private void g() {
        if (f18994g) {
            return;
        }
        s6.b.u(this.f18997c).v("cfgfd", new a());
        f18994g = true;
    }

    private void h() {
        if (f18993f) {
            return;
        }
        i6.h.b("MobclickRT", "--->>> 注册零号报文 imprint 应答处理回调。");
        s6.b.u(this.f18997c).w("iscfg", new b());
        s6.b.u(this.f18997c).v("cfgfd", new c());
        f18993f = true;
    }

    private boolean i() {
        NetworkInfo activeNetworkInfo;
        String extraInfo;
        if (this.f18997c.getPackageManager().checkPermission("android.permission.ACCESS_NETWORK_STATE", this.f18997c.getPackageName()) != 0) {
            return false;
        }
        try {
            ConnectivityManager connectivityManager = (ConnectivityManager) this.f18997c.getSystemService("connectivity");
            if (r6.b.b(this.f18997c, "android.permission.ACCESS_NETWORK_STATE") && connectivityManager != null && (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) != null && activeNetworkInfo.getType() != 1 && (extraInfo = activeNetworkInfo.getExtraInfo()) != null) {
                if (!extraInfo.equals("cmwap") && !extraInfo.equals("3gwap")) {
                    if (extraInfo.equals("uniwap")) {
                    }
                }
                return true;
            }
        } catch (Throwable th) {
            l6.a.b(this.f18997c, th);
        }
        return false;
    }

    public void c(f fVar) {
        this.f18998d = fVar;
    }

    public byte[] d(byte[] bArr, String str) {
        HttpsURLConnection httpsURLConnection;
        OutputStream outputStream;
        OutputStream outputStream2;
        try {
            try {
                f fVar = this.f18998d;
                if (fVar != null) {
                    fVar.b();
                }
                if (i()) {
                    httpsURLConnection = (HttpsURLConnection) new URL(str).openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(this.f18995a, this.f18996b)));
                } else {
                    httpsURLConnection = (HttpsURLConnection) new URL(str).openConnection();
                }
                try {
                    boolean z9 = true;
                    if (!f18992e) {
                        httpsURLConnection.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
                        SSLContext sSLContext = SSLContext.getInstance("TLS");
                        sSLContext.init(null, null, new SecureRandom());
                        httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
                        f18992e = true;
                    }
                    httpsURLConnection.setRequestProperty("X-Umeng-UTC", String.valueOf(System.currentTimeMillis()));
                    httpsURLConnection.setRequestProperty("X-Umeng-Sdk", e.b(this.f18997c).d());
                    httpsURLConnection.setRequestProperty("Content-Type", e.b(this.f18997c).a());
                    httpsURLConnection.setRequestProperty("Msg-Type", "envelope/json");
                    httpsURLConnection.setRequestProperty("X-Umeng-Pro-Ver", "1.0.0");
                    httpsURLConnection.setRequestProperty("SM-IMP", "1");
                    httpsURLConnection.setConnectTimeout(30000);
                    httpsURLConnection.setReadTimeout(30000);
                    httpsURLConnection.setRequestMethod("POST");
                    httpsURLConnection.setDoOutput(true);
                    httpsURLConnection.setDoInput(true);
                    httpsURLConnection.setUseCaches(false);
                    outputStream = httpsURLConnection.getOutputStream();
                    try {
                        outputStream.write(bArr);
                        outputStream.flush();
                        httpsURLConnection.connect();
                        f fVar2 = this.f18998d;
                        if (fVar2 != null) {
                            fVar2.c();
                        }
                        int responseCode = httpsURLConnection.getResponseCode();
                        String headerField = httpsURLConnection.getHeaderField("Content-Type");
                        if (TextUtils.isEmpty(headerField) || !headerField.equalsIgnoreCase("application/thrift")) {
                            z9 = false;
                        }
                        boolean z10 = q6.a.f18082d;
                        if (responseCode == 200 && z9) {
                            InputStream inputStream = httpsURLConnection.getInputStream();
                            try {
                                byte[] d10 = r6.d.d(inputStream);
                                try {
                                    outputStream.close();
                                } catch (Exception e9) {
                                    l6.a.b(this.f18997c, e9);
                                }
                                try {
                                    httpsURLConnection.getInputStream().close();
                                } catch (IOException unused) {
                                }
                                httpsURLConnection.disconnect();
                                return d10;
                            } finally {
                                r6.d.e(inputStream);
                            }
                        }
                        try {
                            outputStream.close();
                        } catch (Exception e10) {
                            l6.a.b(this.f18997c, e10);
                        }
                        try {
                            httpsURLConnection.getInputStream().close();
                        } catch (IOException unused2) {
                        }
                        httpsURLConnection.disconnect();
                        return null;
                    } catch (UnknownHostException unused3) {
                        i6.f.a("A_10200", 2, "\\|");
                        if (outputStream != null) {
                            try {
                                outputStream.close();
                            } catch (Exception e11) {
                                l6.a.b(this.f18997c, e11);
                            }
                        }
                        if (httpsURLConnection != null) {
                            try {
                                httpsURLConnection.getInputStream().close();
                            } catch (IOException unused4) {
                            }
                            httpsURLConnection.disconnect();
                        }
                        return null;
                    } catch (SSLHandshakeException unused5) {
                        i6.f.a("A_10201", 2, "\\|");
                        if (outputStream != null) {
                            try {
                                outputStream.close();
                            } catch (Exception e12) {
                                l6.a.b(this.f18997c, e12);
                            }
                        }
                        if (httpsURLConnection != null) {
                            try {
                                httpsURLConnection.getInputStream().close();
                            } catch (IOException unused6) {
                            }
                            httpsURLConnection.disconnect();
                        }
                        return null;
                    } catch (Throwable unused7) {
                        if (outputStream != null) {
                            try {
                                outputStream.close();
                            } catch (Exception e13) {
                                l6.a.b(this.f18997c, e13);
                            }
                        }
                        if (httpsURLConnection != null) {
                            try {
                                httpsURLConnection.getInputStream().close();
                            } catch (IOException unused8) {
                            }
                            httpsURLConnection.disconnect();
                        }
                        return null;
                    }
                } catch (UnknownHostException unused9) {
                    outputStream = null;
                } catch (SSLHandshakeException unused10) {
                    outputStream = null;
                } catch (Throwable unused11) {
                    outputStream = null;
                }
            } catch (Throwable th) {
                if (outputStream2 != null) {
                    try {
                        outputStream2.close();
                    } catch (Exception e14) {
                        l6.a.b(this.f18997c, e14);
                    }
                }
                if (str != 0) {
                    try {
                        str.getInputStream().close();
                    } catch (IOException unused12) {
                    }
                    str.disconnect();
                }
                throw th;
            }
        } catch (UnknownHostException unused13) {
            httpsURLConnection = null;
            outputStream = null;
        } catch (SSLHandshakeException unused14) {
            httpsURLConnection = null;
            outputStream = null;
        } catch (Throwable unused15) {
            httpsURLConnection = null;
            outputStream = null;
        }
    }

    public byte[] e(byte[] bArr, boolean z9, boolean z10, String str) {
        if (q6.b.f18084a == 0) {
            b();
        } else {
            q6.d.f18088b = q6.d.f18096j;
            q6.d.f18089c = q6.d.f18097k;
            f();
        }
        int i9 = 0;
        byte[] bArr2 = null;
        while (true) {
            String[] strArr = q6.a.f18081c;
            if (i9 >= strArr.length) {
                break;
            }
            String str2 = strArr[i9];
            if (z10) {
                h();
            } else {
                g();
            }
            bArr2 = d(bArr, str2 + File.separator + str);
            if (bArr2 != null) {
                f fVar = this.f18998d;
                if (fVar != null) {
                    fVar.a(z9);
                }
            } else {
                f fVar2 = this.f18998d;
                if (fVar2 != null) {
                    fVar2.d();
                }
                i9++;
            }
        }
        return bArr2;
    }
}