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

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


package dxoptimizer;

import android.content.Context;
import android.text.TextUtils;
import android.util.Pair;
import com.baidu.mobads.interfaces.error.XAdErrorCode;
import com.baidu.sapi2.utils.SapiUtils;
import com.dianxinos.optimizer.module.netflowmgr.util.Constant;
import com.dianxinos.optimizer.utils.HttpUtils;
import com.quickbird.mini.vpn.vpn.VpnWatchdogThread;
import com.quickbird.sdk.internal.HttpsClient;
import java.io.UnsupportedEncodingException;
import java.net.SocketTimeoutException;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;

public class fkp {
    public static void a(Context context, String str, String str2, fkc fkcVar) {
        int i;
        int i2;
        String str3;
        String str4 = null;
        if (!hvy.c(context)) {
            if (fkcVar != null) {
                fkcVar.a(null, 2);
                return;
            }
            return;
        }
        try {
            try {
                hxu.a(90117);
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("mobile", str);
                jSONObject.put("productCode", str2);
                JSONObject jSONObject2 = new JSONObject();
                long currentTimeMillis = System.currentTimeMillis();
                jSONObject2.put("createTime", currentTimeMillis);
                jSONObject2.put(XAdErrorCode.ERROR_CODE_MESSAGE, hxs.a(hmd.b, currentTimeMillis, jSONObject.toString()));
                String jSONObject3 = jSONObject2.toString();
                JSONObject jSONObject4 = new JSONObject(HttpUtils.b(context, hmd.M, jSONObject3, a(jSONObject3)));
                str3 = jSONObject4.optJSONObject("response").optString("orderNumber");
                JSONObject optJSONObject = jSONObject4.optJSONObject("responseHeader");
                int optInt = optJSONObject.optInt("errcode");
                if (optJSONObject != null) {
                    str4 = optJSONObject.toString();
                }
                if (optInt == 200) {
                    i2 = 0;
                } else {
                    String str5 = str4;
                    i2 = 1;
                    str3 = str5;
                }
            } catch (Exception e) {
                if (e instanceof SocketTimeoutException) {
                    i = 3;
                } else {
                    i = 4;
                }
                hxu.a();
                i2 = i;
                str3 = null;
            }
            if (fkcVar != null) {
                fkcVar.a(str3, i2);
            }
        } finally {
            hxu.a();
        }
    }

    private static String a(String str) {
        if (str.length() > 50) {
            str = str.substring(0, 50);
        }
        return "checkStr=" + huz.a(str + "AYUEJ1AWWHKTYENYUG1RP1B52SY5R1OJ");
    }

    public static void a(Context context, String str, fkc fkcVar) {
        int i;
        int i2;
        String str2;
        if (!hvy.c(context)) {
            if (fkcVar != null) {
                fkcVar.a(null, 2);
                return;
            }
            return;
        }
        try {
            try {
                hxu.a(90118);
                JSONObject jSONObject = new JSONObject();
                JSONArray jSONArray = new JSONArray();
                jSONArray.put(str);
                jSONObject.put("phones", jSONArray);
                JSONObject jSONObject2 = new JSONObject();
                long currentTimeMillis = System.currentTimeMillis();
                jSONObject2.put("createTime", currentTimeMillis);
                jSONObject2.put(XAdErrorCode.ERROR_CODE_MESSAGE, hxs.a(hmd.b, currentTimeMillis, jSONObject.toString()));
                String jSONObject3 = jSONObject2.toString();
                JSONObject jSONObject4 = new JSONObject(HttpUtils.b(context, hmd.O, jSONObject3, a(jSONObject3)));
                JSONObject optJSONObject = jSONObject4.optJSONObject("responseHeader");
                if (optJSONObject.optInt(VpnWatchdogThread.VPN_WATCHDOG_STATUS) == 200) {
                    str2 = jSONObject4.optJSONObject("response").optJSONObject("datas").optJSONObject(str).getString("operation");
                    i2 = 0;
                } else {
                    str2 = optJSONObject.toString();
                    i2 = 1;
                }
            } catch (Exception e) {
                if (e instanceof SocketTimeoutException) {
                    i = 3;
                } else {
                    i = 4;
                }
                hxu.a();
                i2 = i;
                str2 = null;
            }
            if (fkcVar != null) {
                fkcVar.a(str2, i2);
            }
        } finally {
            hxu.a();
        }
    }

