OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.excelliance.user.account.f;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkRequest;
import android.os.Build;
import androidx.annotation.RequiresApi;
import com.android.spush.FakeServiceHelper;
import com.excelliance.kxqp.gs.util.bf;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import org.json.JSONObject;

public class g {

    public interface a {
        void a();

        void b();
    }

    static String a() {
        return b();
    }

    public static String a(Context context) {
        if (context == null) {
            return "";
        }
        String str = "";
        try {
            FutureTask futureTask = new FutureTask(new Callable<String>() {
                @Override
                public String call() throws Exception {
                    return g.a();
                }
            });
            a(context, futureTask);
            JSONObject optJSONObject = new JSONObject((String) futureTask.get()).optJSONObject("data");
            if (optJSONObject != null) {
                String optString = optJSONObject.optString("sessionId", "");
                try {
                    return !"null".equals(optString) ? optString : optString;
                } catch (Exception e) {
                    str = optString;
                    e = e;
                    e.printStackTrace();
                    return str;
                }
            }
        } catch (Exception e2) {
            e = e2;
        }
        return str;
    }

    private static String b() {
        InputStream inputStream;
        OutputStream outputStream = null;
        try {
            StringBuilder sb = new StringBuilder();
            for (String str : UUID.randomUUID().toString().split("-")) {
                sb.append(str);
            }
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("custId", "CI2005070001");
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("http://wz.app.sdbmcc.com:9015/bmcc-fass-ws-api/api/mobile/consistency/request").openConnection();
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setReadTimeout(30000);
            httpURLConnection.setConnectTimeout(30000);
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setRequestProperty("Content-Type", "application/json;chartset=UTF-8");
            httpURLConnection.setRequestProperty("seqId", sb.toString());
            httpURLConnection.setRequestProperty("appId", "cff0f35c21f8425cbee844cd329651a6");
            httpURLConnection.setRequestProperty("Authorization", a("cff0f35c21f8425cbee844cd329651a6", "9qpkn6hpk9wecwzo"));
            OutputStream outputStream2 = httpURLConnection.getOutputStream();
            try {
                outputStream2.write(jSONObject.toString().getBytes());
                inputStream = httpURLConnection.getInputStream();
            } catch (Exception e) {
                inputStream = null;
                outputStream = outputStream2;
                e = e;
            } catch (Throwable th) {
                inputStream = null;
                outputStream = outputStream2;
                th = th;
            }
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
                StringBuilder sb2 = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine != null) {
                        sb2.append(readLine);
                    } else {
                        bufferedReader.close();
                        String sb3 = sb2.toString();
                        a(outputStream2);
                        a(inputStream);
                        return sb3;
                    }
                }
            } catch (Exception e2) {
                e = e2;
                outputStream = outputStream2;
                try {
                    e.printStackTrace();
                    a(outputStream);
                    a(inputStream);
                    return "";
                } catch (Throwable th2) {
                    th = th2;
                    a(outputStream);
                    a(inputStream);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                outputStream = outputStream2;
                a(outputStream);
                a(inputStream);
                throw th;
            }
        } catch (Exception e3) {
            e = e3;
            inputStream = null;
        } catch (Throwable th4) {
            th = th4;
            inputStream = null;
        }
    }

    private static String a(String str, String str2) throws Exception {
        if (str == null || str.length() == 0) {
            throw new IllegalArgumentException("illegal appId");
        }
        if (str2 == null || str2.length() == 0) {
            throw new IllegalArgumentException("illegal appKey");
        }
        return b(str + System.currentTimeMillis(), a(str2).substring(3, 19));
    }

    public static String a(String str) throws Exception {
        if (str == null || str.length() <= 0) {
            return null;
        }
        return a(MessageDigest.getInstance("MD5").digest(str.getBytes("utf-8")));
    }

    private static String b(String str, String str2) throws Exception {
        if (str == null || str.length() <= 0) {
            return null;
        }
        if (str2 == null || str2.length() == 0) {
            throw new IllegalArgumentException("illegal sKey");
        }
        if (str2.length() != 16) {
            throw new IllegalArgumentException("illegal sKey");
        }
        SecretKeySpec secretKeySpec = new SecretKeySpec(str2.getBytes("UTF-8"), "AES");
        Cipher cipher = Cipher.getInstance("AES");
        cipher.init(1, secretKeySpec);
        return a(cipher.doFinal(str.getBytes()));
    }

    private static String a(byte[] bArr) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; bArr != null && i < bArr.length; i++) {
            String hexString = Integer.toHexString(bArr[i] & 255);
            if (hexString.length() == 1) {
                sb.append('0');
            }
            sb.append(hexString);
        }
        return sb.toString().toLowerCase();
    }

    private static void a(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private static void a(Context context, final FutureTask futureTask) {
        if (Build.VERSION.SDK_INT >= 21) {
            e(context);
            final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(FakeServiceHelper.CONNECTIVITY_SERVICE);
            connectivityManager.requestNetwork(new NetworkRequest.Builder().addTransportType(0).addCapability(12).build(), new ConnectivityManager.NetworkCallback() {
                @Override
                public void onAvailable(Network network) {
                    if (Build.VERSION.SDK_INT >= 23) {
                        connectivityManager.bindProcessToNetwork(network);
                    } else {
                        ConnectivityManager.setProcessDefaultNetwork(network);
                    }
                    futureTask.run();
                }
            });
        }
    }

    public static void b(Context context) {
        if (Build.VERSION.SDK_INT >= 21) {
            e(context);
        }
    }

    @RequiresApi(api = 21)
    private static void e(Context context) {
        if (context == null) {
            return;
        }
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(FakeServiceHelper.CONNECTIVITY_SERVICE);
        if (Build.VERSION.SDK_INT >= 23) {
            connectivityManager.bindProcessToNetwork(null);
        } else {
            ConnectivityManager.setProcessDefaultNetwork(null);
        }
    }

    public static boolean c(Context context) {
        try {
            ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(FakeServiceHelper.CONNECTIVITY_SERVICE);
            Method declaredMethod = ConnectivityManager.class.getDeclaredMethod("getMobileDataEnabled", new Class[0]);
            declaredMethod.setAccessible(true);
            return ((Boolean) declaredMethod.invoke(connectivityManager, new Object[0])).booleanValue();
        } catch (Exception e) {
            e.printStackTrace();
            return true;
        }
    }

    private static boolean f(Context context) {
        return "中国移动".equals(bf.g(context));
    }

    public static boolean d(Context context) {
        return f(context) && c(context);
    }
}