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

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


package com.excelliance.kxqp.pay.ali;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Environment;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import com.alipay.sdk.packet.e;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.GameUtilBuild;
import com.excelliance.kxqp.VersionManager;
import com.excelliance.kxqp.gs.ui.share.core.config.SharePlatformConfig;
import com.excelliance.kxqp.gs.util.ab;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.swipe.h;
import com.excelliance.kxqp.util.aj;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Stack;
import java.util.TimeZone;
import org.apache.http.cookie.ClientCookie;

public class b {

    private static char[] f12656a = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();

    private static long f12657b = 0;
    private static boolean c = false;

    public static boolean a(String str, String str2, String str3, String str4) {
        return true;
    }

    public static Map<String, String> a(Context context, String str, String str2) {
        HashMap hashMap = new HashMap();
        try {
            if (!TextUtils.isEmpty(str2)) {
                if (Double.parseDouble(str2) > 0.0d) {
                    String str3 = "开通年会员—双开助手";
                    int i = 0;
                    if (str2.equals("68.00")) {
                        i = 2;
                        str3 = "开通年会员—双开助手";
                    } else if (str2.equals("6.80")) {
                        i = 3;
                        str3 = "开通月会员—双开助手";
                    }
                    hashMap.put(SharePlatformConfig.APP_ID, str);
                    hashMap.put("biz_content", "{\"timeout_express\":\"30m\",\"product_code\":\"QUICK_MSECURITY_PAY\",\"total_amount\":\"" + str2 + "\",\"subject\":\"" + str3 + "\",\"body\":\"开启多开功能可以享受多账号体验\",\"out_trade_no\":\"" + a(context, i) + "\"}");
                    hashMap.put("charset", "utf-8");
                    hashMap.put(e.q, "alipay.trade.app.pay");
                    hashMap.put("sign_type", "RSA");
                    hashMap.put(com.alipay.sdk.tid.b.f, a(System.currentTimeMillis()));
                    hashMap.put(ClientCookie.VERSION_ATTR, "1.0");
                    hashMap.put("notify_url", "http://mto.multiopen.cn/orderinfo.php");
                    return hashMap;
                }
            }
            return hashMap;
        } catch (NumberFormatException unused) {
            return hashMap;
        }
    }