    public static void a(Context context, String str, String str2, String str3, String str4, fkc fkcVar) {
        int i;
        int i2;
        String str5;
        int i3;
        String str6 = null;
        if (!hvy.c(context)) {
            if (fkcVar != null) {
                fkcVar.a(null, 2);
                return;
            }
            return;
        }
        try {
            try {
                hxu.a(90119);
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("mobile", str);
                jSONObject.put("productCode", str4);
                jSONObject.put("paymentSmsCode", str2);
                jSONObject.put("orderNumber", str3);
                JSONObject jSONObject2 = new JSONObject();
                long currentTimeMillis = System.currentTimeMillis();
                jSONObject2.put("createTime", currentTimeMillis);
                jSONObject2.put(XAdErrorCode.ERROR_CODE_MESSAGE, hxs.a(hmd.b, currentTimeMillis, jSONObject.toString()));
                String jSONObject3 = jSONObject2.toString();
                JSONObject optJSONObject = new JSONObject(HttpUtils.b(context, hmd.P, jSONObject3, a(jSONObject3))).optJSONObject("responseHeader");
                int optInt = optJSONObject.optInt("errcode");
                if (optJSONObject != null) {
                    str6 = optJSONObject.toString();
                }
                if (optInt == 200) {
                    i3 = 0;
                } else {
                    i3 = 1;
                }
                hxu.a();
                String str7 = str6;
                i2 = i3;
                str5 = str7;
            } catch (Exception e) {
                if (e instanceof SocketTimeoutException) {
                    i = 3;
                } else {
                    i = 4;
                }
                hxu.a();
                i2 = i;
                str5 = null;
            }
            if (fkcVar != null) {
                fkcVar.a(str5, i2);
            }
        } catch (Throwable th) {
            hxu.a();
            throw th;
        }
    }

    public static void a(Context context, String[] strArr, fkc fkcVar) {
        int i;
        String str;
        eyo eyoVar;
        eyo eyoVar2 = null;
        int i2 = 4;
        int i3 = 0;
        JSONObject a = fko.a(strArr);
        try {
            if (hvy.c(context)) {
                try {
                    JSONObject b = b(a.toString());
                    if (b != null) {
                        hxu.a(90112);
                        str = HttpUtils.b(context, a(), b.toString());
                    } else {
                        str = null;
                    }
                    if (str != null) {
                        JSONObject c = c(str);
                        if (c == null) {
                            fkcVar.a(null, 1);
                            return;
                        }
                        if (c.getString("result").equals(String.valueOf(1))) {
                            JSONArray jSONArray = c.getJSONArray("detailinfo");
                            if (jSONArray == null || jSONArray.length() == 0) {
                                fkcVar.a(null, 9);
                                return;
                            }
                            JSONObject jSONObject = (JSONObject) jSONArray.get(0);
                            String string = jSONObject.getString("warncode");
                            if (string.equals("0")) {
                                try {
                                    eyoVar = fko.a(jSONObject);
                                    i = 0;
                                } catch (Exception e) {
                                    e = e;
                                    if (e instanceof SocketTimeoutException) {
                                        i2 = 3;
                                    } else if (e instanceof HttpUtils.HttpStatusException) {
                                        i2 = ((HttpUtils.HttpStatusException) e).getStatusCode() == 404 ? 5 : i3;
                                    }
                                    hxu.a();
                                    i = i2;
                                    if (fkcVar == null) {
                                    }
                                }
                            } else if (string.equals("1")) {
                                i = 7;
                                eyoVar = null;
                            } else if (string.equals("2")) {
                                i = 8;
                                eyoVar = null;
                            } else {
                                i = 4;
                                eyoVar = null;
                            }
                            hxu.a();
                            eyoVar2 = eyoVar;
                        }
                    }
                    i = 1;
                    eyoVar = null;
                    hxu.a();
                    eyoVar2 = eyoVar;
                } catch (Exception e2) {
                    e = e2;
                    i3 = 1;
                }
            } else {
                i = 2;
            }
            if (fkcVar == null) {
                fkcVar.a(eyoVar2, i);
            }
        } finally {
            hxu.a();
        }
    }

