和通讯录 v4.2.0版本的 MD5 值为:f213fa766dccbfebde0dd8add5534518
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.cmcc.omp.ad.security;
import android.app.ActivityManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Process;
import android.telephony.TelephonyManager;
import android.text.format.Time;
import android.util.Log;
import com.android.internal.telephony.PhoneConstants;
import com.cmcc.omp.ad.common.OmpNative;
import com.cmcc.sso.sdk.util.SsoSdkConstants;
import com.google.android.mms.pdu.EncodedStringValue;
import com.huawei.mcs.base.constant.Constant;
import com.iflytek.cloud.SpeechConstant;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.Socket;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import java.util.Random;
public final class a {
private static boolean D = false;
private static List E = null;
private static String F = null;
private static ArrayList G = null;
private static String H = null;
private static Context I = null;
private static String j = "CmccOmpAdUtility";
private static String k = "errorCode";
private static String l = "OMSSEXECTIME";
private static String m = "COMUNICATE_TIME";
private static String n = "C_EXECTIME";
private static boolean y;
public static long f4232a = 0;
public static long f4233b = 0;
private static long o = 0;
private static long p = 0;
public static long c = 0;
private static long q = 0;
private static long r = 0;
private static String s = "0";
private static String t = "";
private static String u = "100920031464";
private static boolean v = false;
private static String w = "192.168.230.8";
private static int x = 9028;
private static String z = "10.0.0.172";
private static int A = 80;
private static boolean B = true;
private static boolean C = true;
protected static com.cmcc.omp.ad.b.a d = new com.cmcc.omp.ad.b.a();
protected static String e = "Ad";
protected static String f = "com.cmcc.omp.security";
protected static String g = "com.cmcc.omp.security";
protected static String h = "";
protected static String i = "";
public static int a(Context context) {
if (context == null) {
return 5053;
}
I = context.getApplicationContext();
g = context.getPackageName() + Constant.FilePath.IDND_PATH + e;
f = g + Constant.FilePath.IDND_PATH + c(context);
new StringBuilder("/data/data/").append(g).append(Constant.FilePath.IDND_PATH);
h = ((ContextWrapper) context).getPackageResourcePath();
return 0;
}
public static int a(Context context, String str, String str2) {
Log.i("CmccOmpAdUtility", "url = " + str + " , appid = " + str2);
if (context == null) {
Log.i("CmccOmpAdUtility", "local init failed...5053context is null");
b.f4234a = false;
f.b(false);
return 5053;
}
if (str == null || str.length() == 0 || str2 == null || str2.length() == 0) {
Log.e("CmccOmpAdUtility", "init parameters error...5100appid or url error");
b.f4234a = false;
return 5100;
}
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(PhoneConstants.PHONE_KEY);
String str3 = Build.MODEL;
String str4 = Build.VERSION.RELEASE;
String networkOperator = telephonyManager.getNetworkOperator();
long j2 = -1;
try {
j2 = Long.parseLong(telephonyManager.getDeviceId());
} catch (Exception e2) {
Log.i("CmccOmpAdUtility", "deviceID exception,e=" + e2);
}
Log.i("CmccOmpAdUtility", "devicemodel = " + str3 + " , carrier = " + networkOperator + " , deviceId = " + j2 + " ,release = " + str4 + " ,subscriberID = " + telephonyManager.getSubscriberId());
if (str3.equals("google_sdk") || j2 == 0) {
Log.i("CmccOmpAdUtility", "google_sdk...simulator is running...not apn setting");
B = false;
} else {
B = C;
Log.i("CmccOmpAdUtility", "apn setting wap...IS_SETTING_APN = " + B);
}
f.a(context);
return 0;
}
public static int a(Context context, String str, String str2, String str3, String str4) {
int b2 = b(context);
if (b2 != 0) {
return b2;
}
int c2 = c(str);
if (c2 != 0) {
return c2;
}
int d2 = d(str2);
if (d2 != 0) {
return d2;
}
int b3 = b(str3);
if (b3 != 0) {
return b3;
}
int e2 = e(str4);
if (e2 == 0) {
return 0;
}
return e2;
}
public static int a(String str) {
String a2 = f.a();
Log.i("CmccOmpAdUtility", "storeDeviceid length = " + a2.length());
String a3 = b.a(b.f4235b, str);
Log.i("CmccOmpAdUtility", "curDeviceid length = " + a3.length());
if (!b.a(a2) && a2.equals(a3)) {
return 0;
}
Log.i("CmccOmpAdUtility", "deviceid is error : storeDeviceid=" + a2 + " , curDeviceid=" + a3);
f.c();
return 5002;
}
public static int a(String str, String str2, String str3, String str4, String str5, String str6, String str7) {
return OmpNative.SetRegSeed(str, str2, str3, str4, str5, str6, str7);
}
public static String a() {
Time time = new Time();
time.setToNow();
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(new StringBuilder().append(time.year).toString().substring(2));
int i2 = time.month + 1;
if (i2 < 10) {
stringBuffer.append(s + i2);
} else {
stringBuffer.append(Integer.toString(i2));
}
int i3 = time.monthDay;
if (i3 < 10) {
t = s + i3;
stringBuffer.append(t);
} else {
t = Integer.toString(i3);
stringBuffer.append(t);
}
int i4 = time.hour;
if (i4 < 10) {
stringBuffer.append(s + i4);
} else {
stringBuffer.append(Integer.toString(i4));
}
int i5 = time.minute;
if (i5 < 10) {
stringBuffer.append(s + i5);
} else {
stringBuffer.append(Integer.toString(i5));
}
int i6 = time.second;
if (i6 < 10) {
stringBuffer.append(s + i6);
} else {
stringBuffer.append(Integer.toString(i6));
}
String stringBuffer2 = stringBuffer.toString();
Log.i("CmccOmpAdUtilitytime", " gettimestamp() , timestamp = " + u);
f.b(stringBuffer2);
return stringBuffer2;
}
private static String a(Context context, String str, String str2, String str3, String str4, String str5, String str6) {
return OmpNative.GetEncryptedContFlex(context, str, str2, str3, str4, str5, str6);
}
public static String a(String str, String str2) {
Socket socket;
BufferedWriter bufferedWriter;
BufferedWriter bufferedWriter2;
Socket socket2 = null;
o = System.currentTimeMillis();
Log.v("OMSSEXECTIME", "COMUNICATE_TIME: start time = " + o);
r = o - f4232a;
Log.v("OMSSEXECTIME", "C_EXECTIME: consuming time = " + r);
String str3 = "";
if (str2 != null) {
int length = str2.length();
try {
URL url = new URL(str);
String host = url.getHost();
Log.i("CmccOmpAdUtility", "hostname = " + host);
int port = url.getPort();
if (port < 0) {
port = 80;
}
String path = url.getPath();
Log.i("CmccOmpAdUtility", "port = " + port);
socket = v ? new Socket(w, x) : new Socket(host, port);
try {
socket.setSoTimeout(90000);
Log.e("CmccOmpAdUtility", "default timeout" + socket.getSoTimeout());
bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "utf-8"));
try {
if (v) {
bufferedWriter.write("POST http://" + host + ":" + port + path + " HTTP/1.1\r\n");
} else {
bufferedWriter.write("POST " + path + " HTTP/1.1\r\n");
}
bufferedWriter.write("Content-type: application/x-java-serialized-object\r\n");
bufferedWriter.write("Cache-Control: no-cache\r\n");
bufferedWriter.write("Pragma: no-cache\r\n");
bufferedWriter.write("User-Agent: Java/1.5.0_07\r\n");
bufferedWriter.write("Host: " + host + ":" + port + "\r\n");
bufferedWriter.write("Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n");
bufferedWriter.write("Connection: keep-alive\r\n");
bufferedWriter.write("Content-Length: " + length + "\r\n");
bufferedWriter.write("\r\n");
bufferedWriter.write(str2);
bufferedWriter.flush();
String str4 = new String(a(socket.getInputStream()), EncodedStringValue.StringEncoding.UTF_8);
try {
bufferedWriter.close();
} catch (IOException e2) {
e2.printStackTrace();
}
try {
socket.close();
} catch (IOException e3) {
e3.printStackTrace();
}
p = System.currentTimeMillis();
Log.v("OMSSEXECTIME", "COMUNICATE_TIME: end time = " + p);
q = p - o;
Log.v("OMSSEXECTIME", "COMUNICATE_TIME: consuming time = " + q);
str3 = str4.replaceAll(" ", "");
if (str3.contains("<statuscode>")) {
String substring = str3.substring(str3.indexOf("<statuscode>") + 12, str3.indexOf("</statuscode>"));
Log.i("CmccOmpAdUtility", "sendSocketRequest: return statuscode = " + substring);
if ("8603".equals(substring) || "8609".equals(substring)) {
f.c();
Log.i("CmccOmpAdUtility", "statuscode = " + substring + ", deviceid or seed is invalid at all.");
}
}
} catch (Exception e4) {
e = e4;
socket2 = socket;
bufferedWriter2 = bufferedWriter;
try {
throw e;
} catch (Throwable th) {
th = th;
bufferedWriter = bufferedWriter2;
socket = socket2;
if (bufferedWriter != null) {
try {
bufferedWriter.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
if (socket != null) {
try {
socket.close();
} catch (IOException e6) {
e6.printStackTrace();
}
}
throw th;
}
} catch (Throwable th2) {
th = th2;
if (bufferedWriter != null) {
}
if (socket != null) {
}
throw th;
}
} catch (Exception e7) {
e = e7;
Socket socket3 = socket;
bufferedWriter2 = null;
socket2 = socket3;
} catch (Throwable th3) {
th = th3;
bufferedWriter = null;
}
} catch (Exception e8) {
e = e8;
bufferedWriter2 = null;
} catch (Throwable th4) {
th = th4;
socket = null;
bufferedWriter = null;
}
}
return str3;
}
public static String a(String str, String str2, String str3) {
return OmpNative.getToken(str, str2, str3);
}
public static String a(String str, String str2, String str3, String str4) {
return OmpNative.GetDeviceID(str, str2, str3, str4);
}
public static String a(String str, String str2, String str3, String str4, String str5) {
return OmpNative.getEncryptedIMSI(str, str2, str3, str4, str5);
}
private static Hashtable a(HttpURLConnection httpURLConnection, Hashtable hashtable, int i2, String str) {
if (i2 == 200) {
try {
if (str.equals("0")) {
InputStream inputStream = httpURLConnection.getInputStream();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int i3 = 0;
while (true) {
int available = inputStream.available();
if (available == 0) {
available = 1;
}
byte[] bArr = new byte[available];
if (inputStream.read(bArr) == -1) {
break;
}
byteArrayOutputStream.write(bArr);
i3 = available + i3;
}
byte[] byteArray = byteArrayOutputStream.toByteArray();
Log.i("CmccOmpAdUtility", "EnableCalling answer is ...:\n" + new String(byteArray, EncodedStringValue.StringEncoding.UTF_8));
byteArrayOutputStream.close();
inputStream.close();
Log.i("CmccOmpAdUtility", "returnData = " + new String(byteArray, EncodedStringValue.StringEncoding.UTF_8));
Log.i("CmccOmpAdUtility", "received len = " + i3);
hashtable.put("respBody", byteArray);
}
} catch (IOException e2) {
hashtable.put("errorCode", "5151");
e2.printStackTrace();
}
}
return hashtable;
}
private static Hashtable a(Hashtable hashtable) {
int b2 = b();
if (b2 != 0) {
hashtable.put("errorCode", new StringBuilder().append(b2).toString());
}
return hashtable;
}
public static Hashtable a(Hashtable hashtable, String str) {
int i2;
if (str == null || str.length() == 0 || str.length() != 44) {
Log.i("CmccOmpAdUtility", "Token is invalid....5004");
Log.i("CmccOmpAdUtility", "Token is :" + str + "\n");
i2 = 5004;
} else {
i2 = 0;
}
if (i2 != 0) {
hashtable.put("errorCode", new StringBuilder().append(i2).toString());
}
return hashtable;
}
public static Hashtable a(Hashtable hashtable, String str, String str2, String str3, String str4) {
int b2 = b.b(b.f4235b, str, str2, str3, str4);
if (b2 != 0) {
Log.i("CmccOmpAdUtility", "Device register failed, code=" + b2);
} else {
b2 = 0;
}
if (b2 != 0) {
hashtable.put("errorCode", new StringBuilder().append(b2).toString());
}
return hashtable;
}
private static Hashtable a(Hashtable hashtable, Hashtable hashtable2) {
if (!hashtable2.containsKey("sidSignature") || hashtable2.get("sidSignature") == null || hashtable2.get("sidSignature").toString().length() == 0) {
hashtable.put("errorCode", Integer.toString(5253));
}
return hashtable;
}
private static void a(HttpURLConnection httpURLConnection, Hashtable hashtable, String str) {
if (hashtable != null) {
Enumeration keys = hashtable.keys();
Boolean bool = false;
while (keys.hasMoreElements()) {
String str2 = (String) keys.nextElement();
Log.v("CmccOmpAdUtility", "head key:" + str2);
String str3 = (String) hashtable.get(str2);
Log.v("CmccOmpAdUtility", "head key:" + str2 + "----head value:" + str3);
if (!str2.equals(SpeechConstant.NET_TIMEOUT)) {
httpURLConnection.setRequestProperty(str2, str3);
} else if (!str3.equals("") && str3 != null) {
httpURLConnection.setConnectTimeout(Integer.parseInt(str3));
bool = true;
}
}
if (!bool.booleanValue()) {
httpURLConnection.setConnectTimeout(90000);
}
}
Log.e("CmccOmpAdUtility", str);
httpURLConnection.setRequestProperty("Authorization", str);
}
private static boolean a(HttpURLConnection httpURLConnection, byte[] bArr) {
if (bArr != null) {
try {
OutputStream outputStream = httpURLConnection.getOutputStream();
outputStream.write(bArr);
outputStream.flush();
outputStream.close();
} catch (IOException e2) {
e2.printStackTrace();
return false;
}
}
return true;
}
private static byte[] a(InputStream inputStream) {
int read;
int i2;
int i3;
int i4;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
G = new ArrayList();
int[] iArr = new int[4];
Log.i("CmccOmpAdUtility", "start while header info .........");
int i5 = 0;
do {
i5++;
read = inputStream.read();
byteArrayOutputStream.write(read);
iArr[i5 % 4] = read;
if ((iArr[0] == 10 && iArr[1] == 13 && iArr[2] == 10 && iArr[3] == 13) || (iArr[0] == 13 && iArr[1] == 10 && iArr[2] == 13 && iArr[3] == 10)) {
for (String str : new String(byteArrayOutputStream.toByteArray(), EncodedStringValue.StringEncoding.UTF_8).split("\r\n")) {
G.add(str.toUpperCase());
}
String f2 = f("CONTENT-LENGTH");
if (f2 == null || "".equals(f2)) {
f2 = "0";
}
i2 = Integer.parseInt(f2);
}
i3 = 0;
while (true) {
if (i2 == 0) {
Log.i("CmccOmpAdUtility", " bodySize == 0 ......");
break;
}
int available = inputStream.available();
if (available == 0) {
available = 1;
}
byte[] bArr = new byte[available];
if (inputStream.read(bArr) == -1) {
break;
}
byteArrayOutputStream.write(bArr);
i4 = available + i3;
if (i4 >= i2) {
break;
}
i3 = i4;
}
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
inputStream.close();
Log.i("CmccOmpAdUtility", " httpbodyArray.length = " + byteArray.length);
return byteArray;
} while (read != -1);
Log.i("CmccOmpAdUtility", "read -1 end ........");
i2 = 0;
i3 = 0;
while (true) {
if (i2 == 0) {
}
i3 = i4;
}
byte[] byteArray2 = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
inputStream.close();
Log.i("CmccOmpAdUtility", " httpbodyArray.length = " + byteArray2.length);
return byteArray2;
}
public static int b() {
if (d()) {
return 0;
}
Log.i("CmccOmpAdUtility", "Connection is failed...5150");
return 5150;
}
public static int b(Context context) {
if (context != null) {
return 0;
}
Log.e("CmccOmpAdUtility", "本地初始化context失败 error = 5053,context为null");
return 5053;
}
public static int b(String str) {
Log.i("CmccOmpAdUtility", "check pid : " + str + ", len=" + str.length());
if (str == null || str.length() <= 100) {
return 0;
}
Log.e("CmccOmpAdUtility", "packageName or VersionCode illegale pid.length = " + str.length());
return 5052;
}
public static int b(String str, String str2) {
return OmpNative.getSeed(str, str2);
}
private static String b(Context context, String str, String str2, String str3, String str4) {
g = context.getPackageName() + Constant.FilePath.IDND_PATH + e;
f = g + Constant.FilePath.IDND_PATH + c(context);
new StringBuilder("/data/data/").append(g).append(Constant.FilePath.IDND_PATH);
h = ((ContextWrapper) context).getPackageResourcePath();
return OmpNative.GetEncryptedContFlex(context, str, str2, str3, str4, f, h);
}
public static String b(String str, String str2, String str3) {
return OmpNative.Base64(str, str2, str3);
}
public static String b(String str, String str2, String str3, String str4) {
return OmpNative.GetRegMac(str, str2, str3, str4);
}
private static Hashtable b(Hashtable hashtable, String str) {
int b2 = b(str);
if (b2 != 0) {
hashtable.put("errorCode", new StringBuilder().append(b2).toString());
}
return hashtable;
}
private static Hashtable b(Hashtable hashtable, Hashtable hashtable2) {
if (!hashtable2.containsKey("ttoken") || hashtable2.get("ttoken") == null || hashtable2.get("ttoken").toString().length() == 0) {
hashtable.put("errorCode", Integer.toString(5254));
}
return hashtable;
}
public static int c(String str) {
if (str != null && !str.trim().equals("") && str.length() != 0) {
return 0;
}
Log.e("CmccOmpAdUtility", "url error, url=(" + str + "), errorcode=5101");
return 5101;
}
private static String c() {
StringBuffer stringBuffer = new StringBuffer();
String[] strArr = {"0", "1", "2", SsoSdkConstants.BUSI_TYPE_SMSLOGIN, "4", "5", "6", "7", "8", "9"};
Random random = new Random();
for (int i2 = 0; i2 < 14; i2++) {
stringBuffer.append(strArr[random.nextInt(10)]);
}
return stringBuffer.toString();
}
public static String c(Context context) {
int myPid = Process.myPid();
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : ((ActivityManager) context.getSystemService("activity")).getRunningAppProcesses()) {
if (runningAppProcessInfo.pid == myPid) {
return runningAppProcessInfo.processName;
}
}
return null;
}
public static String c(String str, String str2, String str3, String str4) {
return OmpNative.GetAPKMac(str, str2, str3, str4);
}
public static int d(String str) {
if (str != null && !str.trim().equals("") && str.length() <= 20) {
return 0;
}
Log.e("CmccOmpAdUtility", "input appid is error... 5104");
return 5104;
}
public static String d(String str, String str2, String str3, String str4) {
return OmpNative.GetDEXMac(str, str2, str3, str4);
}
private static boolean d() {
ConnectivityManager connectivityManager = (ConnectivityManager) b.f4235b.getSystemService("connectivity");
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
for (int i2 = 0; i2 <= 40; i2++) {
if (activeNetworkInfo != null && activeNetworkInfo.isAvailable()) {
String extraInfo = activeNetworkInfo.getExtraInfo();
String typeName = activeNetworkInfo.getTypeName();
Log.i("CmccOmpAdUtility_isConnect", "networkinfo = " + extraInfo + " typeName = " + typeName);
Log.i("CmccOmpAdUtility", "curConfUrlField.getWapMode() is 0");
if ("0".equals("1")) {
v = false;
Log.i("CmccOmpAdUtility", "SMS initialize");
return true;
}
if (typeName.toLowerCase().equals("wifi")) {
v = false;
Log.i("CmccOmpAdUtility", "wifi");
return true;
}
if (extraInfo == null) {
return false;
}
if ("labwap3".equals(extraInfo)) {
Log.i("CmccOmpAdUtility", "labwap3");
v = true;
w = "192.168.230.8";
x = 9028;
} else if ("cmwap".equals(extraInfo)) {
Log.i("CmccOmpAdUtility", "cmwap");
v = true;
w = z;
x = A;
} else {
v = false;
Log.i("CmccOmpAdUtility", "cmnet");
}
return true;
}
try {
Thread.sleep(500L);
} catch (InterruptedException e2) {
e2.printStackTrace();
}
activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
}
Log.i("CmccOmpAdUtility", "waiting get networkinfo time out");
return false;
}
public static int e(String str) {
if (str == null || str.trim().equals("") || str.trim().length() <= 20) {
return 0;
}
Log.e("CmccOmpAdUtility", "input channelid is error...5105");
return 5105;
}
public static String e(String str, String str2, String str3, String str4) {
return OmpNative.GetCERMac(I, str, str2, str3, str4);
}
private static int f(String str, String str2, String str3, String str4) {
int b2 = b.b(b.f4235b, str, str2, str3, str4);
if (b2 == 0) {
return 0;
}
Log.i("CmccOmpAdUtility", "Device register failed, code=" + b2);
return b2;
}
private static String f(String str) {
String str2 = "";
int i2 = 0;
while (i2 < G.size()) {
String str3 = (String) G.get(i2);
int indexOf = str3.indexOf(str + ":");
i2++;
str2 = indexOf != -1 ? str3.substring(str.length() + indexOf + 1).trim() : str2;
}
return str2;
}
private static int g(String str) {
if (str != null && str.length() != 0 && str.length() == 44) {
return 0;
}
Log.i("CmccOmpAdUtility", "Token is invalid....5004");
Log.i("CmccOmpAdUtility", "Token is :" + str + "\n");
return 5004;
}
}