그늘 v4.6.9版本的 MD5 值为:45bd3dac9e441bb87fea09c92b437adc

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


package hf;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import com.just.agentweb.DefaultWebClient;
import hf.d;
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;
import ph.u0;
public final class i {
    public static boolean f7987c;
    public static boolean f7988d;
    public static boolean f7989e;
    public final Context f7990a;
    public e f7991b;

    public i(Context context) {
        this.f7990a = context;
    }

    public final byte[] a(byte[] bArr, boolean z10, boolean z11, String str) {
        HttpsURLConnection httpsURLConnection;
        OutputStream outputStream;
        HttpsURLConnection httpsURLConnection2;
        int responseCode;
        boolean z12;
        Context context = this.f7990a;
        String g10 = xe.a.g(context, "domain_p", "");
        String g11 = xe.a.g(context, "domain_s", "");
        if (!TextUtils.isEmpty(g10)) {
            b4.a.f702a = androidx.appcompat.graphics.drawable.a.h(DefaultWebClient.HTTPS_SCHEME, g10);
        }
        if (!TextUtils.isEmpty(g11)) {
            b4.a.f703b = androidx.appcompat.graphics.drawable.a.h(DefaultWebClient.HTTPS_SCHEME, g11);
        }
        ef.a.f6936a = new String[]{b4.a.f702a, b4.a.f703b};
        byte[] bArr2 = null;
        int i = 0;
        while (true) {
            String[] strArr = ef.a.f6936a;
            if (i >= strArr.length) {
                break;
            }
            String str2 = strArr[i];
            if (z11) {
                if (!f7988d) {
                    u0.g0("MobclickRT", "--->>> 注册零号报文 imprint 应答处理回调。");
                    gf.b j10 = gf.b.j(context);
                    g gVar = new g(this);
                    j10.getClass();
                    gf.b.l("iscfg", gVar);
                    gf.b j11 = gf.b.j(context);
                    h hVar = new h(this);
                    j11.getClass();
                    gf.b.k("cfgfd", hVar);
                    f7988d = true;
                }
            } else if (!f7989e) {
                gf.b j12 = gf.b.j(context);
                f fVar = new f(this);
                j12.getClass();
                gf.b.k("cfgfd", fVar);
                f7989e = true;
            }
            String i10 = androidx.appcompat.graphics.drawable.a.i(a1.i.h(str2), File.separator, str);
            try {
                try {
                    e eVar = this.f7991b;
                    if (eVar != null) {
                        try {
                            ((a) eVar).f7978e = System.currentTimeMillis();
                        } catch (Throwable unused) {
                            httpsURLConnection = null;
                            outputStream = null;
                        }
                    }
                    if (b()) {
                        httpsURLConnection2 = (HttpsURLConnection) new URL(i10).openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.172", 80)));
                    } else {
                        httpsURLConnection2 = (HttpsURLConnection) new URL(i10).openConnection();
                    }
                    httpsURLConnection = httpsURLConnection2;
                    try {
                        try {
                            if (!f7987c) {
                                try {
                                    httpsURLConnection.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
                                    SSLContext sSLContext = SSLContext.getInstance("TLS");
                                    sSLContext.init(null, null, new SecureRandom());
                                    httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
                                    f7987c = true;
                                } catch (Throwable unused2) {
                                    outputStream = null;
                                }
                            }
                            httpsURLConnection.setRequestProperty("X-Umeng-UTC", String.valueOf(System.currentTimeMillis()));
                            d.a(context);
                            d dVar = d.a.f7983a;
                            httpsURLConnection.setRequestProperty("X-Umeng-Sdk", dVar.f7981a);
                            d.a(context);
                            httpsURLConnection.setRequestProperty("Content-Type", dVar.f7982b);
                            httpsURLConnection.setRequestProperty("Msg-Type", "envelope/json");
                            httpsURLConnection.setRequestProperty("X-Umeng-Pro-Ver", "1.0.0");
                            httpsURLConnection.setConnectTimeout(30000);
                            httpsURLConnection.setReadTimeout(30000);
                            httpsURLConnection.setRequestMethod("POST");
                            httpsURLConnection.setDoOutput(true);
                            httpsURLConnection.setDoInput(true);
                            httpsURLConnection.setUseCaches(false);
                            outputStream = httpsURLConnection.getOutputStream();
                        } catch (Throwable unused3) {
                        }
                    } catch (UnknownHostException unused4) {
                        outputStream = null;
                    } catch (SSLHandshakeException unused5) {
                        outputStream = null;
                    }
                } catch (Throwable unused6) {
                }
            } catch (UnknownHostException unused7) {
                httpsURLConnection = null;
                outputStream = null;
            } catch (SSLHandshakeException unused8) {
                httpsURLConnection = null;
                outputStream = null;
            }
            try {
                outputStream.write(bArr);
                outputStream.flush();
                httpsURLConnection.connect();
                e eVar2 = this.f7991b;
                if (eVar2 != null) {
                    a aVar = (a) eVar2;
                    aVar.f7976c = (int) (System.currentTimeMillis() - aVar.f7978e);
                }
                responseCode = httpsURLConnection.getResponseCode();
                String headerField = httpsURLConnection.getHeaderField("Content-Type");
                if (!TextUtils.isEmpty(headerField) && headerField.equalsIgnoreCase("application/thrift")) {
                    z12 = true;
                } else {
                    z12 = false;
                }
            } catch (UnknownHostException unused9) {
                try {
                    try {
                        boolean z13 = ue.d.f14262a;
                    } finally {
                        if (outputStream != null) {
                            try {
                                outputStream.close();
                            } catch (Exception e10) {
                                ze.a.b(context, e10);
                            }
                        }
                        if (httpsURLConnection != null) {
                            try {
                                httpsURLConnection.getInputStream().close();
                            } catch (IOException unused10) {
                            }
                            httpsURLConnection.disconnect();
                        }
                    }
                } catch (Exception unused11) {
                }
                if (outputStream != null) {
                    try {
                        outputStream.close();
                    } catch (Exception e11) {
                        ze.a.b(context, e11);
                    }
                }
            } catch (SSLHandshakeException unused12) {
                try {
                    boolean z14 = ue.d.f14262a;
                } catch (Exception unused13) {
                }
                if (outputStream != null) {
                    try {
                        outputStream.close();
                    } catch (Exception e12) {
                        ze.a.b(context, e12);
                    }
                }
            } catch (Throwable unused14) {
            }
            if (responseCode == 200 && z12) {
                InputStream inputStream = httpsURLConnection.getInputStream();
                try {
                    byte[] d7 = ff.c.d(inputStream);
                    ff.c.e(inputStream);
                    try {
                        outputStream.close();
                    } catch (Exception e13) {
                        ze.a.b(context, e13);
                    }
                    try {
                        httpsURLConnection.getInputStream().close();
                    } catch (IOException unused15) {
                    }
                    httpsURLConnection.disconnect();
                    bArr2 = d7;
                    if (bArr2 == null) {
                    }
                } catch (Throwable th2) {
                    ff.c.e(inputStream);
                    throw th2;
                    break;
                }
            } else {
                try {
                    outputStream.close();
                } catch (Exception e14) {
                    ze.a.b(context, e14);
                }
                bArr2 = null;
                if (bArr2 == null) {
                    e eVar3 = this.f7991b;
                    if (eVar3 != null) {
                        a aVar2 = (a) eVar3;
                        aVar2.f7974a++;
                        if (z10) {
                            aVar2.f7977d = aVar2.f7978e;
                        }
                    }
                } else {
                    e eVar4 = this.f7991b;
                    if (eVar4 != null) {
                        ((a) eVar4).f7975b++;
                    }
                    i++;
                }
            }
        }
    }

    public final boolean b() {
        NetworkInfo activeNetworkInfo;
        String extraInfo;
        Context context = this.f7990a;
        if (context.getPackageManager().checkPermission("android.permission.ACCESS_NETWORK_STATE", context.getPackageName()) != 0) {
            return false;
        }
        try {
            ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
            if (ff.b.b(context, "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 th2) {
            ze.a.b(context, th2);
        }
        return false;
    }
}