    public static void a(Context context, eyo eyoVar, String str, fkc fkcVar) {
        eyo eyoVar2;
        Exception e;
        int i;
        eyo eyoVar3;
        String str2;
        int i2 = 1;
        JSONObject a = fko.a(context, eyoVar, str);
        if (hvy.c(context)) {
            try {
                try {
                    JSONObject b = b(a.toString());
                    if (b != null) {
                        hxu.a(90113);
                        str2 = HttpUtils.b(context, a(), b.toString());
                    } else {
                        str2 = null;
                    }
                    if (str2 != null) {
                        JSONObject c = c(str2);
                        if (c == null) {
                            fkcVar.a(null, 1);
                            return;
                        }
                        if (c.getString("result").equals(String.valueOf(1))) {
                            String string = c.getString("errcode");
                            if (string.equals(String.valueOf(304002))) {
                                eyoVar2 = fko.a(new JSONArray(c.getJSONArray("detailinfo").toString()), eyoVar);
                                try {
                                    String string2 = c.getString("extparam");
                                    if (!TextUtils.isEmpty(string2)) {
                                        ezk.a(context).a(eyoVar.a, str, string2);
                                    }
                                    ezk.a(context).a(string2, eyoVar.a, eyoVar.h);
                                    i = 0;
                                    eyoVar3 = eyoVar2;
                                } catch (Exception e2) {
                                    e = e2;
                                    if (e instanceof SocketTimeoutException) {
                                        i2 = 3;
                                    } else if (!(e instanceof HttpUtils.HttpStatusException)) {
                                        i2 = 4;
                                    } else if (((HttpUtils.HttpStatusException) e).getStatusCode() == 404) {
                                        i2 = 5;
                                    }
                                    hxu.a();
                                    i = i2;
                                    eyoVar3 = eyoVar2;
                                    if (fkcVar == null) {
                                    }
                                }
                            } else if (string.equals(String.valueOf(304001))) {
                                eyoVar3 = ezk.a(context).a(eyoVar, str);
                                i = 6;
                            }
                        }
                    }
                    eyoVar3 = null;
                    i = 1;
                } catch (Exception e3) {
                    eyoVar2 = null;
                    e = e3;
                }
            } finally {
                hxu.a();
            }
        } else {
            eyoVar3 = null;
            i = 2;
        }
        if (fkcVar == null) {
            fkcVar.a(eyoVar3, i);
        }
    }

    public static void a(Context context, eyo eyoVar, String str, String str2, String str3, fkc fkcVar) {
        Object obj;
        JSONObject c;
        int i = 1;
        if (fkcVar == null) {
            throw new RuntimeException("call back object not allow null.");
        }
        if (context == null || eyoVar == null || str == null || str2 == null || str3 == null) {
            fkcVar.a(null, 4);
        }
        if (!hvy.c(context)) {
            fkcVar.a(null, 2);
            return;
        }
        JSONObject a = fko.a(context, eyoVar, str, str2, str3);
        if (a == null) {
            fkcVar.a(null, 4);
            return;
        }
        try {
            try {
                hxu.a(90114);
                c = c(HttpUtils.b(context, a(), b(a.toString()).toString()));
            } catch (Exception e) {
                i = e instanceof SocketTimeoutException ? 3 : 4;
                hxu.a();
                obj = null;
            }
            if (c == null) {
                fkcVar.a(null, 1);
                return;
            }
            if (c.getString("result").equals(String.valueOf(1))) {
                obj = fko.b(c.getJSONObject("detailinfo"));
                if (obj != null) {
                    i = 0;
                } else {
                    obj = null;
                }
            } else {
                obj = c.getString("errcode");
            }
            fkcVar.a(obj, i);
        } finally {
            hxu.a();
        }
    }

    public static void a(Context context, String str, String str2) {
        JSONObject a;
        if (context != null && str != null && str2 != null && hvy.c(context) && (a = fko.a(str, str2)) != null) {
            try {
                hxu.a(90115);
                HttpUtils.b(context, a(), b(a.toString()).toString());
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                hxu.a();
            }
        }
    }

    public static void b(Context context, String str, fkc fkcVar) {
        eyj eyjVar;
        eyj eyjVar2 = null;
        int i = 1;
        if (context == null || str == null || fkcVar == null) {
            fkcVar.a(null, 4);
            return;
        }
        if (!hvy.c(context)) {
            fkcVar.a(null, 2);
            return;
        }
        JSONObject a = fko.a(str);
        if (a != null) {
            try {
                hxu.a(90120);
                JSONObject c = c(HttpUtils.b(context, a(), b(a.toString()).toString()));
                if (c == null) {
                    fkcVar.a(null, 1);
                    return;
                }
                String string = c.getString("result");
                if (string == null) {
                    fkcVar.a(null, 1);
                    return;
                }
                if (string.equals(String.valueOf(1))) {
                    JSONObject optJSONObject = c.optJSONObject("detailinfo");
                    if (optJSONObject != null) {
                        eyj eyjVar3 = new eyj();
                        fko.a(eyjVar3, optJSONObject);
                        if (eyjVar3.a()) {
                            Pair<String, String> a2 = huv.a(context, eyjVar3.a);
                            eyjVar3.i = (String) a2.first;
                            eyjVar3.j = (String) a2.second;
                        }
                        eyjVar = eyjVar3;
                    } else {
                        eyjVar = null;
                    }
                    eyjVar2 = eyjVar;
                    i = 0;
                }
            } catch (Exception e) {
                i = e instanceof SocketTimeoutException ? 3 : 4;
            } finally {
                hxu.a();
            }
        }
        fkcVar.a(eyjVar2, i);
    }

