调研通 v3.0.3版本的 MD5 值为:fe075d21227d488bdb9f6aa09d3b3f35
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.yyt.common.net.netease.LDNetDiagnoService;
import android.content.Context;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.xiaomi.mipush.sdk.Constants;
import com.yyt.common.net.netease.LDNetDiagnoService.LDNetSocket;
import com.yyt.common.net.netease.LDNetDiagnoService.LDNetTraceRoute;
import com.yyt.common.net.netease.LDNetDiagnoService.c;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class b extends LDNetAsyncTaskEx<String, String, String> implements c.a, LDNetTraceRoute.a, LDNetSocket.a {
private static final int M = 1;
private static final int N = 1;
private static final int O = 10;
private static final BlockingQueue<Runnable> P = new LinkedBlockingQueue(2);
private static final ThreadFactory Q = new a();
private static ThreadPoolExecutor R = null;
private boolean A;
private InetAddress[] B;
private LDNetSocket E;
private c F;
private LDNetTraceRoute G;
private com.yyt.common.net.netease.LDNetDiagnoService.a I;
private TelephonyManager L;
private String h;
private String i;
private String j;
private String k;
private String l;
private String m;
private String n;
private String o;
private String p;
private String q;
private boolean r;
private boolean s;
private boolean t;
private Context u;
private String v;
private String w;
private String x;
private String y;
private String z;
private final StringBuilder D = new StringBuilder(256);
private boolean J = false;
private boolean K = true;
private boolean H = false;
private List<String> C = new ArrayList();
class a implements ThreadFactory {
private final AtomicInteger f11173a = new AtomicInteger(1);
a() {
}
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, "Trace #" + this.f11173a.getAndIncrement());
thread.setPriority(1);
return thread;
}
}
public b(Context context, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, Boolean bool, com.yyt.common.net.netease.LDNetDiagnoService.a aVar) {
this.L = null;
this.u = context;
this.h = str;
this.i = str2;
this.j = str3;
this.k = str4;
this.l = str5;
this.m = str6;
this.A = bool.booleanValue();
this.n = str7;
this.o = str8;
this.p = str9;
this.q = str10;
this.I = aVar;
this.L = (TelephonyManager) context.getSystemService("phone");
R = new ThreadPoolExecutor(1, 1, 10L, TimeUnit.SECONDS, P, Q);
}
private String A() {
String str;
Throwable th;
HttpURLConnection httpURLConnection;
HttpURLConnection httpURLConnection2 = null;
r1 = null;
r1 = null;
String str2 = null;
httpURLConnection2 = null;
try {
try {
httpURLConnection = (HttpURLConnection) new URL("").openConnection();
} catch (Throwable th2) {
th = th2;
httpURLConnection = null;
}
} catch (MalformedURLException e2) {
e = e2;
str = null;
} catch (IOException e3) {
e = e3;
str = null;
}
try {
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.connect();
if (httpURLConnection.getResponseCode() == 200) {
str2 = com.yyt.common.l.b.a.a.i(httpURLConnection.getInputStream());
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
return str2;
} catch (MalformedURLException e4) {
e = e4;
String str3 = str2;
httpURLConnection2 = httpURLConnection;
str = str3;
e.printStackTrace();
} catch (IOException e5) {
e = e5;
String str4 = str2;
httpURLConnection2 = httpURLConnection;
str = str4;
e.printStackTrace();
} catch (Throwable th3) {
th = th3;
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
throw th;
}
}
private boolean v(String str) {
Map<String, Object> c2 = com.yyt.common.l.b.a.a.c(str);
String str2 = (String) c2.get("useTime");
this.B = (InetAddress[]) c2.get("remoteInet");
String str3 = Integer.parseInt(str2) > 5000 ? " (" + (Integer.parseInt(str2) / 1000) + "s)" : " (" + str2 + "ms)";
InetAddress[] inetAddressArr = this.B;
String str4 = "";
if (inetAddressArr != null) {
int length = inetAddressArr.length;
for (int i = 0; i < length; i++) {
this.C.add(this.B[i].getHostAddress());
str4 = str4 + this.B[i].getHostAddress() + Constants.ACCEPT_TIME_SEPARATOR_SP;
}
z("DNS解析结果:\t" + str4.substring(0, str4.length() - 1) + str3);
} else {
if (Integer.parseInt(str2) <= 10000) {
z("DNS解析结果:\t解析失败" + str3);
return false;
}
Map<String, Object> c3 = com.yyt.common.l.b.a.a.c(str);
String str5 = (String) c3.get("useTime");
this.B = (InetAddress[]) c3.get("remoteInet");
String str6 = Integer.parseInt(str5) > 5000 ? " (" + (Integer.parseInt(str5) / 1000) + "s)" : " (" + str5 + "ms)";
InetAddress[] inetAddressArr2 = this.B;
if (inetAddressArr2 == null) {
z("DNS解析结果:\t解析失败" + str6);
return false;
}
int length2 = inetAddressArr2.length;
for (int i2 = 0; i2 < length2; i2++) {
this.C.add(this.B[i2].getHostAddress());
str4 = str4 + this.B[i2].getHostAddress() + Constants.ACCEPT_TIME_SEPARATOR_SP;
}
z("DNS解析结果:\t" + str4.substring(0, str4.length() - 1) + str6);
}
return true;
}
private void x() {
z("诊断时间:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
if (!TextUtils.isEmpty(this.h)) {
z("应用code:\t" + this.h);
}
if (!TextUtils.isEmpty(this.i)) {
z("应用名称:\t" + this.i);
}
if (!TextUtils.isEmpty(this.j)) {
z("应用版本:\t" + this.j);
}
z("机器类型:\t" + Build.MANUFACTURER + Constants.COLON_SEPARATOR + Build.BRAND + Constants.COLON_SEPARATOR + Build.MODEL);
StringBuilder sb = new StringBuilder();
sb.append("系统版本:\t");
sb.append(Build.VERSION.RELEASE);
z(sb.toString());
if (!TextUtils.isEmpty(this.l)) {
z("机器ID:\t" + this.l);
}
if (TextUtils.isEmpty(this.n)) {
this.n = com.yyt.common.l.b.a.a.g(this.u);
}
z("运营商:\t" + this.n);
if (this.L != null && TextUtils.isEmpty(this.o)) {
this.o = this.L.getNetworkCountryIso();
}
z("ISOCountryCode:\t" + this.o);
if (this.L != null && TextUtils.isEmpty(this.p)) {
String networkOperator = this.L.getNetworkOperator();
if (!TextUtils.isEmpty(networkOperator)) {
if (networkOperator.length() >= 3) {
this.p = networkOperator.substring(0, 3);
}
if (networkOperator.length() >= 5) {
this.q = networkOperator.substring(3, 5);
}
}
}
z("MobileCountryCode:\t" + this.p);
z("MobileNetworkCode:\t" + this.q);
}
private void y() {
z("\n诊断域名 " + this.m + "...");
if (com.yyt.common.l.b.a.a.j(this.u).booleanValue()) {
this.r = true;
z("当前是否联网:\t已联网");
} else {
this.r = false;
z("当前是否联网:\t未联网");
}
this.v = com.yyt.common.l.b.a.a.h(this.u);
z("当前联网类型:\t" + this.v);
if (this.r) {
if (com.yyt.common.l.b.a.a.f11107e.equals(this.v)) {
this.w = com.yyt.common.l.b.a.a.f(this.u);
this.x = com.yyt.common.l.b.a.a.l(this.u);
} else {
this.w = com.yyt.common.l.b.a.a.e();
}
z("本地IP:\t" + this.w);
} else {
z("本地IP:\t127.0.0.1");
}
if (this.x != null) {
z("本地网关:\t" + this.x);
}
if (this.r) {
String[] d2 = com.yyt.common.l.b.a.a.d(this.u);
if (d2 != null && d2.length > 0) {
this.y = d2[0];
if (d2.length > 1) {
this.z = d2[1];
}
}
z("本地DNS:\t" + this.y + Constants.ACCEPT_TIME_SEPARATOR_SP + this.z);
} else {
z("本地DNS:\t0.0.0.0,0.0.0.0");
}
if (this.r) {
z("远端域名:\t" + this.m);
this.s = v(this.m);
}
}
private void z(String str) {
this.D.append(str + "\n");
r(str + "\n");
}
public void B(boolean z) {
this.J = z;
}
public void C(boolean z) {
this.K = z;
}
public String D() {
if (TextUtils.isEmpty(this.m)) {
return "";
}
this.H = true;
this.D.setLength(0);
z("开始诊断...");
x();
y();
if (this.r) {
z("\n开始TCP连接测试...");
LDNetSocket e2 = LDNetSocket.e();
this.E = e2;
e2.f11157c = this.B;
e2.f11158d = this.C;
e2.f(this);
LDNetSocket lDNetSocket = this.E;
lDNetSocket.g = this.J;
boolean a2 = lDNetSocket.a(this.m);
this.t = a2;
if (!this.A && this.r && this.s && a2) {
z("\n联网&&DNS解析成功&&connect测试成功,无需ping");
} else {
z("\n开始ping...");
this.F = new c(this, 4);
z("ping...127.0.0.1");
this.F.a("127.0.0.1", false);
z("ping本机IP..." + this.w);
this.F.a(this.w, false);
if (com.yyt.common.l.b.a.a.f11107e.equals(this.v)) {
z("ping本地网关..." + this.x);
this.F.a(this.x, false);
}
z("ping本地DNS1..." + this.y);
this.F.a(this.y, false);
if (this.z != null) {
z("ping本地DNS2..." + this.z);
this.F.a(this.z, false);
}
}
if (this.F == null) {
this.F = new c(this, 4);
}
z("\n开始traceroute...");
LDNetTraceRoute c2 = LDNetTraceRoute.c();
this.G = c2;
c2.d(this);
LDNetTraceRoute lDNetTraceRoute = this.G;
lDNetTraceRoute.f11166c = this.K;
lDNetTraceRoute.g(this.m);
return this.D.toString();
}
z("\n\n当前主机未联网,请检查网络!");
return this.D.toString();
}
public void E() {
if (this.H) {
LDNetSocket lDNetSocket = this.E;
if (lDNetSocket != null) {
lDNetSocket.h();
this.E = null;
}
if (this.F != null) {
this.F = null;
}
LDNetTraceRoute lDNetTraceRoute = this.G;
if (lDNetTraceRoute != null) {
lDNetTraceRoute.f();
this.G = null;
}
g(true);
ThreadPoolExecutor threadPoolExecutor = R;
if (threadPoolExecutor != null && !threadPoolExecutor.isShutdown()) {
R.shutdown();
R = null;
}
this.H = false;
}
}
@Override
public void a() {
}
@Override
public void b(String str) {
this.D.append(str);
r(str);
}
@Override
public void c(String str) {
z(str);
}
@Override
public void d(String str) {
this.D.append(str);
r(str);
}
@Override
public void e(String str) {
if (str == null) {
return;
}
LDNetTraceRoute lDNetTraceRoute = this.G;
if (lDNetTraceRoute != null && lDNetTraceRoute.f11166c) {
if (str.contains("ms") || str.contains("***") || str.contains("timeout")) {
str = str + "\n";
}
this.D.append(str);
r(str);
return;
}
z(str);
}
@Override
protected ThreadPoolExecutor l() {
return R;
}
@Override
protected void n() {
E();
}
@Override
public String h(String... strArr) {
if (m()) {
return null;
}
return D();
}
@Override
public void o(String str) {
if (m()) {
return;
}
super.o(str);
z("\n网络诊断结束\n");
E();
com.yyt.common.net.netease.LDNetDiagnoService.a aVar = this.I;
if (aVar != null) {
aVar.a(this.D.toString());
}
}
@Override
public void q(String... strArr) {
if (m()) {
return;
}
super.q(strArr);
com.yyt.common.net.netease.LDNetDiagnoService.a aVar = this.I;
if (aVar != null) {
aVar.b(strArr[0]);
}
}
public void w() {
System.out.print(this.D);
}
}