导航菜单

页面标题

页面副标题

管控平台 v5.2.3.0. - g1.java 源代码

正在查看: 管控平台 v5.2.3.0. 应用的 g1.java JAVA 源代码文件

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


package com.zx.a.I8b7;

import android.annotation.SuppressLint;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.zx.a.I8b7.n1;
import com.zx.a.I8b7.q2;
import com.zx.a.I8b7.w0;
import com.zx.module.base.Callback;
import com.zx.module.exception.ZXModuleInvokeException;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import net.sqlcipher.BuildConfig;
import org.json.JSONException;
import org.json.JSONObject;

public class g1 {

    public static final Set<String> f1890b;

    public k2 f1891a;

    public class a implements Runnable {

        public final Callback f1892a;

        public a(Callback callback) {
            this.f1892a = callback;
        }

        @Override
        public void run() {
            try {
                boolean a2 = r2.a(j2.f1922a, "android.permission.ACCESS_WIFI_STATE", false);
                boolean a3 = r2.a(j2.f1922a, "android.permission.CHANGE_NETWORK_STATE", false);
                if (Build.VERSION.SDK_INT >= 24 && a2 && a3) {
                    g1.a(g1.this, this.f1892a);
                } else {
                    q1.a("开始执行getUAID333");
                    g1.b(g1.this, this.f1892a);
                }
            } catch (Throwable th) {
                q1.b("getUAID error:" + th);
                Callback callback = this.f1892a;
                if (callback != null) {
                    try {
                        callback.callback(g1.this.a(th.getMessage(), 1));
                    } catch (JSONException e) {
                        q1.a(e);
                    }
                }
            }
        }
    }

    @SuppressLint({"NewApi"})
    public class b extends ConnectivityManager.NetworkCallback {

        public ConnectivityManager f1894a;

        public c f1895b;

        public b(g1 g1Var, ConnectivityManager connectivityManager, c cVar) {
            this.f1894a = connectivityManager;
            this.f1895b = cVar;
        }

        @Override
        public void onAvailable(Network network) {
            super.onAvailable(network);
            q1.a("zx 网络切换: 使用移动网络访问");
            if (Build.VERSION.SDK_INT < 21 || this.f1894a == null) {
                return;
            }
            try {
                String unicomUAIDRequestUrl = g1.getUnicomUAIDRequestUrl("https://nisportal.10010.com:9001");
                q1.a("unicomUAIDNisportalUrl: " + unicomUAIDRequestUrl);
                HttpURLConnection httpURLConnection = (HttpURLConnection) network.openConnection(new URL(unicomUAIDRequestUrl));
                httpURLConnection.setConnectTimeout(7000);
                httpURLConnection.setReadTimeout(7000);
                httpURLConnection.connect();
                JSONObject jSONObject = new JSONObject(a1.a(m0.b("text/json; charset=utf-8"), httpURLConnection.getContentLength(), httpURLConnection.getResponseCode() == 200 ? httpURLConnection.getInputStream() : httpURLConnection.getErrorStream()).c());
                String optString = jSONObject.optString("authurl");
                if (TextUtils.isEmpty(optString)) {
                    throw new RuntimeException(jSONObject.toString());
                }
                String unicomUAIDRequestUrl2 = g1.getUnicomUAIDRequestUrl(optString);
                q1.a("unicomUAIDAuthUrl: " + unicomUAIDRequestUrl2);
                HttpURLConnection httpURLConnection2 = (HttpURLConnection) network.openConnection(new URL(unicomUAIDRequestUrl2));
                httpURLConnection2.setConnectTimeout(7000);
                httpURLConnection2.setReadTimeout(7000);
                httpURLConnection2.connect();
                String string = new JSONObject(a1.a(m0.b("text/json; charset=utf-8"), httpURLConnection2.getContentLength(), httpURLConnection2.getResponseCode() == 200 ? httpURLConnection2.getInputStream() : httpURLConnection2.getErrorStream()).c()).getString("code");
                q1.a("unicomUAID code: " + string);
                this.f1894a.unregisterNetworkCallback(this);
                ((h1) this.f1895b).a(0, string);
            } catch (Throwable th) {
                q1.a(th);
                this.f1894a.unregisterNetworkCallback(this);
                ((h1) this.f1895b).a(4, "网络切换: 使用移动网络访问失败");
            }
        }
    }

