导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - ax.java 源代码

正在查看: Clash Legends v0.0.1 应用的 ax.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.paypal.android.sdk;

import android.content.Context;
import android.util.Base64;
import android.util.Log;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class ax {
    private static final String a = ax.class.getSimpleName();
    private Context b;
    private String c;
    private JSONObject d;
    private boolean e;

    public ax(Context context, String str) {
        this(context, str, (byte) 0);
    }

    private ax(Context context, String str, byte b) {
        String str2 = a;
        aw.a(str2, "entering Configuration url loading");
        this.b = context;
        this.c = str;
        String p = p();
        if ("".equals(p)) {
            throw new IOException("No valid config found for " + str);
        }
        aw.a(str2, "entering saveConfigDataToDisk");
        try {
            File file = new File(this.b.getFilesDir(), "CONFIG_DATA");
            File file2 = new File(this.b.getFilesDir(), "CONFIG_TIME");
            d.a(file, p);
            d.a(file2, String.valueOf(System.currentTimeMillis()));
            aw.a(str2, "leaving saveConfigDataToDisk successfully");
        } catch (IOException e) {
            new StringBuilder("Failed to write config data: ").append(e.toString());
        }
        this.d = new JSONObject(p);
        aw.a(a, "leaving Configuration url loading");
    }

    public ax(Context context, boolean z) {
        this.b = context;
        this.c = null;
        this.e = z;
        aw.a(3, "PRD", "confIsUpdatable=" + Boolean.toString(this.e));
        this.d = k();
        String str = a;
        aw.a(str, "Configuation initialize, dumping config");
        aw.a(str, this.d);
    }

    private JSONObject a(String str) {
        try {
            String str2 = a;
            aw.a(str2, "entering getIncrementalConfig");
            JSONObject jSONObject = new JSONObject(aw.b(this.b, str));
            aw.a(str2, "leaving getIncrementalConfig");
            return jSONObject;
        } catch (Exception e) {
            aw.a(6, "PRD", "Error while loading prdc Config " + str, e);
            return null;
        }
    }

    private static JSONObject a(JSONObject jSONObject, JSONObject jSONObject2) {
        try {
            aw.a(a, "entering mergeConfig");
            Iterator<String> keys = jSONObject2.keys();
            while (keys.hasNext()) {
                String next = keys.next();
                aw.a(a, "overridding " + next);
                jSONObject.put(next, jSONObject2.get(next));
            }
            aw.a(a, "leaving mergeConfig");
            return jSONObject;
        } catch (Exception e) {
            aw.a(6, "PRD", "Error encountered while applying prdc Config", e);
            return null;
        }
    }

    private JSONObject k() {
        try {
            JSONObject m = m();
            if (m != null) {
                if (aw.b(m.optString("conf_version", ""), "3.0")) {
                    if (this.e) {
                        if (System.currentTimeMillis() > Long.parseLong(s()) + (m.optLong("conf_refresh_time_interval", 0L) * 1000)) {
                            o();
                        }
                    }
                    aw.a(a, "Using cached config");
                    return m;
                }
                r();
            }
            JSONObject l = l();
            if (l == null) {
                Log.e(a, "default Configuration loading failed,Using hardcoded config");
                return n();
            }
            String a2 = aw.a(this.b, "prdc", (String) null);
            if (a2 == null) {
                if (this.e) {
                    o();
                }
                aw.a(3, "PRD", "prdc field not configured, using default config");
                return l;
            }
            aw.a(3, "PRD", "prdc field is configured, loading path:" + a2);
            JSONObject a3 = a(a2);
            if (a3 == null) {
                aw.a(6, "PRD", "prdc Configuration loading failed, using default config");
                return l;
            }
            JSONObject a4 = a(l, a3);
            if (a4 == null) {
                aw.a(6, "PRD", "applying prdc Configuration failed, using default config");
                return l;
            }
            aw.a(3, "PRD", "prdc configuration loaded successfully");
            return a4;
        } catch (Exception e) {
            aw.a(6, "PRD", "Severe Error while loading config, using hard code version", e);
            return n();
        }
    }

    private static JSONObject l() {
        String str = a;
        aw.a(str, "entering getDefaultConfigurations");
        try {
            String str2 = new String(Base64.decode("eyAiY29uZl92ZXJzaW9uIjogIjMuMCIsImFzeW5jX3VwZGF0ZV90aW1lX2ludGVydmFsIjogMzYwMCwgImZvcmNlZF9mdWxsX3VwZGF0ZV90aW1l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cHMucHJveHlzZXJ2ZXJwcm8vY29tLmljZWNvbGRhcHBzLnByb3h5c2VydmVycHJvLnZpZXdTdGFydCIsICJob3RzcG90c2hpZWxkLmFuZHJvaWQudnBuL2NvbS5hbmNob3JmcmVlLnVpLkhvdFNwb3RTaGllbGQiLCAiY29tLmRvZW50ZXIub25ldnBuL2NvbS5kb2VudGVyLm9uZXZwbi5WcG5TZXR0aW5ncyIsICJjb20ueWVzdnBuLmVuL2NvbS55ZXN2cG4uTWFpblRhYiIsICJjb20ub2ZmaWNld3l6ZS5wbHV0b3Zwbi9jb20ub2ZmaWNld3l6ZS5wbHV0b3Zwbi5Ib21lQWN0aXZpdHkiLCAib3JnLmFqZWplLmxvY2F0aW9uc3Bvb2ZlcnByby9vcmcuYWplamUubG9jYXRpb25zcG9vZmVycHJvLkZha2UiLCAibG9jYXRpb25QbGF5LkdQU0NoZWF0L2xvY2F0aW9uUGxheS5HUFNDaGVhdC5BY3Rpdml0eVNtYXJ0TG9jYXRpb24iIF0sICJsb2NhdGlvbl9taW5fYWNjdXJhY3kiOiA1MDAsICJsb2NhdGlvbl9tYXhfY2FjaGVfYWdlIjogMTgwMCwgInNlbmRfb25fYXBwX3N0YXJ0IjogMSwgImVuZHBvaW50X3VybCI6ICJodHRwczovL3N2Y3MucGF5cGFsLmNvbS9BY2Nlc3NDb250cm9sL0xvZ1Jpc2tNZXRhZGF0YSIsICJpbnRlcm5hbF9jYWNoZV9tYXhfYWdlIjogMzAsICJjb21wX3RpbWVvdXQiOiA2MDAgfQ==", 0), "UTF-8");
            aw.a(str, "leaving getDefaultConfigurations, Default Conf load succeed");
            return new JSONObject(str2);
        } catch (Exception e) {
            aw.a(6, "PRD", "Read default config file exception.", e);
            aw.a(a, "leaving getDefaultConfigurations,returning null");
            return null;
        }
    }

    private JSONObject m() {
        String str = a;
        aw.a(str, "entering getCachedConfiguration");
        try {
            String q = q();
            if (!"".equals(q)) {
                aw.a(str, "leaving getCachedConfiguration,cached config load succeed");
                return new JSONObject(q);
            }
        } catch (Exception e) {
            aw.a(a, "JSON Exception in creating config file", e);
        }
        aw.a(a, "leaving getCachedConfiguration,cached config load failed");
        return null;
    }

    private static JSONObject n() {
        aw.a(a, "entering getHardcodedConfig");
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("conf_version", "3.0");
            jSONObject.put("async_update_time_interval", 3600);
            jSONObject.put("forced_full_update_time_interval", 1800);
            jSONObject.put("conf_refresh_time_interval", 86400);
            jSONObject.put("location_min_accuracy", 500);
            jSONObject.put("location_max_cache_age", 1800);
            jSONObject.put("endpoint_url", "https://svcs.paypal.com/AccessControl/LogRiskMetadata");
        } catch (JSONException e) {
        }
        aw.a(a, "leaving getHardcodedConfig");
        return jSONObject;
    }

    private static void o() {
        aw.a(a, "Loading web config");
        ao.a().b();
    }

    private String p() {
        BufferedReader bufferedReader;
        aw.a(a, "entering getRemoteConfig");
        StringBuilder sb = new StringBuilder();
        InputStream inputStream = null;
        try {
            InputStream openStream = new URL(this.c).openStream();
            try {
                bufferedReader = new BufferedReader(new InputStreamReader(openStream, "UTF-8"));
                while (true) {
                    try {
                        String readLine = bufferedReader.readLine();
                        if (readLine == null) {
                            aw.a((Closeable) openStream);
                            aw.a((Closeable) bufferedReader);
                            aw.a(a, "leaving getRemoteConfig successfully");
                            return sb.toString();
                        }
                        sb.append(readLine);
                    } catch (Throwable th) {
                        th = th;
                        inputStream = openStream;
                        aw.a((Closeable) inputStream);
                        aw.a((Closeable) bufferedReader);
                        throw th;
                    }
                }
            } catch (Throwable th2) {
                th = th2;
                bufferedReader = null;
            }
        } catch (Throwable th3) {
            th = th3;
            bufferedReader = null;
        }
    }

    private String q() {
        try {
            return d.a(new File(this.b.getFilesDir(), "CONFIG_DATA"));
        } catch (IOException e) {
            aw.a(a, "Load cached config failed", e);
            return "";
        }
    }

    private boolean r() {
        try {
            String str = a;
            aw.a(str, "entering deleteCachedConfigDataFromDisk");
            File file = new File(this.b.getFilesDir(), "CONFIG_DATA");
            File file2 = new File(this.b.getFilesDir(), "CONFIG_TIME");
            if (file.exists()) {
                aw.a(str, "cached Config Data found, deleting");
                file.delete();
            }
            if (file2.exists()) {
                aw.a(str, "cached Config Time found, deleting");
                file.delete();
            }
            aw.a(str, "leaving deleteCachedConfigDataFromDisk");
            return true;
        } catch (Exception e) {
            aw.a(a, "error encountered while deleteCachedConfigData", e);
            return false;
        }
    }

    private String s() {
        try {
            return d.a(new File(this.b.getFilesDir(), "CONFIG_TIME"));
        } catch (IOException e) {
            return "";
        }
    }

    public final String a() {
        return this.c;
    }

    public final String b() {
        return this.d.optString("conf_version", "");
    }

    public final long c() {
        return this.d.optLong("async_update_time_interval", 0L);
    }

    public final long d() {
        return this.d.optLong("forced_full_update_time_interval", 0L);
    }

    public final long e() {
        return this.d.optLong("comp_timeout", 0L);
    }

    public final List f() {
        ArrayList arrayList = new ArrayList();
        JSONArray optJSONArray = this.d.optJSONArray("android_apps_to_check");
        for (int i = 0; optJSONArray != null && i < optJSONArray.length(); i++) {
            arrayList.add(optJSONArray.getString(i));
        }
        return arrayList;
    }

    public final String g() {
        return this.d.optString("endpoint_url", null);
    }

    public final boolean h() {
        return this.d.optBoolean("endpoint_is_stage", false);
    }

    public final au i() {
        try {
            String optString = this.d.optString("CDS", "");
            if (optString != null && !"".equals(optString)) {
                aw.a(3, "PRD", "CDS field was found");
                return new au(optString.trim());
            }
            aw.a(3, "PRD", "No CDS is configured, enabling all variables");
            return au.a;
        } catch (Exception e) {
            aw.a(6, "PRD", "Failed to decode CDS", e);
            return au.a;
        }
    }

    public final String j() {
        return this.d.optString("m", "QW5kcm9pZE1hZ25lcw==");
    }
}