    public static void c(Context context, String str, fkc fkcVar) {
        ArrayList arrayList;
        ArrayList arrayList2 = null;
        int i = 1;
        if (context == null || str == null || fkcVar == null) {
            fkcVar.a(null, 4);
            return;
        }
        if (!hvy.c(context)) {
            fkcVar.a(null, 2);
            return;
        }
        JSONObject b = fko.b(str);
        if (b != null) {
            try {
                hxu.a(90116);
                JSONObject c = c(HttpUtils.b(context, a(), b(b.toString()).toString()));
                if (c == null) {
                    fkcVar.a(null, 1);
                    return;
                }
                String string = c.getString("result");
                if (string == null) {
                    fkcVar.a(null, 1);
                    return;
                }
                if (string.equals(String.valueOf(1))) {
                    JSONArray optJSONArray = c.optJSONArray("detailinfo");
                    if (optJSONArray == null) {
                        fkcVar.a(null, 1);
                        return;
                    }
                    int length = optJSONArray.length();
                    if (length != 0) {
                        ArrayList arrayList3 = new ArrayList();
                        for (int i2 = 0; i2 < length; i2++) {
                            JSONObject jSONObject = (JSONObject) optJSONArray.get(i2);
                            eyj eyjVar = new eyj();
                            fko.a(eyjVar, jSONObject);
                            if (eyjVar.a()) {
                                Pair<String, String> a = huv.a(context, eyjVar.a);
                                eyjVar.i = (String) a.first;
                                eyjVar.j = (String) a.second;
                                arrayList3.add(eyjVar);
                            }
                        }
                        arrayList = arrayList3;
                    } else {
                        arrayList = null;
                    }
                    arrayList2 = arrayList;
                    i = 0;
                }
            } catch (Exception e) {
                i = e instanceof SocketTimeoutException ? 3 : 4;
            } finally {
                hxu.a();
            }
        }
        fkcVar.a(arrayList2, i);
    }

    private static JSONObject b(String str) {
        long currentTimeMillis = System.currentTimeMillis();
        JSONObject jSONObject = new JSONObject();
        String a = fkm.a(str, Constant.b);
        String a2 = fkm.a(new String[]{Constant.a, a, String.valueOf(currentTimeMillis)});
        jSONObject.put("partid", Constant.a);
        jSONObject.put("data", a);
        jSONObject.put(SapiUtils.KEY_QR_LOGIN_SIGN, a2);
        jSONObject.put("time", currentTimeMillis);
        return jSONObject;
    }

    private static JSONObject c(String str) {
        JSONObject jSONObject;
        String string;
        String string2;
        String string3;
        String string4;
        if (str == null) {
            return null;
        }
        try {
            JSONObject jSONObject2 = new JSONObject(str);
            string = jSONObject2.getString(SapiUtils.KEY_QR_LOGIN_SIGN);
            string2 = jSONObject2.getString("partid");
            string3 = jSONObject2.getString("data");
            string4 = jSONObject2.getString("time");
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (!TextUtils.isEmpty(string) && !TextUtils.isEmpty(string2) && !TextUtils.isEmpty(string3) && !TextUtils.isEmpty(string4)) {
            String a = fkm.a(new String[]{string2, string3, string4});
            if (!TextUtils.isEmpty(a) && a.equals(string)) {
                jSONObject = new JSONObject(fkm.b(string3, Constant.b));
                return jSONObject;
            }
        }
        jSONObject = null;
        return jSONObject;
    }

    private static String a() {
        try {
            StringBuilder sb = new StringBuilder();
            sb.append("https://sjws-rts.baidu.com/2.0/rd").append("?").append("url").append("=").append(URLEncoder.encode(hmd.T, HttpsClient.HTTP_CHARSET));
            return sb.toString();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
}