밤친구 v4.7.3版本的 MD5 值为:a58175795b36d9d722726efa7eb4c52a

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


package ef;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import com.just.agentweb.DefaultWebClient;
import java.io.File;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
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 qh.v0;

public final class b {

    public final Context f9171a;

    public b(Context context) {
        this.f9171a = context;
    }

    public final boolean a(String str, String str2, String str3, byte[] bArr) {
        HttpsURLConnection httpsURLConnection;
        OutputStream outputStream;
        boolean z10 = false;
        if (bArr != null) {
            String g10 = ye.a.g(this.f9171a, "sl_domain_p", "");
            if (!TextUtils.isEmpty(g10)) {
                v0.f15187g = a9.f.g(DefaultWebClient.HTTPS_SCHEME, g10);
            }
            String str4 = v0.f15187g;
            if (!TextUtils.isEmpty(str2)) {
                str4 = str2;
            }
            OutputStream outputStream2 = null;
            try {
                if (b()) {
                    httpsURLConnection = (HttpsURLConnection) new URL(str4 + File.separator + str).openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.172", 80)));
                } else {
                    httpsURLConnection = (HttpsURLConnection) new URL(str4 + File.separator + str).openConnection();
                }
                try {
                    httpsURLConnection.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
                    SSLContext sSLContext = SSLContext.getInstance("TLS");
                    sSLContext.init(null, null, new SecureRandom());
                    httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
                    httpsURLConnection.setRequestProperty("X-Umeng-UTC", String.valueOf(System.currentTimeMillis()));
                    httpsURLConnection.setRequestProperty("Msg-Type", "envelope/json");
                    httpsURLConnection.setRequestProperty("Content-Type", "ut/" + str3);
                    httpsURLConnection.setConnectTimeout(30000);
                    httpsURLConnection.setReadTimeout(30000);
                    httpsURLConnection.setRequestMethod("POST");
                    httpsURLConnection.setDoOutput(true);
                    httpsURLConnection.setDoInput(true);
                    httpsURLConnection.setUseCaches(false);
                    outputStream = httpsURLConnection.getOutputStream();
                } catch (SSLHandshakeException unused) {
                } catch (Throwable unused2) {
                }
            } catch (SSLHandshakeException unused3) {
                httpsURLConnection = null;
            } catch (Throwable unused4) {
                httpsURLConnection = null;
            }
            try {
                outputStream.write(bArr);
                outputStream.flush();
                httpsURLConnection.connect();
                if (httpsURLConnection.getResponseCode() == 200) {
                    cl.d.D0("MobclickRT", "--->>> send stateless message success : " + v0.f15187g + "/" + str);
                    z10 = true;
                }
                try {
                    outputStream.close();
                } catch (Exception unused5) {
                    try {
                        cl.d.w0("MobclickRT", "--->>> stateless: disconnect connection.");
                        httpsURLConnection.disconnect();
                    } catch (Throwable unused6) {
                    }
                    return z10;
                }
            } catch (SSLHandshakeException unused7) {
                outputStream2 = outputStream;
                if (outputStream2 != null) {
                    try {
                        outputStream2.close();
                    } catch (Exception unused8) {
                    }
                }
            } catch (Throwable unused9) {
                outputStream2 = outputStream;
                if (outputStream2 != null) {
                    try {
                        outputStream2.close();
                    } catch (Exception unused10) {
                    }
                }
            }
        } else {
            le.c.m0("walle", "[stateless] sendMessage, envelopeByte == null || path == null ");
            return false;
        }
    }

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