鳯华 v4.0.0版本的 MD5 值为:e66eea5d0a772ef117f7e252dfbb1dfc
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.tencent.wxop.stat;
import android.content.Context;
import android.content.IntentFilter;
import com.tencent.wxop.stat.common.StatConstants;
import com.tencent.wxop.stat.common.StatLogger;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.regex.Pattern;
import org.apache.http.HttpHost;
import org.json.JSONObject;
public class a {
private static a f11252g;
private com.tencent.wxop.stat.common.e f11257e;
private Context f11259h;
private StatLogger f11260i;
private List<String> f11253a = null;
private volatile int f11254b = 2;
private volatile String f11255c = "";
private volatile HttpHost f11256d = null;
private int f11258f = 0;
private a(Context context) {
this.f11257e = null;
this.f11259h = null;
this.f11260i = null;
this.f11259h = context.getApplicationContext();
this.f11257e = new com.tencent.wxop.stat.common.e();
i.a(context);
this.f11260i = com.tencent.wxop.stat.common.l.b();
l();
i();
g();
}
public static a a(Context context) {
if (f11252g == null) {
synchronized (a.class) {
if (f11252g == null) {
f11252g = new a(context);
}
}
}
return f11252g;
}
private boolean b(String str) {
return Pattern.compile("(2[5][0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})").matcher(str).matches();
}
private void i() {
ArrayList arrayList = new ArrayList(10);
this.f11253a = arrayList;
arrayList.add("117.135.169.101");
this.f11253a.add("140.207.54.125");
this.f11253a.add("180.153.8.53");
this.f11253a.add("120.198.203.175");
this.f11253a.add("14.17.43.18");
this.f11253a.add("163.177.71.186");
this.f11253a.add("111.30.131.31");
this.f11253a.add("123.126.121.167");
this.f11253a.add("123.151.152.111");
this.f11253a.add("113.142.45.79");
this.f11253a.add("123.138.162.90");
this.f11253a.add("103.7.30.94");
}
private String j() {
try {
return !b(StatConstants.MTA_SERVER_HOST) ? InetAddress.getByName(StatConstants.MTA_SERVER_HOST).getHostAddress() : "";
} catch (Exception e9) {
this.f11260i.e((Throwable) e9);
return "";
}
}
private void k() {
String j9 = j();
if (StatConfig.isDebugEnable()) {
StatLogger statLogger = this.f11260i;
statLogger.i("remoteIp ip is " + j9);
}
if (com.tencent.wxop.stat.common.l.c(j9)) {
if (!this.f11253a.contains(j9)) {
String str = this.f11253a.get(this.f11258f);
if (StatConfig.isDebugEnable()) {
StatLogger statLogger2 = this.f11260i;
statLogger2.w(j9 + " not in ip list, change to:" + str);
}
j9 = str;
}
StatConfig.setStatReportUrl("http://" + j9 + ":80/mstat/report");
}
}
private void l() {
this.f11254b = 0;
this.f11256d = null;
this.f11255c = null;
}
public HttpHost a() {
return this.f11256d;
}
public void a(String str) {
String[] split;
if (StatConfig.isDebugEnable()) {
this.f11260i.i("updateIpList " + str);
}
try {
if (com.tencent.wxop.stat.common.l.c(str)) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.length() > 0) {
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String string = jSONObject.getString(keys.next());
if (com.tencent.wxop.stat.common.l.c(string)) {
for (String str2 : string.split(";")) {
if (com.tencent.wxop.stat.common.l.c(str2)) {
String[] split2 = str2.split(":");
if (split2.length > 1) {
String str3 = split2[0];
if (b(str3) && !this.f11253a.contains(str3)) {
if (StatConfig.isDebugEnable()) {
this.f11260i.i("add new ip:" + str3);
}
this.f11253a.add(str3);
}
}
}
}
}
}
}
}
} catch (Exception e9) {
this.f11260i.e((Throwable) e9);
}
this.f11258f = new Random().nextInt(this.f11253a.size());
}
public String b() {
return this.f11255c;
}
public int c() {
return this.f11254b;
}
public void d() {
this.f11258f = (this.f11258f + 1) % this.f11253a.size();
}
public boolean e() {
return this.f11254b == 1;
}
public boolean f() {
return this.f11254b != 0;
}
public void g() {
if (!com.tencent.wxop.stat.common.r.f(this.f11259h)) {
if (StatConfig.isDebugEnable()) {
this.f11260i.i("NETWORK TYPE: network is close.");
}
l();
return;
}
if (StatConfig.f11202g) {
k();
}
this.f11255c = com.tencent.wxop.stat.common.l.j(this.f11259h);
if (StatConfig.isDebugEnable()) {
StatLogger statLogger = this.f11260i;
statLogger.i("NETWORK name:" + this.f11255c);
}
if (com.tencent.wxop.stat.common.l.c(this.f11255c)) {
this.f11254b = "WIFI".equalsIgnoreCase(this.f11255c) ? 1 : 2;
this.f11256d = com.tencent.wxop.stat.common.l.a(this.f11259h);
}
if (StatServiceImpl.a()) {
StatServiceImpl.d(this.f11259h);
}
}
public void h() {
this.f11259h.getApplicationContext().registerReceiver(new b(this), new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
}
}