导航菜单

页面标题

页面副标题

95爱播免登录版 v3.1.9 - b.java 源代码

正在查看: 95爱播免登录版 v3.1.9 应用的 b.java JAVA 源代码文件

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


package com.mobile.auth.gatewayauth.utils;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Proxy;
import android.net.wifi.WifiManager;
import android.text.TextUtils;
import com.mobile.auth.gatewayauth.Constant;
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
import com.mobile.auth.gatewayauth.utils.e;
import com.mobile.auth.gatewayauth.utils.security.CheckRoot;
import com.mobile.auth.gatewayauth.utils.security.EmulatorDetector;
import com.netease.LDNetDiagnoService.LDNetUtil;
import com.tencent.connect.common.Constants;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class b {
    static long a(String str) {
        try {
            return d(str);
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return -1L;
        }
    }

    private static long a(String str, String str2) {
        HttpURLConnection httpURLConnection;
        HttpURLConnection httpURLConnection2 = null;
        try {
            try {
                try {
                    httpURLConnection = (HttpURLConnection) new URL(str + str2).openConnection();
                } catch (Throwable th) {
                    th = th;
                }
            } catch (Exception e2) {
                e = e2;
            }
            try {
                httpURLConnection.setRequestMethod(Constants.HTTP_GET);
                httpURLConnection.setConnectTimeout(5000);
                httpURLConnection.setReadTimeout(5000);
                long currentTimeMillis = System.currentTimeMillis();
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
                StringBuilder sb = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    sb.append(readLine);
                }
                if (httpURLConnection.getResponseCode() != 200 || TextUtils.isEmpty(sb.toString())) {
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                    return 0L;
                }
                long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
                return currentTimeMillis2;
            } catch (Exception e3) {
                e = e3;
                httpURLConnection2 = httpURLConnection;
                i.c(e.b(e));
                if (httpURLConnection2 != null) {
                    httpURLConnection2.disconnect();
                }
                return 0L;
            } catch (Throwable th2) {
                th = th2;
                httpURLConnection2 = httpURLConnection;
                if (httpURLConnection2 != null) {
                    httpURLConnection2.disconnect();
                }
                throw th;
            }
        } catch (Throwable th3) {
            com.mobile.auth.gatewayauth.a.a(th3);
            return -1L;
        }
    }

    static String a(Context context) {
        try {
            return c(context);
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return null;
        }
    }

    static String a(PhoneNumberAuthHelper phoneNumberAuthHelper, Context context) {
        try {
            return b(phoneNumberAuthHelper, context);
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return null;
        }
    }

    private static void a(final Activity activity, final String str) {
        try {
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    try {
                        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
                        builder.setTitle("蜂窝网络环境自检结果");
                        builder.setMessage(str);
                        builder.setCancelable(true);
                        builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i2) {
                                try {
                                    dialogInterface.dismiss();
                                } catch (Throwable th) {
                                    com.mobile.auth.gatewayauth.a.a(th);
                                }
                            }
                        });
                        builder.create().show();
                    } catch (Throwable th) {
                        com.mobile.auth.gatewayauth.a.a(th);
                    }
                }
            });
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
        }
    }

    static void a(Context context, boolean z) {
        try {
            b(context, z);
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
        }
    }

    public static void a(final PhoneNumberAuthHelper phoneNumberAuthHelper, final Activity activity, final String str, final String str2) {
        try {
            if (phoneNumberAuthHelper == null) {
                a(activity, "认证参数实例为空\n请检测参数后重试");
                return;
            }
            if (activity == null) {
                a(activity, "Activity实例为空\n请检测参数后重试");
                return;
            }
            if (!(activity instanceof Activity)) {
                a(activity, "Activity实例类型非法\n请检测参数后重试");
                return;
            }
            final String b = b(activity.getApplicationContext());
            if (k.a(activity.getApplicationContext(), "android.permission.CHANGE_WIFI_STATE") != 0 && (b.equals(LDNetUtil.NETWORKTYPE_WIFI) || b.equals("NO_NETWORK"))) {
                a(activity, "当前非蜂窝网络,且无权限关闭wifi\n请手动关闭wifi,开启蜂窝网络后重试");
                return;
            }
            final ProgressDialog progressDialog = new ProgressDialog(activity);
            progressDialog.setProgressStyle(0);
            progressDialog.setCancelable(true);
            progressDialog.setMessage("正在检测蜂窝网络状况");
            progressDialog.show();
            e.a(new e.b(null) {
                @Override
                protected void a() {
                    try {
                        try {
                            boolean z = false;
                            z = false;
                            if (k.a(activity.getApplicationContext(), "android.permission.CHANGE_WIFI_STATE") == 0 && (b.equals(LDNetUtil.NETWORKTYPE_WIFI) || b.equals("NO_NETWORK"))) {
                                b.a(activity.getApplicationContext(), false);
                                for (int i2 = 0; i2 < 5; i2++) {
                                    Thread.sleep(1000L);
                                    final int i3 = i2 * 20;
                                    activity.runOnUiThread(new Runnable() {
                                        @Override
                                        public void run() {
                                            try {
                                                progressDialog.setMessage(String.format("正在检测蜂窝网络状况,当前进度%d%%", Integer.valueOf(i3)));
                                            } catch (Throwable th) {
                                                com.mobile.auth.gatewayauth.a.a(th);
                                            }
                                        }
                                    });
                                }
                                z = true;
                            }
                            boolean g2 = f.g(activity.getApplicationContext());
                            StringBuilder sb = new StringBuilder();
                            sb.append("当前设备信息:");
                            sb.append(g.a());
                            sb.append("\n");
                            sb.append("当前系统时间:");
                            sb.append(a.a());
                            sb.append("\n");
                            sb.append("是否为模拟器:");
                            String str3 = "是";
                            sb.append(EmulatorDetector.isEmulator(activity.getApplicationContext()) ? "是" : "否");
                            sb.append("\n");
                            sb.append("是否Root:");
                            sb.append(CheckRoot.isDeviceRooted() ? "是" : "否");
                            sb.append("\n");
                            sb.append("是否有SIM卡:");
                            if (!g2) {
                                str3 = "否";
                            }
                            sb.append(str3);
                            sb.append("\n");
                            sb.append("当前网络状态:");
                            sb.append(f.e(activity.getApplicationContext()));
                            sb.append("\n");
                            sb.append(b.a(activity.getApplicationContext()));
                            sb.append(b.a(phoneNumberAuthHelper, activity.getApplicationContext()));
                            sb.append("\n");
                            String defaultHost = Proxy.getDefaultHost();
                            sb.append("是否使用了代理:");
                            sb.append(TextUtils.isEmpty(defaultHost) ? "没有使用代理" : "代理主机地址:" + defaultHost);
                            sb.append("\n");
                            sb.append("私网ip地址:");
                            sb.append(f.a());
                            sb.append("\n");
                            long a = b.a(phoneNumberAuthHelper.getCurrentCarrierName());
                            if (a > 0) {
                                sb.append("运营商地址响应时间:");
                                sb.append(a);
                                sb.append("ms\n");
                            }
                            b.a(sb.toString(), activity, z, str, str2);
                            progressDialog.dismiss();
                        } catch (Exception e2) {
                            progressDialog.dismiss();
                            i.c(e.b(e2));
                        }
                    } catch (Throwable th) {
                        com.mobile.auth.gatewayauth.a.a(th);
                    }
                }
            });
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
        }
    }

    static void a(String str, Activity activity, boolean z, String str2, String str3) {
        try {
            b(str, activity, z, str2, str3);
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
        }
    }

    private static long b(String str) {
        long j2;
        Process exec;
        try {
            try {
                exec = Runtime.getRuntime().exec("ping -c 1 " + str);
            } catch (Exception e2) {
                e = e2;
                j2 = -1;
            }
            if (exec.waitFor() != 0) {
                return -1L;
            }
            j2 = 0;
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(exec.getInputStream()));
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    String c = c(readLine);
                    if (c != null) {
                        j2 = (long) Double.parseDouble(c);
                    }
                }
            } catch (Exception e3) {
                e = e3;
                i.c(e.b(e));
                return j2;
            }
            return j2;
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return -1L;
        }
    }

    private static String b(Context context) {
        ConnectivityManager connectivityManager;
        NetworkInfo activeNetworkInfo;
        NetworkInfo.State state;
        try {
            connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return null;
        }
        if (connectivityManager != null && (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) != null && activeNetworkInfo.isAvailable()) {
            NetworkInfo networkInfo = connectivityManager.getNetworkInfo(1);
            if (networkInfo != null && (state = networkInfo.getState()) != null && (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING)) {
                return LDNetUtil.NETWORKTYPE_WIFI;
            }
            NetworkInfo networkInfo2 = connectivityManager.getNetworkInfo(0);
            if (networkInfo2 != null) {
                NetworkInfo.State state2 = networkInfo2.getState();
                String subtypeName = networkInfo2.getSubtypeName();
                if (state2 != null && (state2 == NetworkInfo.State.CONNECTED || state2 == NetworkInfo.State.CONNECTING)) {
                    switch (activeNetworkInfo.getSubtype()) {
                        case 1:
                        case 2:
                        case 4:
                        case 7:
                        case 11:
                            return "2G";
                        case 3:
                        case 5:
                        case 6:
                        case 8:
                        case 9:
                        case 10:
                        case 12:
                        case 14:
                        case 15:
                            return "3G";
                        case 13:
                            return "4G";
                        default:
                            if (!subtypeName.equalsIgnoreCase("TD-SCDMA") && !subtypeName.equalsIgnoreCase("WCDMA")) {
                                if (!subtypeName.equalsIgnoreCase("CDMA2000")) {
                                    return "未知蜂窝网络";
                                }
                            }
                            return "3G";
                    }
                    com.mobile.auth.gatewayauth.a.a(th);
                    return null;
                }
            }
        }
        return "NO_NETWORK";
    }

    private static java.lang.String b(com.mobile.auth.gatewayauth.PhoneNumberAuthHelper r6, android.content.Context r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.mobile.auth.gatewayauth.utils.b.b(com.mobile.auth.gatewayauth.PhoneNumberAuthHelper, android.content.Context):java.lang.String");
    }

    @SuppressLint({"MissingPermission"})
    private static void b(Context context, boolean z) {
        try {
            if (k.a(context, "android.permission.CHANGE_WIFI_STATE") == 0) {
                ((WifiManager) context.getSystemService("wifi")).setWifiEnabled(z);
            }
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
        }
    }

    private static void b(String str, Activity activity, boolean z, String str2, String str3) {
        try {
            StringBuilder sb = new StringBuilder(str);
            long b = b(str3);
            String str4 = "ms\n";
            if (b > 0) {
                sb.append("蜂窝网络访问网络正常\n");
                sb.append("响应时间:");
                sb.append(b);
            } else {
                long a = a(str2, str3);
                if (a != 0) {
                    sb.append("蜂窝网络访问网络正常\n");
                    sb.append("响应时间:");
                    sb.append(a);
                } else {
                    str4 = "蜂窝网络无法访问网络\n";
                }
            }
            sb.append(str4);
            a(activity, sb.toString());
            if (z) {
                b(activity.getApplicationContext(), true);
            }
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
        }
    }

    private static String c(Context context) {
        try {
            return f.f(context) ? "蜂窝网络检测结果:已开启\n" : "蜂窝网络检测结果:未开启\n";
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return null;
        }
    }

    private static String c(String str) {
        try {
            String str2 = null;
            for (String str3 : str.split("\n")) {
                if (str3.contains("time=")) {
                    String substring = str3.substring(str3.indexOf("time=") + 5);
                    str2 = substring.substring(0, substring.indexOf("ms"));
                }
            }
            if (str2 == null) {
                return null;
            }
            return str2.trim();
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return null;
        }
    }

    private static long d(String str) {
        char c = 65535;
        try {
            int hashCode = str.hashCode();
            if (hashCode != 2072138) {
                if (hashCode != 2078865) {
                    if (hashCode == 2079826 && str.equals(Constant.CUCC)) {
                        c = 1;
                    }
                } else if (str.equals(Constant.CTCC)) {
                    c = 2;
                }
            } else if (str.equals(Constant.CMCC)) {
                c = 0;
            }
            String str2 = c != 0 ? c != 1 ? c != 2 ? "" : "https://id6.me/auth/preauth.do" : "https://opencloud.wostore.cn/openapi/netauth/precheck/wp?" : "http://www.cmpassport.com/unisdk/rs/getPrePhonescrip";
            if (TextUtils.isEmpty(str2)) {
                return 0L;
            }
            long b = b(str2);
            return b <= 0 ? a("", str2) : b;
        } catch (Throwable th) {
            com.mobile.auth.gatewayauth.a.a(th);
            return -1L;
        }
    }
}