正在查看: XT工具箱 v3.6.15 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: XT工具箱 v3.6.15 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package a.a.a.b;
import a.a.f.a.k;
import a.a.g.a.a.d.d;
import a.a.g.a.a.e.b;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import androidx.core.content.FileProvider;
import com.androlua.LuaApplication;
import com.androlua.LuaUtil;
import com.bumptech.glide.load.Key;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import net.fusionapp.core.MyFileProvider;
public final class a {
public static String f84a;
public static void A(boolean z) {
if (!z) {
throw new IllegalArgumentException();
}
}
public static int B(Context context, double d2) {
return (int) ((d2 * context.getResources().getDisplayMetrics().density) + 0.5d);
}
public static String C(String str) {
String[] split = str.split("=");
if (split.length <= 1) {
return null;
}
String str2 = split[1];
return str2.contains("\"") ? str2.replaceAll("\"", "") : str2;
}
public static String D(String str) {
try {
if (o(str)) {
return null;
}
MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
messageDigest.update(str.getBytes(Key.STRING_CHARSET_NAME));
byte[] digest = messageDigest.digest();
StringBuilder sb = new StringBuilder();
for (byte b2 : digest) {
sb.append(String.format("%02x", Byte.valueOf(b2)));
}
return sb.toString();
} catch (Exception unused) {
return null;
}
}
public static int E(float f, int i, int i2) {
return ((((i >> 24) & 255) + ((int) ((((i2 >> 24) & 255) - r0) * f))) << 24) | ((((i >> 16) & 255) + ((int) ((((i2 >> 16) & 255) - r1) * f))) << 16) | ((((i >> 8) & 255) + ((int) ((((i2 >> 8) & 255) - r2) * f))) << 8) | ((i & 255) + ((int) (f * ((i2 & 255) - r7))));
}
public static String F(String str) {
try {
byte[] array = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putInt(str.length()).array();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(str.length());
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
gZIPOutputStream.write(str.getBytes(Key.STRING_CHARSET_NAME));
gZIPOutputStream.close();
byteArrayOutputStream.close();
byte[] bArr = new byte[byteArrayOutputStream.toByteArray().length + 4];
System.arraycopy(array, 0, bArr, 0, 4);
System.arraycopy(byteArrayOutputStream.toByteArray(), 0, bArr, 4, byteArrayOutputStream.toByteArray().length);
return Base64.encodeToString(bArr, 8);
} catch (Exception unused) {
return "";
}
}
public static c.b.a.a.d.a.d.a G(List<c.b.a.a.d.a.d.a> list, int i) {
int size;
if (i >= 0 && i <= list.size() - 1) {
return list.get(i);
}
c.b.a.a.d.a.d.a aVar = new c.b.a.a.d.a.d.a();
if (i < 0) {
size = 0;
} else {
i = (i - list.size()) + 1;
size = list.size() - 1;
}
c.b.a.a.d.a.d.a aVar2 = list.get(size);
aVar.f836a = (aVar2.b() * i) + aVar2.f836a;
aVar.f837b = aVar2.f837b;
aVar.f838c = (aVar2.b() * i) + aVar2.f838c;
aVar.f839d = aVar2.f839d;
aVar.e = (aVar2.b() * i) + aVar2.e;
aVar.f = aVar2.f;
aVar.g = (aVar2.b() * i) + aVar2.g;
aVar.h = aVar2.h;
return aVar;
}
public static String H(Context context, String str) {
try {
InputStream open = context.getAssets().open(str);
byte[] bArr = new byte[open.available()];
open.read(bArr);
return new String(bArr, StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static boolean I(Bitmap bitmap, OutputStream outputStream) {
if (bitmap == null) {
return false;
}
try {
try {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
outputStream.flush();
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
return true;
} catch (Exception e2) {
e2.printStackTrace();
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
return false;
}
} catch (Throwable th) {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e4) {
e4.printStackTrace();
}
}
throw th;
}
}
public static void J(String str, String str2) {
int length = str.length() + 1;
ZipFile zipFile = new ZipFile(LuaApplication.getInstance().getApplicationInfo().publicSourceDir);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry nextElement = entries.nextElement();
String name = nextElement.getName();
if (name.indexOf(str) == 0) {
String substring = name.substring(length);
if (nextElement.isDirectory()) {
File file = new File(a.b.a.a.a.m(a.b.a.a.a.o(str2), File.separator, substring));
if (!file.exists()) {
file.mkdirs();
}
} else {
String m = a.b.a.a.a.m(a.b.a.a.a.o(str2), File.separator, substring);
File file2 = new File(m);
File parentFile = new File(m).getParentFile();
if (!parentFile.exists() && !parentFile.mkdirs()) {
StringBuilder o = a.b.a.a.a.o("create file ");
o.append(parentFile.getName());
o.append(" fail");
throw new RuntimeException(o.toString());
}
try {
if (file2.exists() && nextElement.getSize() == file2.length() && LuaUtil.getFileMD5(zipFile.getInputStream(nextElement)).equals(LuaUtil.getFileMD5(file2))) {
}
} catch (NullPointerException unused) {
}
FileOutputStream fileOutputStream = new FileOutputStream(a.b.a.a.a.m(a.b.a.a.a.o(str2), File.separator, substring));
InputStream inputStream = zipFile.getInputStream(nextElement);
byte[] bArr = new byte[4096];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
break;
} else {
fileOutputStream.write(bArr, 0, read);
}
}
fileOutputStream.close();
inputStream.close();
}
}
}
zipFile.close();
}
public static a.a.g.a.a.e.e.a a(Context context, String str) {
b bVar;
if (context == null) {
return null;
}
if (a.a.g.a.a.e.e.b.f298a == null) {
synchronized (b.class) {
if (b.f287d == null) {
b.f287d = new b(context, str);
}
bVar = b.f287d;
}
a.a.g.a.a.e.e.b.f299b = bVar;
a.a.g.a.a.e.e.b.f298a = new a.a.g.a.a.e.e.b();
}
return a.a.g.a.a.e.e.b.f298a;
}
public static Class<?> b(Type type) {
while (!(type instanceof Class)) {
if (!(type instanceof ParameterizedType)) {
throw new IllegalArgumentException("TODO");
}
type = ((ParameterizedType) type).getRawType();
}
return (Class) type;
}
public static String c() {
k a2 = k.a(6001);
return d(a2.f198a, a2.f199b, "");
}
public static String d(int i, String str, String str2) {
StringBuilder sb = new StringBuilder();
sb.append("resultStatus={");
sb.append(i);
sb.append("};memo={");
sb.append(str);
sb.append("};result={");
return a.b.a.a.a.m(sb, str2, "}");
}
public static String e(Context context) {
if (context == null) {
return "https://mobilegw.alipay.com/mgw.htm";
}
TextUtils.isEmpty("https://mobilegw.alipay.com/mgw.htm");
return "https://mobilegw.alipay.com/mgw.htm";
}
public static String f(String str, String str2) {
File file;
StringBuilder sb = new StringBuilder();
BufferedReader bufferedReader = null;
try {
try {
file = new File(str, str2);
} catch (Throwable unused) {
}
} catch (IOException unused2) {
} catch (Throwable th) {
th = th;
}
if (!file.exists()) {
return null;
}
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(new FileInputStream(file), Key.STRING_CHARSET_NAME));
while (true) {
try {
String readLine = bufferedReader2.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
} catch (IOException unused3) {
bufferedReader = bufferedReader2;
if (bufferedReader != null) {
bufferedReader.close();
}
return sb.toString();
} catch (Throwable th2) {
th = th2;
bufferedReader = bufferedReader2;
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Throwable unused4) {
}
}
throw th;
}
}
bufferedReader2.close();
return sb.toString();
}
public static String g(Map<String, String> map, String str, String str2) {
String str3;
return (map == null || (str3 = map.get(str)) == null) ? str2 : str3;
}
public static java.util.Map<java.lang.String, java.lang.String> h(android.content.Context r34) {
throw new UnsupportedOperationException("Method not decompiled: a.a.a.b.a.h(android.content.Context):java.util.Map");
}
public static synchronized void i(Context context, String str, String str2, String str3) {
String str4;
synchronized (a.class) {
try {
str4 = context.getPackageName();
} catch (Throwable unused) {
str4 = "";
}
a.a.g.a.a.d.a aVar = new a.a.g.a.a.d.a(Build.MODEL, str4, "APPSecuritySDK-ALIPAY", "3.2.2-20180331", str, str2, str3);
String str5 = context.getFilesDir().getAbsolutePath() + "/log/ap";
String str6 = new SimpleDateFormat("yyyyMMdd").format(Calendar.getInstance().getTime()) + ".log";
String aVar2 = aVar.toString();
synchronized (d.class) {
d.f284a = str5;
d.f285b = str6;
d.f286c = aVar2;
}
}
}
public static void j(Context context, String str, Map<String, String> map) {
SharedPreferences.Editor edit = context.getSharedPreferences(str, 0).edit();
if (edit != null) {
for (String str2 : map.keySet()) {
edit.putString(str2, map.get(str2));
}
edit.commit();
}
}
public static synchronized void k(String str) {
synchronized (a.class) {
synchronized (d.class) {
ArrayList arrayList = new ArrayList();
arrayList.add(str);
d.b(arrayList);
}
}
}
public static synchronized void l(Throwable th) {
synchronized (a.class) {
d.a(th);
}
}
public static boolean m() {
String externalStorageState = Environment.getExternalStorageState();
if (externalStorageState == null || externalStorageState.length() <= 0) {
return false;
}
return (externalStorageState.equals("mounted") || externalStorageState.equals("mounted_ro")) && Environment.getExternalStorageDirectory() != null;
}
public static boolean n(Class<?> cls) {
return cls.isPrimitive() || cls.equals(String.class) || cls.equals(Integer.class) || cls.equals(Long.class) || cls.equals(Double.class) || cls.equals(Float.class) || cls.equals(Boolean.class) || cls.equals(Short.class) || cls.equals(Character.class) || cls.equals(Byte.class) || cls.equals(Void.class);
}
public static boolean o(String str) {
int length;
if (str != null && (length = str.length()) != 0) {
for (int i = 0; i < length; i++) {
if (!Character.isWhitespace(str.charAt(i))) {
return false;
}
}
}
return true;
}
public static boolean p(String str, String str2) {
return str == null ? str2 == null : str.equals(str2);
}
public static boolean q(List<String> list) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
simpleDateFormat.setLenient(false);
int random = ((int) (Math.random() * 24.0d * 60.0d * 60.0d)) * 1;
try {
Iterator<String> it2 = list.iterator();
while (it2.hasNext()) {
String[] split = it2.next().split("&");
if (split != null && split.length == 2) {
Date date = new Date();
Date parse = simpleDateFormat.parse(split[0] + " 00:00:00");
Date parse2 = simpleDateFormat.parse(split[1] + " 23:59:59");
Calendar calendar = Calendar.getInstance();
calendar.setTime(parse2);
calendar.add(13, random);
Date time = calendar.getTime();
if (date.after(parse) && date.before(time)) {
return true;
}
}
}
} catch (Exception unused) {
}
return false;
}
public static byte[] r(byte[] r6) {
throw new UnsupportedOperationException("Method not decompiled: a.a.a.b.a.r(byte[]):byte[]");
}
public static String s(int i, String str, String str2) {
try {
SecretKeySpec secretKeySpec = new SecretKeySpec(str2.getBytes(), "DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(i, secretKeySpec);
byte[] doFinal = cipher.doFinal(i == 2 ? a.a.f.d.a.b(str) : str.getBytes(Key.STRING_CHARSET_NAME));
return i == 2 ? new String(doFinal) : a.a.f.d.a.a(doFinal);
} catch (Exception unused) {
return null;
}
}
public static String t(String str) {
try {
if (o(str)) {
return null;
}
MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
messageDigest.update(str.getBytes(Key.STRING_CHARSET_NAME));
byte[] digest = messageDigest.digest();
StringBuilder sb = new StringBuilder();
for (byte b2 : digest) {
sb.append(String.format("%02x", Byte.valueOf(b2)));
}
return sb.toString();
} catch (Exception unused) {
return null;
}
}
public static String u(String str) {
try {
System.clearProperty(str);
} catch (Throwable unused) {
}
if (!o("")) {
return "";
}
String m = a.b.a.a.a.m(new StringBuilder(".SystemConfig"), File.separator, str);
try {
if (m()) {
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), m);
if (file.exists()) {
file.delete();
return "";
}
}
} catch (Exception unused2) {
}
return null;
}
public static boolean v(String str) {
return !o(str);
}
public static byte[] w(byte[] bArr) {
ByteArrayInputStream byteArrayInputStream;
ByteArrayOutputStream byteArrayOutputStream;
Throwable th;
GZIPInputStream gZIPInputStream;
try {
byteArrayInputStream = new ByteArrayInputStream(bArr);
try {
gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
try {
byte[] bArr2 = new byte[4096];
byteArrayOutputStream = new ByteArrayOutputStream();
while (true) {
try {
int read = gZIPInputStream.read(bArr2, 0, 4096);
if (read == -1) {
break;
}
byteArrayOutputStream.write(bArr2, 0, read);
} catch (Throwable th2) {
th = th2;
try {
byteArrayOutputStream.close();
} catch (Exception unused) {
}
try {
gZIPInputStream.close();
} catch (Exception unused2) {
}
try {
byteArrayInputStream.close();
throw th;
} catch (Exception unused3) {
throw th;
}
}
}
byteArrayOutputStream.flush();
byte[] byteArray = byteArrayOutputStream.toByteArray();
try {
byteArrayOutputStream.close();
} catch (Exception unused4) {
}
try {
gZIPInputStream.close();
} catch (Exception unused5) {
}
try {
byteArrayInputStream.close();
} catch (Exception unused6) {
}
return byteArray;
} catch (Throwable th3) {
byteArrayOutputStream = null;
th = th3;
}
} catch (Throwable th4) {
th = th4;
byteArrayOutputStream = null;
th = th;
gZIPInputStream = byteArrayOutputStream;
byteArrayOutputStream.close();
gZIPInputStream.close();
byteArrayInputStream.close();
throw th;
}
} catch (Throwable th5) {
th = th5;
byteArrayInputStream = null;
byteArrayOutputStream = null;
}
}
@Deprecated
public static Intent x(Activity activity, File file) {
Intent intent = new Intent();
intent.setAction("android.intent.action.SEND");
intent.setType("image/*");
intent.setFlags(268435456);
intent.addFlags(3);
intent.putExtra("android.intent.extra.STREAM", FileProvider.getUriForFile(activity, MyFileProvider.getAuthor(activity), file));
return Intent.createChooser(intent, "Share to..");
}
public static boolean y(String str) {
for (byte b2 : str.getBytes()) {
if ((b2 >= 0 && b2 <= 31) || b2 >= Byte.MAX_VALUE) {
return false;
}
}
return true;
}
public static double z(int i, int i2) {
double doubleValue = new BigDecimal(Double.toString(Double.parseDouble(String.valueOf(i2)))).divide(new BigDecimal(Double.toString(100.0d)), 2, 4).doubleValue();
double d2 = i * doubleValue;
Log.d("fa2", "source:" + i);
Log.d("fa2", "percent:" + i2);
Log.d("fa2", "result:" + d2);
Log.d("fa2", "percentDecimal:" + doubleValue);
return d2;
}
}