安全中心 v4.9.2版本的 MD5 值为:d64c0ec7920c532fa6e6d9bb001cf9bf
以下内容为反编译后的 bcs.java 源代码,内容仅作参考
package tcs;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Calendar;
import java.util.Properties;
import java.util.zip.GZIPOutputStream;
import org.apache.http.auth.AUTH;
import org.apache.http.protocol.HTTP;
import tcs.auv;
public final class bcs {
private static Uri faY = Uri.parse("content://telephony/carriers/preferapn");
private static boolean Zp = false;
private static String a(Context context, InputStream inputStream) {
if (inputStream == null) {
return null;
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
String str = new String(a(context, byteArrayOutputStream.toByteArray()), HTTP.UTF_8);
inputStream.close();
byteArrayOutputStream.close();
return str;
}
byteArrayOutputStream.write(bArr, 0, read);
}
}
public static boolean a(String str) {
boolean z;
HttpURLConnection httpURLConnection;
HttpURLConnection httpURLConnection2 = null;
HttpURLConnection httpURLConnection3 = null;
try {
try {
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
} catch (Throwable th) {
th = th;
}
} catch (Exception e) {
e = e;
}
try {
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setConnectTimeout(30000);
httpURLConnection.setReadTimeout(30000);
httpURLConnection.setUseCaches(false);
int responseCode = httpURLConnection.getResponseCode();
if (200 == responseCode) {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
z = true;
httpURLConnection2 = responseCode;
} else {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
z = false;
httpURLConnection2 = responseCode;
}
} catch (Exception e2) {
httpURLConnection3 = httpURLConnection;
e = e2;
e.printStackTrace();
if (httpURLConnection3 != null) {
httpURLConnection3.disconnect();
}
z = false;
httpURLConnection2 = httpURLConnection3;
return z;
} catch (Throwable th2) {
httpURLConnection2 = httpURLConnection;
th = th2;
if (httpURLConnection2 != null) {
httpURLConnection2.disconnect();
}
throw th;
}
return z;
}
private static byte[] a(Context context, byte[] bArr) {
byte[] bArr2;
Exception e;
if (Zp) {
String str = "@@...getDecryptValue 解密前 = " + bdd.o(bArr);
}
try {
bArr2 = bdd.b(bdd.ir(bct.as(context).db()), bArr);
try {
if (Zp) {
String str2 = "@@...getDecryptValue 解密后 = " + new String(bArr2, HTTP.UTF_8);
}
} catch (Exception e2) {
e = e2;
e.printStackTrace();
return bArr2;
}
} catch (Exception e3) {
bArr2 = null;
e = e3;
}
return bArr2;
}
private static byte[] ab(Context context, String str) {
byte[] bArr;
Exception e;
if (Zp) {
String str2 = "@@...getEncryptValue 加密前 = " + str;
}
try {
bArr = bdd.a(bdd.ir(bct.as(context).ik()), str.getBytes());
} catch (Exception e2) {
bArr = null;
e = e2;
}
try {
if (Zp) {
String str3 = "@@...getEncryptValue 加密后 = " + bdd.o(bArr);
}
} catch (Exception e3) {
e = e3;
e.printStackTrace();
return bArr;
}
return bArr;
}
public static String j(Context context, String str, String str2) {
Exception exc;
HttpURLConnection httpURLConnection;
String str3;
bcr bcrVar;
Cursor query;
String a;
HttpURLConnection httpURLConnection2 = null;
Zp = bct.as(context).b();
try {
try {
com.a.a.a.a d = com.a.a.a.a.d(context);
synchronized (d) {
try {
byte[] ab = ab(context, str2);
if (Zp) {
String str4 = "@@... postUrlRequest 上报数据长度 :" + ab.length;
}
String G = bde.G(context);
int t = t(ab);
int i = Calendar.getInstance().get(2) + 1;
bcr Gk = d.Gk();
try {
if (!"wifi".equalsIgnoreCase(G)) {
if (Gk == null) {
bcr bcrVar2 = new bcr();
bcrVar2.a = i;
d.a(bcrVar2);
bcrVar = bcrVar2;
if (Zp) {
String str5 = "@@...postUrlRequest 上报地址 :" + str;
}
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
httpURLConnection.setConnectTimeout(30000);
httpURLConnection.setReadTimeout(30000);
if (Zp) {
String str6 = "@@...postUrlRequest 网络类型 accessType : " + G;
}
if (!"2G".equals(G) || "3G".equals(G) || "4G".equals(G) || aco.UNKNOWN.equals(G)) {
query = context.getContentResolver().query(faY, null, null, null, null);
if (query != null) {
query.moveToFirst();
if (!TextUtils.isEmpty(query.getString(query.getColumnIndex(auv.c.PROXY)))) {
Properties properties = System.getProperties();
System.getProperties().put("proxySet", "true");
properties.setProperty("http.proxyHost", query.getString(query.getColumnIndex(auv.c.PROXY)));
properties.setProperty("http.proxyPort", query.getString(query.getColumnIndex("port")));
httpURLConnection.setRequestProperty(AUTH.PROXY_AUTH_RESP, " Basic " + bcn.a(String.valueOf(query.getString(query.getColumnIndex(auv.c.USER))) + ":" + query.getString(query.getColumnIndex(auv.c.PASSWORD))));
}
query.close();
}
}
httpURLConnection.setRequestProperty(HTTP.USER_AGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16");
httpURLConnection.setRequestProperty(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestMethod("POST");
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(httpURLConnection.getOutputStream());
gZIPOutputStream.write(ab);
gZIPOutputStream.flush();
gZIPOutputStream.close();
a = a(context, httpURLConnection.getInputStream());
if (!"wifi".equalsIgnoreCase(G)) {
bcrVar.b += t;
if (Zp) {
String str7 = "current month send data size=" + bcrVar.b;
}
d.b(bcrVar);
}
if (Zp) {
String str8 = "@@...postUrlRequest 返回结果 getResponseCode:" + httpURLConnection.getResponseCode();
String str9 = "@@...postUrlRequest 返回结果 result:" + a;
String str10 = "@@...postUrlRequest 返回结果 date size:" + ab.length;
String str11 = "@@...postUrlRequest 返回结果 size after compress :" + t;
}
} else if (Gk.a != i) {
Gk.a = i;
Gk.b = 0L;
} else if (t + Gk.b > bcu.fbf.j) {
if (Zp) {
String str12 = "current month send data size reached max size:" + (t + Gk.b);
}
return null;
}
}
if (!"wifi".equalsIgnoreCase(G)) {
}
if (Zp) {
}
} catch (Throwable th) {
httpURLConnection2 = a;
th = th;
try {
throw th;
} catch (Exception e) {
exc = e;
str3 = httpURLConnection2;
if (Zp) {
String str13 = "Arg exception trying to execute request for url=" + str + ", params=" + str2 + "====" + exc.getMessage();
}
if (httpURLConnection == null) {
return str3;
}
httpURLConnection.disconnect();
return str3;
}
}
bcrVar = Gk;
if (Zp) {
}
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
httpURLConnection.setConnectTimeout(30000);
httpURLConnection.setReadTimeout(30000);
if (Zp) {
}
if (!"2G".equals(G)) {
}
query = context.getContentResolver().query(faY, null, null, null, null);
if (query != null) {
}
httpURLConnection.setRequestProperty(HTTP.USER_AGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16");
httpURLConnection.setRequestProperty(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestMethod("POST");
GZIPOutputStream gZIPOutputStream2 = new GZIPOutputStream(httpURLConnection.getOutputStream());
gZIPOutputStream2.write(ab);
gZIPOutputStream2.flush();
gZIPOutputStream2.close();
a = a(context, httpURLConnection.getInputStream());
} catch (Throwable th2) {
th = th2;
httpURLConnection = null;
}
}
if (httpURLConnection == null) {
return a;
}
httpURLConnection.disconnect();
return a;
} catch (Throwable th3) {
th = th3;
if (0 != 0) {
httpURLConnection2.disconnect();
}
throw th;
}
} catch (Exception e2) {
exc = e2;
httpURLConnection = null;
str3 = 0;
} catch (Throwable th4) {
th = th4;
if (0 != 0) {
}
throw th;
}
}
private static int t(byte[] bArr) {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
gZIPOutputStream.write(bArr);
gZIPOutputStream.flush();
gZIPOutputStream.close();
return byteArrayOutputStream.toByteArray().length;
} catch (Exception e) {
return 0;
}
}
}