VMOS Pro v2.9.9版本的 MD5 值为:42f292af86d02c1a08555cf2d3982a52

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


package com.mobile.auth.gatewayauth.manager;

import android.content.Context;
import android.os.Debug;
import android.os.Looper;
import android.text.TextUtils;
import com.mobile.auth.gatewayauth.annotations.SafeProtector;
import com.mobile.auth.gatewayauth.manager.base.Cache;
import com.mobile.auth.gatewayauth.manager.base.CacheKey;
import com.mobile.auth.gatewayauth.manager.compat.ResultCodeProcessor;
import com.mobile.auth.gatewayauth.model.TokenRet;
import com.mobile.auth.gatewayauth.utils.Checker;
import com.mobile.auth.gatewayauth.utils.g;
import com.mobile.auth.gatewayauth.utils.security.CheckProxy;
import com.mobile.auth.gatewayauth.utils.security.CheckRoot;
import com.mobile.auth.gatewayauth.utils.security.EmulatorDetector;
import com.mobile.auth.gatewayauth.utils.security.PackageUtils;
import com.nirvana.tools.core.CryptUtil;
import com.nirvana.tools.core.ExecutorManager;
import com.nirvana.tools.requestqueue.Callback;
import com.nirvana.tools.requestqueue.strategy.ThreadStrategy;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
public class SystemManager {
    private final Context f49089a;
    private String b;
    private String c;
    private final com.mobile.auth.l.a d;
    private volatile boolean e = true;
    private Future<?> f;

    public class AnonymousClass2 extends Callback<com.mobile.auth.r.c> {
        public final StringBuffer f49091a;
        public final CountDownLatch b;

        public AnonymousClass2(ThreadStrategy threadStrategy, long j, StringBuffer stringBuffer, CountDownLatch countDownLatch) {
            super(threadStrategy, j);
            this.f49091a = stringBuffer;
            this.b = countDownLatch;
        }

        public void a(com.mobile.auth.r.c cVar) {
            try {
                if (cVar.a() != null) {
                    this.f49091a.append(cVar.a());
                }
                this.b.countDown();
            } catch (Throwable th) {
                try {
                    com.mobile.auth.gatewayauth.a.a(th);
                } catch (Throwable th2) {
                    com.mobile.auth.gatewayauth.a.a(th2);
                }
            }
        }

        @Override
        public void onResult(com.mobile.auth.r.c cVar) {
            try {
                a(cVar);
            } catch (Throwable th) {
                try {
                    com.mobile.auth.gatewayauth.a.a(th);
                } catch (Throwable th2) {
                    com.mobile.auth.gatewayauth.a.a(th2);
                }
            }
        }
    }

    static {
        System.loadLibrary("auth_number_product-2.12.3.4-nolog-online-standard-channel_alijtca_plus");
    }

    public SystemManager(final Context context, com.mobile.auth.l.a aVar) {
        this.f49089a = context.getApplicationContext();
        this.f = ExecutorManager.getInstance().scheduleFuture(new Runnable() {
            @Override
            public void run() {
                try {
                    SystemManager.a(SystemManager.this, PackageUtils.getPackageName(context));
                    SystemManager.b(SystemManager.this, PackageUtils.getSign(context));
                } catch (Throwable th) {
                    try {
                        com.mobile.auth.gatewayauth.a.a(th);
                    } catch (Throwable th2) {
                        com.mobile.auth.gatewayauth.a.a(th2);
                    }
                }
            }
        });
        this.d = aVar;
    }

