热汗舞蹈 v1.24.1.0版本的 MD5 值为:f1dc6ef07903515a73f51f41f372123e
以下内容为反编译后的 k.java 源代码,内容仅作参考
package com.qiyukf.nimlib.q;
import android.os.AsyncTask;
import android.text.TextUtils;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.qiyukf.module.zip4j.util.InternalZipConstants;
import com.qiyukf.nimlib.sdk.ServerAddresses;
import com.tencent.bugly.Bugly;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONObject;
public final class k {
private static AtomicBoolean f21044a = new AtomicBoolean(false);
private a f21045b = null;
public static class a extends AsyncTask<Void, Void, Void> {
private a() {
}
private static Void a() {
List<String> d10 = k.d();
if (d10.size() == 0) {
return null;
}
com.qiyukf.nimlib.j.b.b.a.c("NetPing", "***** Net ping start, host list size=" + d10.size() + " *****");
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
for (String str : d10) {
com.qiyukf.nimlib.j.b.b.a.c("NetPing", "ping host ".concat(String.valueOf(str)));
JSONObject f10 = k.f(k.d(str));
if (f10 != null) {
try {
f10.put("ip", str);
jSONArray.put(f10);
} catch (Exception e10) {
e10.printStackTrace();
}
}
com.qiyukf.nimlib.j.b.b.a.c("NetPing", "ping host result=".concat(String.valueOf(f10)));
}
try {
jSONObject.put(HiAnalyticsConstant.BI_KEY_NET_TYPE, k.e());
Object obj = "true";
jSONObject.put("net_available", l.b(com.qiyukf.nimlib.c.d()) ? "true" : Bugly.SDK_IS_DEV);
if (!l.c(com.qiyukf.nimlib.c.d())) {
obj = Bugly.SDK_IS_DEV;
}
jSONObject.put("net_connected", obj);
jSONObject.put("result", jSONArray);
com.qiyukf.nimlib.j.b.b.a.c("NetPing", "***** Net ping end, total result=" + jSONObject.toString() + " ***** ");
} catch (Exception e11) {
e11.printStackTrace();
com.qiyukf.nimlib.j.b.b.a.d("NetPing", "NetPing get network status error", e11);
}
k.f21044a.set(false);
return null;
}
@Override
public final Void doInBackground(Void[] voidArr) {
return a();
}
@Override
public final void onPostExecute(Void r12) {
super.onPostExecute(r12);
}
@Override
public final void onPreExecute() {
super.onPreExecute();
}
public a(byte b10) {
this();
}
}
private k() {
}
public static void c() {
try {
StringBuilder sb2 = new StringBuilder("network info: ");
sb2.append("net_type=" + g() + ", net_available=" + l.b(com.qiyukf.nimlib.c.d()) + ", net_connected=" + l.c(com.qiyukf.nimlib.c.d()));
com.qiyukf.nimlib.j.b.b.a.c("NetPing", sb2.toString());
} catch (Exception e10) {
e10.printStackTrace();
}
}
public static String d(String str) {
StringBuilder sb2 = new StringBuilder();
try {
Process exec = Runtime.getRuntime().exec("ping -c 3 -w 15 ".concat(String.valueOf(str)));
if (exec.waitFor() == 0) {
sb2.append("ping " + str + " success\n");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(exec.getInputStream()));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb2.append(readLine + "\n");
}
} else {
com.qiyukf.nimlib.j.b.b.a.c("NetPing", "unable to ping host, try socket connect...");
boolean e10 = e(str);
StringBuilder sb3 = new StringBuilder("connect ");
sb3.append(e10 ? "success" : "failed");
sb3.append("\n");
sb2.append(sb3.toString());
}
} catch (IOException e11) {
e11.printStackTrace();
} catch (InterruptedException e12) {
e12.printStackTrace();
}
return sb2.toString();
}
public static String e() {
return g();
}
private static String g() {
int j10 = l.j(com.qiyukf.nimlib.c.d());
return j10 == 1 ? "2g" : j10 == 2 ? "3g" : j10 == 3 ? "4g" : j10 == 10 ? "wifi" : "unknown";
}
public static k a() {
return new k();
}
private static boolean e(String str) {
boolean z10;
Socket socket = new Socket();
try {
try {
socket.connect(new InetSocketAddress(str, 80), 15000);
z10 = socket.isConnected();
try {
socket.close();
} catch (IOException e10) {
e10.printStackTrace();
}
} catch (IOException e11) {
e11.printStackTrace();
try {
socket.close();
} catch (IOException e12) {
e12.printStackTrace();
}
z10 = false;
}
StringBuilder sb2 = new StringBuilder("socket connect ");
sb2.append(str);
sb2.append(z10 ? " success" : " failed!!!");
com.qiyukf.nimlib.j.b.b.a.c("NetPing", sb2.toString());
return z10;
} catch (Throwable th) {
try {
socket.close();
} catch (IOException e13) {
e13.printStackTrace();
}
throw th;
}
}
public static JSONObject f(String str) {
int indexOf;
int indexOf2;
JSONObject jSONObject = new JSONObject();
try {
if (str.contains("0% packet loss")) {
int indexOf3 = str.indexOf("/mdev = ");
if (indexOf3 == -1 || (indexOf2 = str.indexOf(" ms\n", indexOf3)) == -1) {
return null;
}
String[] split = str.substring(indexOf3 + 8, indexOf2).split(InternalZipConstants.ZIP_FILE_SEPARATOR);
if (split.length != 4) {
return null;
}
jSONObject.put("min", Double.valueOf(split[0]));
jSONObject.put("avg", Double.valueOf(split[1]));
jSONObject.put("max", Double.valueOf(split[2]));
jSONObject.put("mdev", Double.valueOf(split[3]));
jSONObject.put("loss", 0);
} else if (str.contains("100% packet loss")) {
jSONObject.put("loss", 100);
} else if (str.contains("% packet loss")) {
int indexOf4 = str.indexOf("/mdev = ");
if (indexOf4 == -1 || (indexOf = str.indexOf(" ms\n", indexOf4)) == -1) {
return null;
}
String substring = str.substring(indexOf4 + 8, indexOf);
String[] split2 = substring.split(InternalZipConstants.ZIP_FILE_SEPARATOR);
if (split2.length != 4) {
return null;
}
int indexOf5 = substring.indexOf("% packet loss");
int indexOf6 = substring.indexOf("received");
if (indexOf5 != -1 && indexOf6 != -1) {
String trim = substring.substring(indexOf6 + 10, indexOf5).trim();
jSONObject.put("min", Double.valueOf(split2[0]));
jSONObject.put("avg", Double.valueOf(split2[1]));
jSONObject.put("max", Double.valueOf(split2[2]));
jSONObject.put("mdev", Double.valueOf(split2[3]));
jSONObject.put("loss", Integer.valueOf(trim));
}
return null;
} else if (str.contains("connect") && str.contains("success")) {
jSONObject.put("result", "connect success");
} else if (str.contains("failed")) {
jSONObject.put("result", "failed");
}
} catch (Exception e10) {
e10.printStackTrace();
com.qiyukf.nimlib.j.b.b.a.d("NetPing", "getPingStatus error", e10);
}
return jSONObject;
}
public final void b() {
if (!l.b(com.qiyukf.nimlib.c.d())) {
com.qiyukf.nimlib.j.b.b.a.c("NetPing", "unable to start ping, as network is unavailable");
} else if (f21044a.get()) {
com.qiyukf.nimlib.j.b.b.a.c("NetPing", "cancel start ping, as net ping is running...");
} else if (this.f21045b != null) {
} else {
a aVar = new a((byte) 0);
this.f21045b = aVar;
aVar.execute(new Void[0]);
f21044a.set(true);
}
}
private static String c(String str) {
int lastIndexOf = str.lastIndexOf(58);
return lastIndexOf > 0 ? str.substring(0, lastIndexOf) : str;
}
public static List d() {
ArrayList arrayList = new ArrayList();
com.qiyukf.nimlib.net.a.b.a.a.a();
for (String str : com.qiyukf.nimlib.net.a.b.a.a.b()) {
String c10 = c(str);
if (!arrayList.contains(c10)) {
arrayList.add(c10);
}
}
ServerAddresses i10 = com.qiyukf.nimlib.c.i();
if (i10 == null) {
arrayList.add(c(com.qiyukf.nimlib.e.g.f()));
arrayList.add(c(com.qiyukf.nimlib.e.g.h()));
arrayList.add(c("www.163.com"));
} else {
if (!TextUtils.isEmpty(i10.nosUpload)) {
arrayList.add(c(i10.nosUpload));
}
if (!TextUtils.isEmpty(i10.nosDownload)) {
arrayList.add(c(i10.nosDownload));
}
}
return arrayList;
}
}