百度手机卫士 v8.6.2版本的 MD5 值为:fa60cb367e40201705a2d9f9ce2cbfdf

以下内容为反编译后的 gdk.java 源代码,内容仅作参考


package dxoptimizer;

import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.text.TextUtils;
import com.baidu.location.BDLocation;
import com.baidu.mobads.interfaces.utils.IXAdSystemUtils;
import com.dianxinos.optimizer.engine.dxmaster.DxbbReporter;
import com.dianxinos.optimizer.utils.HttpUtils;
import com.quickbird.mini.utils.Constants;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class gdk {
    private static final String[] a = {"<!--STATUS OK-->"};
    private String[] b;
    private String[] c;
    private String[] d;
    private String[] e;
    private String f;
    private String g;
    private String h;
    private File i;
    private Context j;
    private String k;
    private gdp m;
    private File n;
    private boolean l = false;
    private int o = gdo.b;

    public gdk(Context context) {
        this.b = gdn.b(context);
        this.c = gdn.a(context);
        this.d = gdn.c(context);
        this.e = gdn.d(context);
        this.j = context.getApplicationContext();
    }

    public void a() {
        if (this.b != null && this.c != null) {
            this.m = gdp.a(this.j);
            try {
                int a2 = hvy.a(this.j);
                if ((1 == a2 || gdm.h(this.j)) && -1 != a2) {
                    this.n = new File(this.j.getFilesDir(), "bdurl");
                    if (!this.n.exists()) {
                        this.n.mkdirs();
                    }
                    try {
                        this.m.a(g());
                        this.m.init(this.n);
                        this.o = this.m.startDetect(c());
                    } catch (Exception e) {
                        hzc.a(this.j);
                        hzc.a("bdsc", "bdsple", (Number) 1);
                    }
                    if (this.o >= gdm.n(this.j)) {
                        a(this.m.getResponseFile());
                    }
                    this.m.release();
                    this.l = this.o != gdo.b;
                    gdn.a(this.j, this.g, this.k, this.l, this.o);
                }
            } catch (Exception e2) {
            }
        }
    }

    private String b() {
        if (this.c == null || this.c.length <= 0) {
            return null;
        }
        this.g = this.c[a(this.c.length)];
        try {
            return "http://m.baidu.com/s?word=" + URLEncoder.encode(this.g, "gb2312") + "&from=1009717f&mon=1";
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }

    private int a(int i) {
        if (i > 0) {
            return (int) Math.round((i - 1) * Math.random());
        }
        return i;
    }

    private Bundle c() {
        this.f = b();
        this.h = (this.d == null || this.d.length == 0) ? "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53" : this.d[a(this.d.length)];
        this.k = e();
        Bundle bundle = new Bundle();
        bundle.putString("url", this.f);
        bundle.putInt("requestType", gdo.l);
        bundle.putString("channelInfo", "1009717f");
        bundle.putStringArray("headerKeyWords", this.b);
        bundle.putStringArray("pageKeyWords", this.e != null ? this.e : a);
        bundle.putInt("checkSet", gdm.l(this.j));
        bundle.putString("userAgent", this.h);
        bundle.putLong("request_timeout", Constants.MINUTE_MS);
        return bundle;
    }

    private void a(File file) {
        this.i = new File(file.getParent(), file.getName() + ".gz");
        if (hvf.a(file, this.i) && hve.c(this.i) < 536870912) {
            String a2 = huz.a(hve.d(this.i));
            DxbbReporter.a(this.j, a(hxe.a(this.j, this.i, a2 + ".gz"), a2));
        }
    }

    private JSONArray a(String str, String str2) {
        WifiInfo f;
        try {
            JSONArray jSONArray = new JSONArray();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("type", 24);
            jSONObject.put("hasroot", huc.a());
            jSONObject.put("haspermission", hwu.a());
            jSONObject.put("network", this.k);
            if (IXAdSystemUtils.NT_WIFI.equals(this.k) && (f = f()) != null) {
                jSONObject.put("bssid", f.getBSSID());
                jSONObject.put("ssid", f.getSSID());
            }
            jSONObject.put("hotword", this.g);
            jSONObject.put("ua", this.h);
            Object[] d = d();
            jSONObject.put("long", d[0]);
            jSONObject.put("lat", d[1]);
            jSONObject.put("fileurl", str);
            jSONObject.put("filemd5", str2);
            jSONObject.put("level", this.o);
            jSONObject.put("timestamp", System.currentTimeMillis());
            jSONObject.put("requrl", this.f);
            jSONObject.put("date", a(System.currentTimeMillis()));
            avn avnVar = new avn();
            avnVar.d = false;
            avnVar.c = false;
            ArrayList<avi> a2 = avj.a(this.j).a(avnVar);
            if (a2 != null) {
                JSONArray jSONArray2 = new JSONArray();
                for (avi aviVar : a2) {
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put("pkg", aviVar.d());
                    jSONObject2.put("vc", aviVar.h());
                    jSONArray2.put(jSONObject2);
                }
                jSONObject.put("pkglist", jSONArray2);
            }
            jSONArray.put(jSONObject);
            return jSONArray;
        } catch (JSONException e) {
            return null;
        }
    }

    public static String a(long j) {
        return new SimpleDateFormat("yyyy-mm-dd'T'HH:mm:ssZ").format(new Date(j));
    }

    private String[] d() {
        String[] strArr = new String[2];
        CountDownLatch countDownLatch = new CountDownLatch(1);
        try {
            bnu bnuVar = new bnu();
            bnuVar.a = BDLocation.BDLOCATION_GCJ02_TO_BD09LL;
            bnuVar.b = 2000;
            bnuVar.c = 60000;
            bnuVar.d = false;
            bnn.a(new gdl(this, strArr, countDownLatch), bnuVar);
            countDownLatch.await(60L, TimeUnit.SECONDS);
        } catch (Exception e) {
        }
        return strArr;
    }

    private String e() {
        switch (hvy.a(this.j)) {
            case 1:
                return IXAdSystemUtils.NT_WIFI;
            case 2:
                return "2g";
            case 3:
                return "3g";
            case 4:
                return "mobile";
            case 5:
                return "4g";
            default:
                return IXAdSystemUtils.NT_NONE;
        }
    }

    private WifiInfo f() {
        return ((WifiManager) this.j.getApplicationContext().getSystemService(IXAdSystemUtils.NT_WIFI)).getConnectionInfo();
    }

    private String g() {
        hwq a2;
        try {
            hxu.a(5552);
            String j = gdm.j(this.j);
            JSONObject jSONObject = new JSONObject(gdm.k(this.j));
            if (TextUtils.isEmpty(j) || (a2 = hwp.a(this.j, j)) == null || jSONObject.optInt("vc", 0) > a2.e) {
                String optString = jSONObject.optString("url");
                File file = new File(this.n, "antihijack-" + jSONObject.optInt("vc", 0) + ".apk");
                try {
                    HttpUtils.a(this.j, optString, file);
                    String j2 = gdm.j(this.j);
                    gdm.e(this.j, file.getAbsolutePath());
                    hve.a(new File(j2));
                    hzc.a(this.j);
                    hzc.a("bdsc", "bdspls", (Number) 1);
                } catch (IOException e) {
                    e.printStackTrace();
                    hzc.a(this.j);
                    hzc.a("bdsc", "bdsdpr", (Number) 1);
                }
            }
        } catch (JSONException e2) {
            e2.printStackTrace();
        } finally {
            hxu.a();
        }
        return gdm.j(this.j);
    }
}