    private TokenRet a(ResultCodeProcessor resultCodeProcessor, String str) {
        try {
            if (com.mobile.auth.gatewayauth.utils.b.f(this.f49089a)) {
                if (com.mobile.auth.gatewayauth.utils.b.e(this.f49089a)) {
                    return null;
                }
                return resultCodeProcessor.convertErrorInfo("-10006", "移动网络未开启", str);
            }
            return resultCodeProcessor.convertErrorInfo("-10005", "SIM卡无法检测", str);
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public static String a(SystemManager systemManager, String str) {
        try {
            systemManager.b = str;
            return str;
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public static String b(SystemManager systemManager, String str) {
        try {
            systemManager.c = str;
            return str;
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    @SafeProtector
    private native String requestCellularIp();

    public TokenRet a(ResultCodeProcessor resultCodeProcessor, boolean z, String str) {
        try {
            TokenRet checkEnvSafe = checkEnvSafe(resultCodeProcessor, str);
            return (checkEnvSafe == null && z) ? a(resultCodeProcessor, str) : checkEnvSafe;
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public synchronized String a() {
        try {
            Future<?> future = this.f;
            if (future != null) {
                try {
                    future.get();
                    this.f = null;
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } catch (ExecutionException e2) {
                    e2.printStackTrace();
                }
            }
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
        return this.b;
    }

    public void a(String str) {
        try {
            if ((FeatureManager.getInstance().get(FeatureManager.FEATURE_KEY_WHITE_CHECK) == null || !"false".equals(FeatureManager.getInstance().get(FeatureManager.FEATURE_KEY_WHITE_CHECK).toString())) && !TextUtils.isEmpty(str)) {
                InputStream inputStream = null;
                try {
                    String md5Hex = CryptUtil.md5Hex(str);
                    if (TextUtils.isEmpty(md5Hex)) {
                        this.e = true;
                        return;
                    }
                    InputStream open = this.f49089a.getAssets().open(md5Hex);
                    this.e = false;
                    if (open != null) {
                        try {
                            open.close();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                } catch (Exception unused) {
                    this.e = true;
                    if (0 != 0) {
                        try {
                            inputStream.close();
                        } catch (IOException e2) {
                            e2.printStackTrace();
                        }
                    }
                }
            }
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
            }
        }
    }

    public synchronized <T> boolean a(String str, Cache<T> cache, long j) {
        try {
            long currentTimeMillis = System.currentTimeMillis();
            if (cache == null || cache.getKey() == null || !cache.getKey().equals(str) || cache.getExpiredTime() - j <= currentTimeMillis) {
                if (cache != null) {
                    this.d.a("ExpiredTime:", String.valueOf(cache.getExpiredTime()), "|threshold:", String.valueOf(j), "|currTime:", String.valueOf(currentTimeMillis));
                }
                return false;
            }
            return true;
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return false;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return false;
            }
        }
    }

    public synchronized String b() {
        try {
            Future<?> future = this.f;
            if (future != null) {
                try {
                    future.get();
                    this.f = null;
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } catch (ExecutionException e2) {
                    e2.printStackTrace();
                }
            }
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
        return this.c;
    }

    public String b(String str) {
        if (str == null) {
            return "unknown";
        }
        char c = 65535;
        try {
            int hashCode = str.hashCode();
            if (hashCode != -1350608857) {
                if (hashCode != 95009260) {
                    if (hashCode == 880617272 && str.equals("cm_zyhl")) {
                        c = 0;
                    }
                } else if (str.equals("cu_xw")) {
                    c = 1;
                }
            } else if (str.equals("ct_sjl")) {
                c = 2;
            }
            return "CMCC";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String c() {
        try {
            return com.mobile.auth.gatewayauth.utils.b.b(this.f49089a);
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String c(String str) {
        try {
            return "sdk." + b(str).toLowerCase() + ".get.prelogincode";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    @SafeProtector
    public TokenRet checkEnvSafe(ResultCodeProcessor resultCodeProcessor, String str) {
        try {
            try {
                if (this.e) {
                    String c = Checker.c();
                    if (!TextUtils.isEmpty(c) && !"0".equals(c)) {
                        return resultCodeProcessor.convertErrorInfo("-10003", "手机终端不安全:the app is attached, please use safe phone!", str);
                    }
                }
                String isDeviceRooted = CheckRoot.isDeviceRooted();
                if (TextUtils.isEmpty(isDeviceRooted)) {
                    if (Thread.currentThread() == Looper.getMainLooper().getThread() && EmulatorDetector.isEmulator(this.f49089a)) {
                        return resultCodeProcessor.convertErrorInfo("-10003", "手机终端不安全:Emulator is detected, please use real phone!", str);
                    }
                    if (CheckProxy.isDevicedProxy(this.f49089a)) {
                        return resultCodeProcessor.convertErrorInfo("-10003", "手机终端不安全:the phone is proxy, please do not proxy!", str);
                    }
                    if (!Debug.isDebuggerConnected() || g.a()) {
                        return null;
                    }
                    return resultCodeProcessor.convertErrorInfo("-10003", "手机终端不安全:the app is debuggerConnected, please do not debug!", str);
                }
                return resultCodeProcessor.convertErrorInfo("-10003", "手机终端不安全:the phone is root, ".concat(String.valueOf(isDeviceRooted)), str);
            } catch (Exception e) {
                return resultCodeProcessor.convertErrorInfo("-10003", "无法判运营商: " + e.getMessage(), str);
            }
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String d() {
        try {
            return com.mobile.auth.gatewayauth.utils.b.c(this.f49089a);
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String d(String str) {
        try {
            return "sdk." + b(str).toLowerCase() + ".pregetoken";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    @SafeProtector
    public native synchronized String decryptContent(String str);

    public Context e() {
        try {
            return this.f49089a;
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String e(String str) {
        try {
            return "sdk." + b(str).toLowerCase() + ".get.logincode";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    @SafeProtector
    public native synchronized String encryptContent(String str);

    public String f(String str) {
        try {
            return "sdk." + b(str).toLowerCase() + ".get.logintoken";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String g(String str) {
        try {
            return "sdk." + b(str).toLowerCase() + ".getoken";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    @SafeProtector
    public native CacheKey getSimCacheKey(boolean z, String str);

    @SafeProtector
    public native CacheKey getVendorCacheKey(String str);

    public String h(String str) {
        try {
            return b(str).toLowerCase() + ".authpage.login";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String i(String str) {
        try {
            return b(str).toLowerCase() + ".authpage.return";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String j(String str) {
        try {
            return b(str).toLowerCase() + ".authpage.switch";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String k(String str) {
        try {
            return b(str).toLowerCase() + ".authpage.protocol";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }

    public String l(String str) {
        try {
            return b(str).toLowerCase() + ".authpage.start";
        } catch (Throwable th) {
            try {
                com.mobile.auth.gatewayauth.a.a(th);
                return null;
            } catch (Throwable th2) {
                com.mobile.auth.gatewayauth.a.a(th2);
                return null;
            }
        }
    }
}