BTGO游戏盒 v3.4.80版本的 MD5 值为:000032bab1addaabfdc671ee6a7087ab

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


package com.mobile.auth.d;

import android.content.Context;
import android.net.Network;
import android.text.TextUtils;
import com.alipay.sdk.util.l;
import com.mobile.auth.d.e;
import com.mobile.auth.d.i;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.nirvana.tools.core.MobileNetRequestManager;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class a {

    private static final String f12771a = "a";

    public class AnonymousClass3 extends i.a {

        public final Context f12790a;

        public final String f12791b;

        public final String f12792c;

        public final String f12793d;

        public final String f12794e;

        public final String f12795f;

        public final com.mobile.auth.a.b f12796g;

        public AnonymousClass3(Context context, String str, String str2, String str3, String str4, String str5, com.mobile.auth.a.b bVar) {
            this.f12790a = context;
            this.f12791b = str;
            this.f12792c = str2;
            this.f12793d = str3;
            this.f12794e = str4;
            this.f12795f = str5;
            this.f12796g = bVar;
        }

        @Override
        public void run() {
            try {
                if (!new e().a(this.f12790a, "https://id6.me/auth/preauth.do")) {
                    if (a()) {
                        return;
                    }
                    com.mobile.auth.a.a.b(this.f12790a, h.a(MobileNetRequestManager.CODE_SWITCH_TIMEOUT, MobileNetRequestManager.MSG_SWITCH_TIMEOUT), this.f12795f, this.f12796g);
                } else {
                    if (a()) {
                        return;
                    }
                    String a10 = a.a(a.this, this.f12790a, this.f12791b, this.f12792c, this.f12793d, null, this.f12794e, this.f12795f);
                    if (a()) {
                        return;
                    }
                    com.mobile.auth.a.a.b(this.f12790a, a10, this.f12795f, this.f12796g);
                }
            } catch (Throwable th) {
                try {
                    ExceptionProcessor.processException(th);
                } catch (Throwable th2) {
                    ExceptionProcessor.processException(th2);
                }
            }
        }
    }

    public static String a() {
        try {
            return f12771a;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public static String a(Context context, String str, String str2, Network network) {
        try {
            return c(context, d.a(context, str, network), str2, network);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private String a(Context context, String str, String str2, String str3, Network network, String str4, String str5) {
        try {
            String b10 = b();
            String a10 = g.a(context, str, str2, str3, b10);
            String str6 = f12771a;
            com.mobile.auth.a.a.a(str6, "request params : ".concat(String.valueOf(a10)));
            String a11 = d.a(context, "https://id6.me/auth/preauth.do", a10, network, str4, str5);
            com.mobile.auth.a.a.a(str6, "request result : ".concat(String.valueOf(a11)));
            String b11 = b(context, a11, b10, network);
            if (TextUtils.isEmpty(b11)) {
                return "{\"result\":80001,\"msg\":\"请求异常\"}";
            }
            com.mobile.auth.c.e.a(str5, b11, a10);
            return b11;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private static String a(Context context, List<String> list, String str, Network network) {
        for (int i10 = 0; i10 < list.size(); i10++) {
            try {
                try {
                    list.get(i10);
                    TextUtils.isEmpty(list.get(i10));
                    String a10 = a(context, list.get(i10), str, network);
                    try {
                        JSONObject jSONObject = !TextUtils.isEmpty(a10) ? new JSONObject(a10) : null;
                        if (jSONObject != null && jSONObject.getInt(l.f2088c) == 0) {
                            return a10;
                        }
                    } catch (Exception e10) {
                        e10.printStackTrace();
                    }
                } catch (Exception e11) {
                    e11.printStackTrace();
                }
            } catch (Throwable th) {
                try {
                    ExceptionProcessor.processException(th);
                    return null;
                } catch (Throwable th2) {
                    ExceptionProcessor.processException(th2);
                    return null;
                }
            }
        }
        return null;
    }

    public static String a(a aVar, Context context, String str, String str2, String str3, Network network, String str4, String str5) {
        try {
            return aVar.a(context, str, str2, str3, network, str4, str5);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public static String a(String str, String str2) {
        try {
            return com.mobile.auth.b.a.c(str, str2);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private void a(final Context context, final String str, final i.a aVar, final int i10, final com.mobile.auth.a.b bVar) {
        try {
            final Future b10 = i.a().b(aVar);
            i.a().a(new Runnable() {
                @Override
                public void run() {
                    try {
                        try {
                            b10.get(i10, TimeUnit.MILLISECONDS);
                        } catch (Throwable th) {
                            try {
                                ExceptionProcessor.processException(th);
                            } catch (Throwable th2) {
                                ExceptionProcessor.processException(th2);
                            }
                        }
                    } catch (Throwable th3) {
                        try {
                            aVar.a(true);
                            if (th3 instanceof TimeoutException) {
                                com.mobile.auth.c.e.a(str, "{\"result\":80000,\"msg\":\"请求超时\"}", "");
                                com.mobile.auth.c.e.a(str).h("submitOnTimeoutInterrupted()");
                                com.mobile.auth.a.a.b(context, "{\"result\":80000,\"msg\":\"请求超时\"}", str, bVar);
                            } else {
                                com.mobile.auth.c.e.a(str, "{\"result\":80001,\"msg\":\"请求异常\"}", "");
                                com.mobile.auth.c.e.a(str).h("submitOnTimeoutInterrupted other exception : " + th3.getMessage());
                                com.mobile.auth.a.a.a(a.a(), "submitOnTimeoutInterrupted other exception", th3);
                                com.mobile.auth.a.a.b(context, "{\"result\":80001,\"msg\":\"请求异常\"}", str, bVar);
                            }
                            Future future = b10;
                            if (future == null || future.isDone()) {
                                return;
                            }
                            b10.cancel(true);
                        } finally {
                            Future future2 = b10;
                            if (future2 != null && !future2.isDone()) {
                                b10.cancel(true);
                            }
                        }
                    }
                }
            });
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }

    private String b() {
        try {
            String uuid = UUID.randomUUID().toString();
            if (TextUtils.isEmpty(uuid)) {
                return "";
            }
            String replace = uuid.replace("-", "");
            return replace.length() >= 16 ? replace.substring(0, 16) : replace;
        } catch (Throwable th) {
            try {
                com.mobile.auth.a.a.a(f12771a, "generateAesKey error", th);
                return "";
            } catch (Throwable th2) {
                try {
                    ExceptionProcessor.processException(th2);
                    return null;
                } catch (Throwable th3) {
                    ExceptionProcessor.processException(th3);
                    return null;
                }
            }
        }
    }

    private String b(Context context, String str, String str2, Network network) {
        try {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            try {
                JSONObject jSONObject = new JSONObject(str);
                int optInt = jSONObject.optInt(l.f2088c);
                String optString = jSONObject.optString(com.alipay.sdk.packet.e.f1979k);
                if ((optInt == 0 || optInt == 30002) && !TextUtils.isEmpty(optString)) {
                    String a10 = a(optString, str2);
                    if (!TextUtils.isEmpty(a10)) {
                        try {
                            jSONObject.put(com.alipay.sdk.packet.e.f1979k, new JSONObject(a10));
                        } catch (JSONException e10) {
                            e10.printStackTrace();
                            jSONObject.put(com.alipay.sdk.packet.e.f1979k, a10);
                        }
                        if (optInt != 30002) {
                            return jSONObject.toString();
                        }
                        JSONObject jSONObject2 = (JSONObject) jSONObject.opt(com.alipay.sdk.packet.e.f1979k);
                        ArrayList arrayList = new ArrayList();
                        JSONArray optJSONArray = jSONObject2.optJSONArray("urls");
                        if (optJSONArray != null) {
                            for (int i10 = 0; i10 < optJSONArray.length(); i10++) {
                                arrayList.add(optJSONArray.getString(i10));
                            }
                        }
                        if (arrayList.isEmpty()) {
                            return null;
                        }
                        return a(context, arrayList, str2, network);
                    }
                }
                return jSONObject.toString();
            } catch (Throwable th) {
                com.mobile.auth.a.a.a(f12771a, "decryptResult error", th);
                return null;
            }
        } catch (Throwable th2) {
            try {
                ExceptionProcessor.processException(th2);
                return null;
            } catch (Throwable th3) {
                ExceptionProcessor.processException(th3);
                return null;
            }
        }
    }

    private static String c(Context context, String str, String str2, Network network) {
        try {
            if (TextUtils.isEmpty(str)) {
                return null;
            }
            try {
                JSONObject jSONObject = new JSONObject(str);
                int optInt = jSONObject.optInt(l.f2088c);
                String optString = jSONObject.optString(com.alipay.sdk.packet.e.f1979k);
                if (optInt == 0 && !TextUtils.isEmpty(optString)) {
                    String a10 = a(optString, str2);
                    if (!TextUtils.isEmpty(a10)) {
                        try {
                            jSONObject.put(com.alipay.sdk.packet.e.f1979k, new JSONObject(a10));
                        } catch (JSONException e10) {
                            e10.printStackTrace();
                            jSONObject.put(com.alipay.sdk.packet.e.f1979k, a10);
                        }
                    }
                }
                return jSONObject.toString();
            } catch (Throwable th) {
                com.mobile.auth.a.a.a(f12771a, "decryptResult error", th);
                return null;
            }
        } catch (Throwable th2) {
            try {
                ExceptionProcessor.processException(th2);
                return null;
            } catch (Throwable th3) {
                ExceptionProcessor.processException(th3);
                return null;
            }
        }
    }

    public final void a(final Context context, final String str, final String str2, final String str3, final com.mobile.auth.a.b bVar) {
        try {
            int i10 = com.mobile.auth.a.a.f12674b;
            int i11 = i10 <= 0 ? 10000 : i10;
            final String a10 = c.a();
            final String a11 = c.a(context);
            com.mobile.auth.c.e.a(a10).a(str).b(a11).d("preauth").c(f.f(context)).i(context.getPackageName());
            a(context, a10, new i.a() {
                @Override
                public void run() {
                    try {
                        String a12 = a.a(a.this, context, str, str2, str3, null, a11, a10);
                        if (a()) {
                            return;
                        }
                        com.mobile.auth.a.a.b(context, a12, a10, bVar);
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }
            }, i11, bVar);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }

    public final void b(final Context context, final String str, final String str2, final String str3, final com.mobile.auth.a.b bVar) {
        try {
            int i10 = com.mobile.auth.a.a.f12674b;
            if (i10 <= 0) {
                i10 = 10000;
            }
            final String a10 = c.a();
            final String a11 = c.a(context);
            com.mobile.auth.c.e.a(a10).a(str).b(a11).d("preauth").c(f.f(context)).i(context.getPackageName());
            e eVar = new e();
            eVar.a(context, new e.a() {

                private boolean f12788i = false;

                private boolean f12789j = false;

                @Override
                public synchronized void a() {
                    try {
                        this.f12788i = true;
                        if (!this.f12789j) {
                            com.mobile.auth.c.e.a(a10, "{\"result\":80000,\"msg\":\"请求超时\"}", "");
                            com.mobile.auth.a.a.b(context, "{\"result\":80000,\"msg\":\"请求超时\"}", a10, bVar);
                        }
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }

                @Override
                public synchronized void a(int i11, String str4, long j10) {
                    try {
                        if (!this.f12788i && !this.f12789j) {
                            this.f12789j = true;
                            com.mobile.auth.c.e.a(a10).h("switchToMobile_L  onFail()  expendTime : ".concat(String.valueOf(j10))).a(i11).f(str4).b(j10);
                            com.mobile.auth.a.a.b(context, h.a(i11, str4), a10, bVar);
                            com.mobile.auth.a.a.a(a.a(), "Switching network failed (L), errorMsg :" + str4 + " , expendTime :" + j10);
                        }
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }

                @Override
                public void a(Network network, long j10) {
                    try {
                        com.mobile.auth.a.a.a(a.a(), "Switching network successfully (L) , expendTime :".concat(String.valueOf(j10)));
                        if (!this.f12788i && !this.f12789j) {
                            com.mobile.auth.c.e.a(a10).b(j10);
                            String a12 = a.a(a.this, context, str, str2, str3, network, a11, a10);
                            synchronized (this) {
                                if (!this.f12788i && !this.f12789j) {
                                    this.f12789j = true;
                                    com.mobile.auth.a.a.b(context, a12, a10, bVar);
                                }
                            }
                        }
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }
            });
            eVar.a(i10);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }
}