    public static String a(Map<String, String> map) {
        ArrayList arrayList = new ArrayList(map.keySet());
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arrayList.size() - 1; i++) {
            String str = (String) arrayList.get(i);
            sb.append(a(str, map.get(str), true));
            sb.append(com.alipay.sdk.sys.a.f472b);
        }
        String str2 = (String) arrayList.get(arrayList.size() - 1);
        sb.append(a(str2, map.get(str2), true));
        return sb.toString();
    }

    public static String b(Map<String, String> map) {
        ArrayList arrayList = new ArrayList(map.keySet());
        Collections.sort(arrayList);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arrayList.size() - 1; i++) {
            String str = (String) arrayList.get(i);
            sb.append(a(str, map.get(str), false));
            sb.append(com.alipay.sdk.sys.a.f472b);
        }
        String str2 = (String) arrayList.get(arrayList.size() - 1);
        sb.append(a(str2, map.get(str2), false));
        return sb.toString();
    }

    private static String a(String str, String str2, boolean z) {
        StringBuilder sb = new StringBuilder();
        sb.append(str);
        sb.append("=");
        if (z) {
            try {
                sb.append(URLEncoder.encode(str2, "UTF-8"));
            } catch (UnsupportedEncodingException unused) {
                sb.append(str2);
            }
        } else {
            sb.append(str2);
        }
        return sb.toString();
    }

    private static String a(Context context, int i) {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(a(context, "VersionCode"));
        stringBuffer.append("_");
        stringBuffer.append(a(a(context, "MainChId")));
        stringBuffer.append("_");
        stringBuffer.append(a(a(context, "SubChId")));
        stringBuffer.append("_");
        stringBuffer.append(c(context));
        stringBuffer.append("_");
        VersionManager versionManager = VersionManager.getInstance();
        versionManager.a(context);
        stringBuffer.append(a(versionManager.f()));
        stringBuffer.append("_");
        stringBuffer.append(k(context));
        stringBuffer.append("_");
        stringBuffer.append(a(aj.a().a(context)));
        stringBuffer.append("_");
        stringBuffer.append(i);
        stringBuffer.append("_");
        stringBuffer.append(new Random().nextInt());
        String stringBuffer2 = stringBuffer.toString();
        return stringBuffer2.length() > 64 ? stringBuffer2.substring(0, 64) : stringBuffer2;
    }

    public static String a(String str) {
        try {
            Stack stack = new Stack();
            StringBuilder sb = new StringBuilder(0);
            for (Long valueOf = Long.valueOf(str); valueOf.longValue() != 0; valueOf = Long.valueOf(valueOf.longValue() / 62)) {
                stack.add(Character.valueOf(f12656a[new Long(valueOf.longValue() - ((valueOf.longValue() / 62) * 62)).intValue()]));
            }
            while (!stack.isEmpty()) {
                sb.append(stack.pop());
            }
            return sb.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return str;
        }
    }

    public static String a(Context context, String str) {
        try {
            ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
            if (applicationInfo == null) {
                return "";
            }
            if (str.equals("VersionCode")) {
                PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                return packageInfo != null ? String.valueOf(packageInfo.versionCode) : "";
            }
            if (str.equals("MainChId")) {
                return String.valueOf(applicationInfo.metaData.get("MainChId"));
            }
            return str.equals("SubChId") ? String.valueOf(applicationInfo.metaData.get("SubChId")) : "";
        } catch (Exception unused) {
            return "";
        }
    }

    public static String a(long j) {
        try {
            Date date = new Date(j);
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            return simpleDateFormat.format(date);
        } catch (Exception unused) {
            return null;
        }
    }

    public static String a(Context context) {
        String str;
        context.getPackageName();
        if (Environment.getExternalStorageState().equals("mounted")) {
            str = Environment.getExternalStorageDirectory().toString() + "/.android/.system/";
        } else {
            str = as.a(context) + "/";
        }
        return str + ".pay_result";
    }

    public static String b(Context context) {
        String str;
        context.getPackageName();
        if (Environment.getExternalStorageState().equals("mounted")) {
            str = Environment.getExternalStorageDirectory().toString() + "/.android/.system/";
        } else {
            str = as.a(context) + "/";
        }
        return str + ".pay_special_result";
    }

    public static String b(String str) {
        return a(str, "lylid");
    }

    public static String c(String str) {
        return a(str, "lylptpay");
    }

    public static String a(String str, String str2) {
        try {
            byte[] bytes = str2.getBytes("utf-8");
            byte[] bytes2 = str.getBytes("utf-8");
            for (byte b2 : bytes) {
                for (int i = 0; i < bytes2.length; i++) {
                    bytes2[i] = (byte) (bytes2[i] ^ b2);
                }
            }
            return Base64.encodeToString(bytes2, 0);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String b(String str, String str2) {
        return a(str, "lylid", str2);
    }

    public static String c(String str, String str2) {
        return a(str, "lylptpay", str2);
    }

    public static String a(String str, String str2, String str3) {
        return ab.a(str, str2, str3);
    }

    public static String c(Context context) {
        if (context != null) {
            return com.excelliance.kxqp.util.a.b.e(context);
        }
        return null;
    }

    public static String d(Context context) {
        String str;
        try {
            str = com.excelliance.kxqp.util.a.b.c(context);
        } catch (Exception e) {
            e.printStackTrace();
            str = null;
        }
        return (str == null || str.length() == 0) ? c(context) : str;
    }

    public static boolean e(Context context) {
        int i;
        if (h(context) || g(context)) {
            return true;
        }
        if (!h.d(context)) {
            return false;
        }
        String str = as.a(context) + File.separatorChar + ".platformcache" + File.separatorChar + GameUtilBuild.PLATFORM_DIR + File.separatorChar + "pay" + File.separatorChar + "pay.dex";
        try {
            try {
                Class.forName("com.alipay.sdk.app.PayTask", false, context.getApplicationContext().getClassLoader());
            } catch (Exception unused) {
                if (!new File(str).exists()) {
                    i = 1;
                    context.getAssets().open("yap.cfg").close();
                    if (i == 3) {
                        return false;
                    }
                    Log.d("PayUtil", "no pay dex...");
                    SharedPreferences sharedPreferences = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT >= 11 ? 0 : 4);
                    int i2 = sharedPreferences.getInt("server_flag", 1);
                    sharedPreferences.getInt("status", 0);
                    if (i2 <= 0) {
                    }
                }
                i = 0;
                context.getAssets().open("yap.cfg").close();
                if (i == 3) {
                }
            }
        } catch (ClassNotFoundException unused2) {
            context.getAssets().open("pay.jar").close();
            i = 0;
            context.getAssets().open("yap.cfg").close();
            if (i == 3) {
            }
        }
        SharedPreferences sharedPreferences2 = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT >= 11 ? 0 : 4);
        int i22 = sharedPreferences2.getInt("server_flag", 1);
        sharedPreferences2.getInt("status", 0);
        return i22 <= 0;
    }

    public static int f(Context context) {
        GameUtil.getIntance();
        if (8 == GameUtil.c(context)) {
            return !context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4).getBoolean("huawei_free", false) ? 2 : 1;
        }
        return 0;
    }

    public static boolean g(Context context) {
        int i = f(context) > 0 ? 2592000 : 259200;
        SharedPreferences sharedPreferences = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        int i2 = sharedPreferences.getInt("free_time", 0);
        int i3 = sharedPreferences.getInt("free_time_change", 0);
        if (i2 == 0) {
            return false;
        }
        int currentTimeMillis = (int) (System.currentTimeMillis() / 1000);
        Log.d("PayUtil", "current:" + currentTimeMillis + "  free_time_change:" + i3);
        if (i3 < currentTimeMillis) {
            if (Math.abs(currentTimeMillis - i2) < i) {
                return true;
            }
        } else if (Math.abs(i3 - i2) < i) {
            return true;
        }
        return false;
    }

    public static boolean h(Context context) {
        long currentTimeMillis = System.currentTimeMillis();
        if (f12657b == 0 || Math.abs(currentTimeMillis - f12657b) >= 1000) {
            boolean i = i(context);
            c = i;
            f12657b = currentTimeMillis;
            return i;
        }
        return c;
    }

    public static boolean i(Context context) {
        boolean z;
        boolean z2;
        if (p(context) || aj.a().c(context)) {
            return true;
        }
        SharedPreferences sharedPreferences = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        String string = sharedPreferences.getString("aliTrade", null);
        String string2 = sharedPreferences.getString("ourTrade", null);
        String string3 = sharedPreferences.getString(com.alipay.sdk.tid.b.f, null);
        String string4 = sharedPreferences.getString("cid", null);
        if (string4 != null) {
            String c2 = c(d(context));
            if (c2 != null) {
                c2 = c2.trim();
            }
            if (!string4.equals(c2)) {
                String c3 = c(c(context));
                if (c3 != null) {
                    c3 = c3.trim();
                }
                if (!string4.equals(c3)) {
                    Iterator<String> it = l(context).iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            z2 = false;
                            break;
                        }
                        String c4 = c(it.next());
                        if (c4 != null && string4.equals(c4.trim())) {
                            z2 = true;
                            break;
                        }
                    }
                    if (!z2) {
                        return false;
                    }
                }
            }
        }
        File file = new File(a(context));
        if (!TextUtils.isEmpty(string) && !TextUtils.isEmpty(string2) && !TextUtils.isEmpty(string3) && !TextUtils.isEmpty(string4)) {
            if (!file.exists()) {
                a(context, string, string2, string3, string4);
            }
            return true;
        }
        try {
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (!file.exists()) {
            return false;
        }
        String str = "";
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        while (true) {
            String readLine = bufferedReader.readLine();
            if (readLine == null) {
                break;
            }
            str = str + readLine;
        }
        bufferedReader.close();
        if (!TextUtils.isEmpty(str)) {
            String[] split = str.split("\\|\\|");
            if (split.length == 4) {
                String str2 = split[3];
                String d = d(context);
                if (d != null && d.length() > 0) {
                    if (str2 != null && str2.length() != 0) {
                        String c5 = c(d);
                        if (c5 != null) {
                            c5 = c5.trim();
                        }
                        if (!str2.equals(c5)) {
                            String c6 = c(c(context));
                            if (c6 != null) {
                                c6 = c6.trim();
                            }
                            if (!str2.equals(c6)) {
                                Iterator<String> it2 = l(context).iterator();
                                while (true) {
                                    if (!it2.hasNext()) {
                                        z = false;
                                        break;
                                    }
                                    String c7 = c(it2.next());
                                    if (c7 != null && str2.equals(c7.trim())) {
                                        z = true;
                                        break;
                                    }
                                }
                                if (!z) {
                                    return false;
                                }
                            }
                        }
                    }
                    return false;
                }
                sharedPreferences.edit().putString("aliTrade", split[0]).commit();
                sharedPreferences.edit().putString("ourTrade", split[1]).commit();
                sharedPreferences.edit().putString(com.alipay.sdk.tid.b.f, split[2]).commit();
                sharedPreferences.edit().putString("cid", split[3]).commit();
                return true;
            }
        }
        return false;
    }

    public static void j(Context context) {
        File file = new File(a(context));
        try {
            if (file.exists()) {
                file.delete();
            }
            SharedPreferences.Editor edit = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit();
            edit.putString("aliTrade", "").commit();
            edit.putString("ourTrade", "").commit();
            edit.putString(com.alipay.sdk.tid.b.f, "").commit();
            edit.putString("cid", "").commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void a(Context context, String str, String str2, String str3, String str4) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3)) {
            return;
        }
        String str5 = c(str) + "||" + c(str2) + "||" + c(str3) + "||" + str4;
        File file = new File(a(context));
        try {
            if (!file.exists()) {
                file.getParentFile().mkdirs();
            } else {
                file.delete();
            }
            file.createNewFile();
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            bufferedWriter.write(str5.toString());
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String k(Context context) {
        try {
            return com.excelliance.kxqp.util.a.b.c(context);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static List<String> l(Context context) {
        String str;
        q(context);
        ArrayList arrayList = new ArrayList();
        try {
            str = com.excelliance.kxqp.util.a.b.c(context);
        } catch (Exception unused) {
            str = null;
        }
        if (!TextUtils.isEmpty(str)) {
            arrayList.add(str);
        }
        List<String> n = com.excelliance.kxqp.util.a.b.n(context);
        if (n != null && n.size() > 0) {
            for (int i = 0; i < n.size(); i++) {
                String str2 = n.get(i);
                if (!TextUtils.isEmpty(str2)) {
                    a(str2, arrayList);
                }
            }
        }
        return arrayList;
    }

    private static int q(Context context) {
        try {
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
            int parseInt = Integer.parseInt(Class.forName(telephonyManager.getClass().getName()).getMethod("getPhoneCount", new Class[0]).invoke(telephonyManager, new Object[0]).toString());
            if (parseInt > 4) {
                return 4;
            }
            return parseInt;
        } catch (Exception unused) {
            return 2;
        }
    }

    private static List<String> a(String str, List<String> list) {
        if (!TextUtils.isEmpty(str)) {
            boolean z = false;
            Iterator<String> it = list.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                if (str.trim().equals(it.next().trim())) {
                    z = true;
                    break;
                }
            }
            if (z) {
                return list;
            }
            list.add(str);
        }
        return list;
    }

    public static void m(Context context) {
        File file = new File(b(context));
        try {
            if (file.exists()) {
                file.delete();
            }
            context.getSharedPreferences("special", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().clear().apply();
        } catch (Exception e) {
            Log.d("PayUtil", "clearSpecialFile exception");
            e.printStackTrace();
        }
    }

    public static void b(Context context, String str) {
        File file = new File(b(context));
        try {
            if (!file.exists()) {
                file.getParentFile().mkdirs();
            } else {
                file.delete();
            }
            file.createNewFile();
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            bufferedWriter.write(str.toString().trim());
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String n(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        String string = sharedPreferences.getString("sdCardIdentify", null);
        try {
            File file = new File(o(context));
            if (string != null) {
                if (!file.exists()) {
                    c(context, string.trim());
                }
                return b(string.trim(), "utf-8");
            }
            if (!file.exists()) {
                String str = c(context) + System.currentTimeMillis();
                c(context, b(str.trim()));
                return str;
            }
            String str2 = "";
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                str2 = str2 + readLine;
            }
            bufferedReader.close();
            if (TextUtils.isEmpty(str2)) {
                return "";
            }
            sharedPreferences.edit().putString("sdCardIdentify", str2.trim()).commit();
            return b(str2.trim(), "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    public static String o(Context context) {
        String str;
        context.getPackageName();
        if (Environment.getExternalStorageState().equals("mounted")) {
            str = Environment.getExternalStorageDirectory().toString() + "/.android/.systems/";
        } else {
            str = as.a(context) + "/";
        }
        return str + ".idcard";
    }

    public static void c(Context context, String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        File file = new File(o(context));
        try {
            if (!file.exists()) {
                file.getParentFile().mkdirs();
            } else {
                file.delete();
            }
            file.createNewFile();
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            bufferedWriter.write(str.toString());
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static boolean p(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("special", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        String string = sharedPreferences.getString("cid", null);
        if (!TextUtils.isEmpty(string)) {
            if (d(context, string)) {
                return true;
            }
            Log.d("PayUtil", "sp is not multi");
        } else {
            Log.d("PayUtil", "sp is empty");
        }
        File file = new File(b(context));
        if (file.exists()) {
            String str = "";
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    str = str + readLine;
                }
                bufferedReader.close();
                if (!TextUtils.isEmpty(str) && d(context, str.trim())) {
                    sharedPreferences.edit().putString("cid", str.trim()).apply();
                    return true;
                }
            } catch (Exception e) {
                e.printStackTrace();
                Log.d("PayUtil", "检查文件时异常");
            }
        } else {
            Log.d("PayUtil", "本地不存在文件");
        }
        return false;
    }

    private static boolean d(Context context, String str) {
        String d = d(context);
        if (TextUtils.isEmpty(d)) {
            return false;
        }
        if (TextUtils.equals(c(d.trim()), str)) {
            return true;
        }
        String c2 = c(c(context));
        if (c2 != null) {
            c2 = c2.trim();
        }
        if (str.equals(c2)) {
            return true;
        }
        Iterator<String> it = l(context).iterator();
        while (it.hasNext()) {
            String c3 = c(it.next());
            if (c3 != null && str.equals(c3.trim())) {
                return true;
            }
        }
        return false;
    }
}