밤친구 v4.7.3版本的 MD5 值为:a58175795b36d9d722726efa7eb4c52a
以下内容为反编译后的 i.java 源代码,内容仅作参考
package p000if;
import a9.f;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import com.just.agentweb.DefaultWebClient;
import gf.c;
import hf.b;
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 p000if.d;
import xf.d;
import ye.a;
public final class i {
public static boolean f10988c = false;
public static boolean f10989d = false;
public static boolean f10990e = false;
public final Context f10991a;
public e f10992b;
public i(Context context) {
this.f10991a = 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.f10991a;
String g10 = a.g(context, "domain_p", "");
String g11 = a.g(context, "domain_s", "");
if (!TextUtils.isEmpty(g10)) {
d.f18018d = f.g(DefaultWebClient.HTTPS_SCHEME, g10);
}
if (!TextUtils.isEmpty(g11)) {
d.f18020e = f.g(DefaultWebClient.HTTPS_SCHEME, g11);
}
ff.a.f9670a = new String[]{d.f18018d, d.f18020e};
byte[] bArr2 = null;
int i = 0;
while (true) {
String[] strArr = ff.a.f9670a;
if (i >= strArr.length) {
break;
}
String str2 = strArr[i];
if (z11) {
if (!f10989d) {
cl.d.w0("MobclickRT", "--->>> 注册零号报文 imprint 应答处理回调。");
b j10 = b.j(context);
g gVar = new g(this);
j10.getClass();
b.l("iscfg", gVar);
b j11 = b.j(context);
h hVar = new h(this);
j11.getClass();
b.k("cfgfd", hVar);
f10989d = true;
}
} else if (!f10990e) {
b j12 = b.j(context);
f fVar = new f(this);
j12.getClass();
b.k("cfgfd", fVar);
f10990e = true;
}
String h10 = f.h(ac.d.j(str2), File.separator, str);
try {
try {
e eVar = this.f10992b;
if (eVar != null) {
try {
((a) eVar).f10979e = System.currentTimeMillis();
} catch (Throwable unused) {
httpsURLConnection = null;
outputStream = null;
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e10) {
af.a.b(context, e10);
}
}
}
}
if (b()) {
httpsURLConnection2 = (HttpsURLConnection) new URL(h10).openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.172", 80)));
} else {
httpsURLConnection2 = (HttpsURLConnection) new URL(h10).openConnection();
}
httpsURLConnection = httpsURLConnection2;
try {
try {
if (!f10988c) {
try {
httpsURLConnection.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, null, new SecureRandom());
httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
f10988c = true;
} catch (Throwable unused2) {
outputStream = null;
if (outputStream != null) {
}
}
}
httpsURLConnection.setRequestProperty("X-Umeng-UTC", String.valueOf(System.currentTimeMillis()));
d.a(context);
d dVar = d.a.f10984a;
httpsURLConnection.setRequestProperty("X-Umeng-Sdk", dVar.f10982a);
d.a(context);
httpsURLConnection.setRequestProperty("Content-Type", dVar.f10983b);
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.f10992b;
if (eVar2 != null) {
a aVar = (a) eVar2;
aVar.f10977c = (int) (System.currentTimeMillis() - aVar.f10979e);
}
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 = ve.d.f17283a;
} finally {
}
} catch (Exception unused10) {
}
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e11) {
af.a.b(context, e11);
}
}
} catch (SSLHandshakeException unused11) {
try {
boolean z14 = ve.d.f17283a;
} catch (Exception unused12) {
}
if (outputStream != null) {
try {
outputStream.close();
} catch (Exception e12) {
af.a.b(context, e12);
}
}
} catch (Throwable unused13) {
if (outputStream != null) {
}
}
if (responseCode == 200 && z12) {
InputStream inputStream = httpsURLConnection.getInputStream();
try {
byte[] d4 = c.d(inputStream);
c.e(inputStream);
try {
outputStream.close();
} catch (Exception e13) {
af.a.b(context, e13);
}
try {
httpsURLConnection.getInputStream().close();
} catch (IOException unused14) {
}
httpsURLConnection.disconnect();
bArr2 = d4;
if (bArr2 == null) {
}
} catch (Throwable th2) {
c.e(inputStream);
throw th2;
break;
}
} else {
try {
outputStream.close();
} catch (Exception e14) {
af.a.b(context, e14);
}
try {
httpsURLConnection.getInputStream().close();
} catch (IOException unused15) {
}
httpsURLConnection.disconnect();
bArr2 = null;
if (bArr2 == null) {
e eVar3 = this.f10992b;
if (eVar3 != null) {
a aVar2 = (a) eVar3;
aVar2.f10975a++;
if (z10) {
aVar2.f10978d = aVar2.f10979e;
}
}
} else {
e eVar4 = this.f10992b;
if (eVar4 != null) {
((a) eVar4).f10976b++;
}
i++;
}
}
}
}
public final boolean b() {
NetworkInfo activeNetworkInfo;
String extraInfo;
Context context = this.f10991a;
if (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;
}
}