그늘 v4.6.9版本的 MD5 值为:45bd3dac9e441bb87fea09c92b437adc
以下内容为反编译后的 x.java 源代码,内容仅作参考
package ph;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.bumptech.glide.load.Key;
import com.huawei.hms.framework.common.ContainerUtils;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Pattern;
public final class x {
public static final class a extends FilterInputStream {
public boolean f12278a;
public a(InputStream inputStream) {
super(inputStream);
}
@Override
public final int read(byte[] bArr, int i, int i10) {
int read;
if (!this.f12278a && (read = super.read(bArr, i, i10)) != -1) {
return read;
}
this.f12278a = true;
return -1;
}
}
static {
Pattern.compile("([^\\s;]+)(.*)");
Pattern.compile("(.*?charset\\s*=[^a-zA-Z0-9]*)([-a-zA-Z0-9]+)(.*)", 2);
Pattern.compile("(\\<\\?xml\\s+.*?encoding\\s*=[^a-zA-Z0-9]*)([-a-zA-Z0-9]+)(.*)", 2);
}
public static NetworkInfo a(Context context) {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager == null) {
return null;
}
return connectivityManager.getActiveNetworkInfo();
} catch (Exception unused) {
return null;
}
}
public static String b(Context context) {
if (k(context)) {
return "wifi";
}
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager == null) {
return "";
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null) {
return "";
}
return (activeNetworkInfo.getTypeName() + "-" + activeNetworkInfo.getSubtypeName() + "-" + activeNetworkInfo.getExtraInfo()).toLowerCase();
} catch (Exception unused) {
return "";
}
}
public static String c(Context context, URL url) {
a aVar;
try {
aVar = f(context, url);
} catch (Throwable th2) {
th = th2;
aVar = null;
}
try {
StringBuilder sb2 = new StringBuilder(1024);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(aVar, Key.STRING_CHARSET_NAME));
char[] cArr = new char[4096];
while (true) {
int read = bufferedReader.read(cArr);
if (-1 != read) {
sb2.append(cArr, 0, read);
} else {
ke.c.x(aVar);
return sb2.toString();
}
}
} catch (Throwable th3) {
th = th3;
ke.c.x(aVar);
throw th;
}
}
public static HttpURLConnection d(Context context, URL url) {
URLConnection openConnection;
if ("http".equals(url.getProtocol())) {
boolean z10 = false;
if ("CN".equalsIgnoreCase(((TelephonyManager) context.getSystemService("phone")).getSimCountryIso())) {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager != null) {
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo != null) {
String extraInfo = activeNetworkInfo.getExtraInfo();
if (!TextUtils.isEmpty(extraInfo) && extraInfo.length() >= 3 && extraInfo.contains("ctwap")) {
z10 = true;
}
}
}
} catch (Exception unused) {
}
}
if (z10) {
openConnection = url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.200", 80)));
return (HttpURLConnection) openConnection;
}
}
openConnection = url.openConnection();
return (HttpURLConnection) openConnection;
}
public static v e(Context context, String str, TreeMap treeMap) {
?? r82;
v vVar;
HttpURLConnection d7;
int i;
String headerFieldKey;
String headerField;
BufferedReader bufferedReader;
String readLine;
try {
try {
if (treeMap.size() > 0) {
StringBuffer stringBuffer = new StringBuffer();
for (Map.Entry entry : treeMap.entrySet()) {
if (entry.getKey() != null && entry.getValue() != null) {
try {
stringBuffer.append(URLEncoder.encode((String) entry.getKey(), Key.STRING_CHARSET_NAME));
stringBuffer.append(ContainerUtils.KEY_VALUE_DELIMITER);
stringBuffer.append(URLEncoder.encode((String) entry.getValue(), Key.STRING_CHARSET_NAME));
stringBuffer.append(ContainerUtils.FIELD_DELIMITER);
} catch (UnsupportedEncodingException e10) {
kh.b.d("Failed to convert from params map to string: " + e10);
kh.b.d("map: " + treeMap.toString());
}
}
}
if (stringBuffer.length() > 0) {
stringBuffer = stringBuffer.deleteCharAt(stringBuffer.length() - 1);
}
r82 = stringBuffer.toString();
vVar = new v();
d7 = d(context, new URL(str));
d7.setConnectTimeout(10000);
d7.setReadTimeout(15000);
d7.setRequestMethod("POST");
i = 0;
if (!TextUtils.isEmpty(r82)) {
d7.setDoOutput(true);
byte[] bytes = r82.getBytes();
OutputStream outputStream = d7.getOutputStream();
try {
outputStream.write(bytes, 0, bytes.length);
outputStream.flush();
outputStream.close();
} catch (IOException e11) {
e = e11;
throw new IOException("err while request " + str + ":" + e.getClass().getSimpleName());
} catch (Throwable th2) {
th = th2;
throw new IOException(th.getMessage());
}
}
vVar.f12180a = d7.getResponseCode();
kh.b.d("Http POST Response Code: " + vVar.f12180a);
while (true) {
headerFieldKey = d7.getHeaderFieldKey(i);
headerField = d7.getHeaderField(i);
if (headerFieldKey != null && headerField == null) {
try {
break;
} catch (IOException unused) {
bufferedReader = new BufferedReader(new InputStreamReader(new a(d7.getErrorStream())));
}
} else {
vVar.f12181b.put(headerFieldKey, headerField);
i = i + 1 + 1;
}
}
bufferedReader = new BufferedReader(new InputStreamReader(new a(d7.getInputStream())));
StringBuffer stringBuffer2 = new StringBuffer();
String property = System.getProperty("line.separator");
for (readLine = bufferedReader.readLine(); readLine != null; readLine = bufferedReader.readLine()) {
stringBuffer2.append(readLine);
stringBuffer2.append(property);
}
vVar.f12182c = stringBuffer2.toString();
bufferedReader.close();
return vVar;
}
StringBuffer stringBuffer22 = new StringBuffer();
String property2 = System.getProperty("line.separator");
while (readLine != null) {
}
vVar.f12182c = stringBuffer22.toString();
bufferedReader.close();
return vVar;
} catch (IOException e12) {
e = e12;
throw new IOException("err while request " + str + ":" + e.getClass().getSimpleName());
} catch (Throwable th3) {
th = th3;
throw new IOException(th.getMessage());
}
d7 = d(context, new URL(str));
d7.setConnectTimeout(10000);
d7.setReadTimeout(15000);
d7.setRequestMethod("POST");
i = 0;
if (!TextUtils.isEmpty(r82)) {
}
vVar.f12180a = d7.getResponseCode();
kh.b.d("Http POST Response Code: " + vVar.f12180a);
while (true) {
headerFieldKey = d7.getHeaderFieldKey(i);
headerField = d7.getHeaderField(i);
if (headerFieldKey != null) {
}
vVar.f12181b.put(headerFieldKey, headerField);
i = i + 1 + 1;
}
bufferedReader = new BufferedReader(new InputStreamReader(new a(d7.getInputStream())));
} catch (Throwable th4) {
ke.c.x(null);
ke.c.x(r82);
throw th4;
}
r82 = 0;
vVar = new v();
}
public static a f(Context context, URL url) {
String str;
if (context != null) {
String url2 = url.toString();
if (!TextUtils.isEmpty(url2)) {
new String();
str = String.format("%s&key=%s", url2, wf.d.w(String.format("%sbe988a6134bc8254465424e5a70ef037", url2)));
} else {
str = null;
}
URL url3 = new URL(str);
try {
HttpURLConnection.setFollowRedirects(true);
HttpURLConnection d7 = d(context, url3);
d7.setConnectTimeout(10000);
d7.setReadTimeout(15000);
if (!TextUtils.isEmpty(null)) {
d7.setRequestProperty("User-Agent", null);
}
return new a(d7.getInputStream());
} catch (IOException e10) {
throw new IOException("IOException:".concat(e10.getClass().getSimpleName()));
} catch (Throwable th2) {
throw new IOException(th2.getMessage());
}
}
throw new IllegalArgumentException("context");
}
public static void g(String str, HashMap hashMap, File file) {
if (!file.exists()) {
return;
}
String name = file.getName();
BufferedReader bufferedReader = null;
try {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
httpURLConnection.setReadTimeout(15000);
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setUseCaches(false);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("Connection", "Keep-Alive");
httpURLConnection.setRequestProperty("Content-Type", "multipart/form-data;boundary=*****");
for (Map.Entry entry : hashMap.entrySet()) {
httpURLConnection.setRequestProperty((String) entry.getKey(), (String) entry.getValue());
}
httpURLConnection.setFixedLengthStreamingMode(name.length() + 77 + ((int) file.length()) + 4);
DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
dataOutputStream.writeBytes("--*****\r\n");
dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\"" + file.getName() + "\"\r\n");
dataOutputStream.writeBytes("\r\n");
FileInputStream fileInputStream = new FileInputStream(file);
try {
byte[] bArr = new byte[1024];
while (true) {
int read = fileInputStream.read(bArr);
if (read == -1) {
break;
}
dataOutputStream.write(bArr, 0, read);
dataOutputStream.flush();
}
dataOutputStream.writeBytes("\r\n");
dataOutputStream.writeBytes("--");
dataOutputStream.writeBytes("*****");
dataOutputStream.writeBytes("--");
dataOutputStream.writeBytes("\r\n");
dataOutputStream.flush();
StringBuffer stringBuffer = new StringBuffer();
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(new a(httpURLConnection.getInputStream())));
while (true) {
try {
String readLine = bufferedReader2.readLine();
if (readLine != null) {
stringBuffer.append(readLine);
} else {
ke.c.x(fileInputStream);
ke.c.x(bufferedReader2);
return;
}
} catch (IOException e10) {
e = e10;
bufferedReader = bufferedReader2;
throw new IOException("IOException:" + e.getClass().getSimpleName());
} catch (Throwable th2) {
th = th2;
bufferedReader = bufferedReader2;
throw new IOException(th.getMessage());
}
}
} catch (IOException e11) {
e = e11;
} catch (Throwable th3) {
th = th3;
}
} catch (Throwable th4) {
ke.c.x(null);
ke.c.x(hashMap);
throw th4;
}
} catch (IOException e12) {
e = e12;
} catch (Throwable th5) {
th = th5;
}
}
public static boolean h(Context context) {
int i = -1;
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager != null) {
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo != null) {
i = activeNetworkInfo.getType();
}
}
} catch (Exception unused) {
}
if (i >= 0) {
return true;
}
return false;
}
public static boolean i(Context context) {
boolean z10;
Network activeNetwork;
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager != null) {
if (Build.VERSION.SDK_INT >= 23) {
try {
activeNetwork = connectivityManager.getActiveNetwork();
NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(activeNetwork);
if (networkCapabilities != null) {
z10 = networkCapabilities.hasCapability(16);
}
} catch (Exception unused) {
}
} else {
z10 = h(context);
}
if (!z10 && j(context)) {
return true;
}
}
z10 = false;
return !z10 ? false : false;
}
public static boolean j(Context context) {
NetworkInfo networkInfo;
try {
networkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
} catch (Exception unused) {
networkInfo = null;
}
if (networkInfo != null && networkInfo.isConnected()) {
return true;
}
return false;
}
public static boolean k(Context context) {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager == null) {
return false;
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null || 1 != activeNetworkInfo.getType()) {
return false;
}
return true;
} catch (Exception unused) {
return false;
}
}
}