4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 HttpDnsLoader.java 源代码,内容仅作参考
package com.framework.net;
import android.text.TextUtils;
import com.download.okhttp.kidnaps.OkHttpKidnapHttpsHandler;
import com.framework.config.Config;
import com.framework.config.SysConfigKey;
import com.framework.models.DnsServerModel;
import com.framework.models.DnsType;
import com.framework.utils.FileUtils;
import com.framework.utils.JSONUtils;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONObject;
import timber.log.Timber;
public class HttpDnsLoader {
public static DnsServerModel loadTXDns(String str) {
HttpURLConnection httpURLConnection;
Object obj;
DnsServerModel dnsServerModel;
Object obj2 = null;
InputStream inputStream = null;
obj2 = null;
HttpURLConnection httpURLConnection2 = null;
try {
httpURLConnection = (HttpURLConnection) new URL("https://119.29.29.99/d?dn=" + str + "&token=705259213").openConnection();
} catch (Exception e) {
e = e;
obj = null;
} catch (Throwable th) {
th = th;
httpURLConnection = null;
}
try {
httpURLConnection.setConnectTimeout(((Integer) Config.getValue(SysConfigKey.HTTPDNS_TIMEOUT)).intValue());
httpURLConnection.setRequestMethod("GET");
if (httpURLConnection.getResponseCode() == 200) {
inputStream = httpURLConnection.getInputStream();
String str2 = new String(c(inputStream), "UTF-8");
if (!TextUtils.isEmpty(str2)) {
dnsServerModel = new DnsServerModel(str, str2);
} else {
dnsServerModel = new DnsServerModel(str, "");
}
} else {
dnsServerModel = new DnsServerModel((Throwable) null, httpURLConnection.getResponseCode());
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
FileUtils.closeSilent(inputStream);
} catch (Exception e2) {
e = e2;
obj = null;
httpURLConnection2 = httpURLConnection;
try {
dnsServerModel = new DnsServerModel(e, -1);
Timber.d(e, "loadALDns error", new Object[0]);
if (httpURLConnection2 != null) {
httpURLConnection2.disconnect();
}
FileUtils.closeSilent(obj);
dnsServerModel.setDnsType(DnsType.TXDns);
return dnsServerModel;
} catch (Throwable th2) {
th = th2;
Object obj3 = obj;
httpURLConnection = httpURLConnection2;
obj2 = obj3;
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
FileUtils.closeSilent(obj2);
throw th;
}
} catch (Throwable th3) {
th = th3;
if (httpURLConnection != null) {
}
FileUtils.closeSilent(obj2);
throw th;
}
dnsServerModel.setDnsType(DnsType.TXDns);
return dnsServerModel;
}
public static DnsServerModel loadALDns(String str) {
HttpURLConnection httpURLConnection;
Object obj;
DnsServerModel dnsServerModel;
if (str.endsWith(OkHttpKidnapHttpsHandler.MYSITERES)) {
str = "sj.mysiteres.com";
}
Object obj2 = null;
InputStream inputStream = null;
obj2 = null;
HttpURLConnection httpURLConnection2 = null;
try {
httpURLConnection = (HttpURLConnection) new URL("https://203.107.1.1/123465/d?host=" + str).openConnection();
try {
httpURLConnection.setConnectTimeout(((Integer) Config.getValue(SysConfigKey.HTTPDNS_TIMEOUT)).intValue());
httpURLConnection.setRequestMethod("GET");
if (httpURLConnection.getResponseCode() == 200) {
inputStream = httpURLConnection.getInputStream();
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(new String(c(inputStream), "UTF-8"));
if (parseJSONObjectFromString != null) {
dnsServerModel = new DnsServerModel(str, parseJSONObjectFromString);
} else {
dnsServerModel = new DnsServerModel(str, "");
}
} else {
dnsServerModel = new DnsServerModel((Throwable) null, httpURLConnection.getResponseCode());
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
FileUtils.closeSilent(inputStream);
} catch (Exception e) {
e = e;
obj = null;
httpURLConnection2 = httpURLConnection;
try {
dnsServerModel = new DnsServerModel(e, -1);
Timber.d(e, "loadALDns error", new Object[0]);
if (httpURLConnection2 != null) {
httpURLConnection2.disconnect();
}
FileUtils.closeSilent(obj);
dnsServerModel.setDnsType(DnsType.ALDns);
return dnsServerModel;
} catch (Throwable th) {
th = th;
Object obj3 = obj;
httpURLConnection = httpURLConnection2;
obj2 = obj3;
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
FileUtils.closeSilent(obj2);
throw th;
}
} catch (Throwable th2) {
th = th2;
if (httpURLConnection != null) {
}
FileUtils.closeSilent(obj2);
throw th;
}
} catch (Exception e2) {
e = e2;
obj = null;
} catch (Throwable th3) {
th = th3;
httpURLConnection = null;
}
dnsServerModel.setDnsType(DnsType.ALDns);
return dnsServerModel;
}
private static byte[] c(InputStream inputStream) throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr);
if (read != -1) {
byteArrayOutputStream.write(bArr, 0, read);
} else {
inputStream.close();
return byteArrayOutputStream.toByteArray();
}
}
}
}