    public interface c {
    }

    static {
        HashSet hashSet = new HashSet();
        f1890b = hashSet;
        j2.f1924c = "core-n";
        j2.d = "2.0.2.5120";
        hashSet.add("fd39c63f1732f201");
        hashSet.add("182215c3273d3c96");
        hashSet.add("30c3b906fa3a6c10");
        hashSet.add("83e1f70a049353e0");
        hashSet.add("a14a9b473d09b4a4");
        hashSet.add("888db8aca12678cf");
        Set<String> set = j2.E;
        set.add("fd39c63f1732f201");
        set.add("182215c3273d3c96");
        set.add("30c3b906fa3a6c10");
        set.add("83e1f70a049353e0");
        set.add("888db8aca12678cf");
    }

    public static void a(com.zx.a.I8b7.g1 r5, com.zx.module.base.Callback r6) {
        throw new UnsupportedOperationException("Method not decompiled: com.zx.a.I8b7.g1.a(com.zx.a.I8b7.g1, com.zx.module.base.Callback):void");
    }

    public static void b(g1 g1Var, Callback callback) throws Exception {
        g1Var.getClass();
        n1 n1Var = new n1(new n1.a());
        w0.a aVar = new w0.a();
        String unicomUAIDRequestUrl = getUnicomUAIDRequestUrl("https://nisportal.10010.com:9001");
        q1.a("unicomUAIDNisportalUrl: " + unicomUAIDRequestUrl);
        w0.a a2 = aVar.a(unicomUAIDRequestUrl);
        a2.f2027b = "GET";
        a2.e = "unicom uaid nisportal api";
        JSONObject jSONObject = new JSONObject(new s0(n1Var, new w0(aVar)).a().e.c());
        String optString = jSONObject.optString("authurl");
        if (TextUtils.isEmpty(optString)) {
            throw new RuntimeException(jSONObject.toString());
        }
        w0.a aVar2 = new w0.a();
        String unicomUAIDRequestUrl2 = getUnicomUAIDRequestUrl(optString);
        q1.a("unicomUAIDAuthUrl: " + unicomUAIDRequestUrl2);
        w0.a a3 = aVar2.a(unicomUAIDRequestUrl2);
        a3.f2027b = "GET";
        a3.e = "unicom uaid auth api";
        String string = new JSONObject(new s0(n1Var, new w0(aVar2)).a().e.c()).getString("code");
        q1.a("unicomUAID code: " + string);
        callback.callback(g1Var.a(c1.a(string), 0));
    }

    private String buildMethodHash(String str) {
        return i.a(str, "SHA256").substring(0, 16);
    }

    public static String getUnicomUAIDRequestUrl(String str) {
        String str2 = j2.b(j2.h) + "-" + ((System.currentTimeMillis() / 1000) / 86400);
        SecureRandom secureRandom = i.f1909a;
        try {
            String substring = i.a(i.a("SHA256", str2.getBytes(StandardCharsets.UTF_8))).substring(0, 16);
            q1.a("getUnicomUAIDRequestUrl: prefix=" + str + ", lid=" + j2.b(j2.h) + ", request_id=" + substring);
            return str + "/api?appid=1073741824000&request_id=" + substring;
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("sha256String fail", e);
        }
    }

    public final String a(String str, int i) throws JSONException {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("data", str);
        jSONObject.put("code", i);
        return jSONObject.toString();
    }

    public String f182215c3273d3c96(String str) throws JSONException {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("data", false);
        jSONObject.put("code", 0);
        return jSONObject.toString();
    }

