百度手机卫士 v8.1.5版本的 MD5 值为:15af71eae74e2f2b5b9f845fe77a4804

以下内容为反编译后的 ful.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.BDLocationListener;
import com.baidu.location.LocationClient;
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 ful {
    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 LocationClient k;
    private BDLocationListener l;
    private String m;
    private fur o;
    private File p;
    private boolean n = false;
    private int q = fuq.b;

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

    public void a() {
        if (this.b != null && this.c != null) {
            this.o = fur.a(this.j);
            try {
                int a2 = hki.a(this.j);
                if ((1 == a2 || fuo.h(this.j)) && -1 != a2) {
                    this.p = new File(this.j.getFilesDir(), "bdurl");
                    if (!this.p.exists()) {
                        this.p.mkdirs();
                    }
                    try {
                        this.o.a(g());
                        this.o.init(this.p);
                        this.q = this.o.startDetect(c());
                    } catch (Exception e) {
                        hnj.a(this.j).a("bdsc", "bdsple", (Number) 1);
                    }
                    if (this.q >= fuo.n(this.j)) {
                        a(this.o.getResponseFile());
                    }
                    this.o.release();
                    this.n = this.q != fuq.b;
                    fup.a(this.j, this.g, this.m, this.n, this.q);
                }
            } 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.m = e();
        Bundle bundle = new Bundle();
        bundle.putString("url", this.f);
        bundle.putInt("requestType", fuq.l);
        bundle.putString("channelInfo", "1009717f");
        bundle.putStringArray("headerKeyWords", this.b);
        bundle.putStringArray("pageKeyWords", this.e != null ? this.e : a);
        bundle.putInt("checkSet", fuo.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 (hjp.a(file, this.i) && hjo.c(this.i) < 536870912) {
            String a2 = hji.a(hjo.d(this.i));
            DxbbReporter.a(this.j, a(hln.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", him.a());
            jSONObject.put("haspermission", hld.a());
            jSONObject.put("network", this.m);
            if ("wifi".equals(this.m) && (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.q);
            jSONObject.put("timestamp", System.currentTimeMillis());
            jSONObject.put("requrl", this.f);
            jSONObject.put("date", a(System.currentTimeMillis()));
            ays aysVar = new ays();
            aysVar.d = false;
            aysVar.c = false;
            ArrayList<ayn> a2 = ayo.a(this.j).a(aysVar);
            if (a2 != null) {
                JSONArray jSONArray2 = new JSONArray();
                for (ayn aynVar : a2) {
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put("pkg", aynVar.d());
                    jSONObject2.put("vc", aynVar.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 {
            hhs.a(new fum(this, strArr, countDownLatch));
            countDownLatch.await(60L, TimeUnit.SECONDS);
            if (this.k != null) {
                this.k.unRegisterLocationListener(this.l);
                this.k.stop();
                this.k = null;
                this.l = null;
            }
        } catch (Exception e) {
            if (this.k != null) {
                this.k.unRegisterLocationListener(this.l);
                this.k.stop();
                this.k = null;
                this.l = null;
            }
        } catch (Throwable th) {
            if (this.k != null) {
                this.k.unRegisterLocationListener(this.l);
                this.k.stop();
                this.k = null;
                this.l = null;
            }
            throw th;
        }
        return strArr;
    }

    private String e() {
        switch (hki.a(this.j)) {
            case 1:
                return "wifi";
            case 2:
                return "2g";
            case 3:
                return "3g";
            case 4:
                return "mobile";
            case 5:
                return "4g";
            default:
                return "none";
        }
    }

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

    private String g() {
        hkz a2;
        try {
            hmb.a(5552);
            String j = fuo.j(this.j);
            JSONObject jSONObject = new JSONObject(fuo.k(this.j));
            if (TextUtils.isEmpty(j) || (a2 = hky.a(this.j, j)) == null || jSONObject.optInt("vc", 0) > a2.e) {
                String optString = jSONObject.optString("url");
                File file = new File(this.p, "antihijack-" + jSONObject.optInt("vc", 0) + ".apk");
                try {
                    HttpUtils.a(this.j, optString, file);
                    String j2 = fuo.j(this.j);
                    fuo.e(this.j, file.getAbsolutePath());
                    hjo.a(new File(j2));
                    hnj.a(this.j).a("bdsc", "bdspls", (Number) 1);
                } catch (IOException e) {
                    e.printStackTrace();
                    hnj.a(this.j).a("bdsc", "bdsdpr", (Number) 1);
                }
            }
        } catch (JSONException e2) {
            e2.printStackTrace();
        } finally {
            hmb.a();
        }
        return fuo.j(this.j);
    }
}