    public String f30c3b906fa3a6c10(String str) throws JSONException {
        try {
            boolean z = new JSONObject(str).getBoolean("isDebug");
            Log.d("setDebug", "isDebug: " + z);
            k.f1925a = z;
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("code", 0);
            return jSONObject.toString();
        } catch (Throwable th) {
            Log.e("ZXCoreModule setDebug", th.getMessage());
            return a(th.getMessage(), 1);
        }
    }

    public String f83e1f70a049353e0(String str) throws JSONException {
        JSONObject jSONObject = new JSONObject(str);
        j2.f1923b = jSONObject.getString("version");
        jSONObject.optString("channelName", BuildConfig.FLAVOR);
        Context context = j2.f1922a;
        j2.e = jSONObject.optString("channelId", BuildConfig.FLAVOR);
        return a(BuildConfig.FLAVOR, 0);
    }

    public String f888db8aca12678cf(String str) throws JSONException {
        return a("lib not work", 1);
    }

    public void fa14a9b473d09b4a4(String str, Callback callback) {
        q1.a("getUAID:" + str + "with cb");
        AtomicInteger atomicInteger = q2.f1986c;
        q2.c.f1989a.f1987a.execute(new a(callback));
    }

    public String ffd39c63f1732f201(String str) throws JSONException {
        String a2;
        boolean z = new JSONObject(str).getBoolean("allowExpired");
        ((o2) this.f1891a).getClass();
        if (!z) {
            String str2 = j2.i;
            boolean z2 = true;
            if (!TextUtils.isEmpty(str2)) {
                try {
                    if (System.currentTimeMillis() < Long.parseLong(str2.split("-")[1]) * 1000) {
                        z2 = false;
                    }
                } catch (Exception e) {
                    q1.b("zid判断过期异常:" + str2 + ", err :" + e.getMessage());
                }
            }
            if (z2) {
                a2 = null;
                return a(a2, 0);
            }
        }
        a2 = j2.a();
        return a(a2, 0);
    }

    public String a(String str, String str2) throws ZXModuleInvokeException {
        try {
            String buildMethodHash = buildMethodHash(str);
            if (!((HashSet) f1890b).contains(buildMethodHash)) {
                return a(str + "not in invokableMethods", 3);
            }
            if (!(new JSONObject(str2).optBoolean("_zx_external_call") ? j2.F : j2.E).contains(buildMethodHash)) {
                return a(str + "not in whiteList", 2);
            }
            Method declaredMethod = g1.class.getDeclaredMethod("f" + buildMethodHash, String.class);
            declaredMethod.setAccessible(true);
            return (String) declaredMethod.invoke(this, str2);
        } catch (Exception e) {
            q1.a(e);
            throw new ZXModuleInvokeException("Cannot invoke " + str + ", nested exception is " + e.getMessage(), e);
        }
    }

    public String a(String str, String str2, Callback callback) throws ZXModuleInvokeException {
        try {
            String buildMethodHash = buildMethodHash(str);
            if (!((HashSet) f1890b).contains(buildMethodHash)) {
                String a2 = a(str + "not in invokableMethods", 3);
                callback.callback(a2);
                return a2;
            }
            if (!(new JSONObject(str2).optBoolean("_zx_external_call") ? j2.F : j2.E).contains(buildMethodHash)) {
                String a3 = a(str + "not in whiteList", 2);
                callback.callback(a3);
                return a3;
            }
            q1.a("开始执行invokeAsync: method:" + str + "; " + str2 + ":cb");
            StringBuilder sb = new StringBuilder();
            sb.append("f");
            sb.append(buildMethodHash);
            Method declaredMethod = g1.class.getDeclaredMethod(sb.toString(), String.class, Callback.class);
            declaredMethod.setAccessible(true);
            return (String) declaredMethod.invoke(this, str2, callback);
        } catch (Exception e) {
            StringBuilder a4 = b2.a("开始执行invokeAsync");
            a4.append(e.getMessage());
            q1.b(a4.toString());
            throw new ZXModuleInvokeException("Cannot invokeAsync " + str + ", nested exception is " + e.getMessage(), e);
        }
    }
}