正在查看: Minits v4.9.3.32 应用的 AbstractC3457a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Minits v4.9.3.32 应用的 AbstractC3457a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package k9;
import android.content.Context;
import android.net.Uri;
import android.nfc.FormatException;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.Tag;
import android.nfc.tech.IsoDep;
import android.nfc.tech.MifareClassic;
import android.nfc.tech.MifareUltralight;
import android.nfc.tech.Ndef;
import android.nfc.tech.NdefFormatable;
import android.nfc.tech.NfcA;
import android.nfc.tech.NfcB;
import android.nfc.tech.NfcBarcode;
import android.nfc.tech.NfcF;
import android.nfc.tech.NfcV;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import com.xone.android.nfc.runtimeobjects.XoneNFCRuntime;
import com.xone.android.utils.Utils;
import fb.t;
import ha.AbstractC3084f;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import m9.C3642a;
import m9.C3644c;
import ua.InterfaceC4483l0;
import ua.InterfaceC4485m0;
public abstract class AbstractC3457a {
public static final String[] f32607a = {"", "http://www.", "https://www.", "http://", "https://", "tel:", "mailto:", "ftp://anonymous:anonymous@", "ftp://ftp.", "ftps://", "sftp://", "smb://", "nfs://", "ftp://", "dav://", "news:", "telnet://", "imap:", "rtsp://", "urn:", "pop:", "sip:", "sips:", "tftp:", "btspp://", "btl2cap://", "btgoep://", "tcpobex://", "irdaobex://", "file://", "urn:epc:id:", "urn:epc:tag:", "urn:epc:pat:", "urn:epc:raw:", "urn:epc:", "urn:nfc:"};
public static final byte[] f32608b = "android.com:pkg".getBytes();
public static List A(NdefMessage ndefMessage) {
if (ndefMessage == null) {
return g();
}
NdefRecord[] records = ndefMessage.getRecords();
if (records == null || records.length == 0) {
return g();
}
if (records[0].getTnf() == 0) {
return g();
}
ArrayList arrayList = new ArrayList();
for (NdefRecord ndefRecord : records) {
if (ndefRecord.getTnf() == 1) {
arrayList.add(D(ndefRecord));
}
}
return !arrayList.isEmpty() ? arrayList : g();
}
public static List B(Ndef ndef) {
return A(ndef.getCachedNdefMessage());
}
public static List C(NdefFormatable ndefFormatable) {
ArrayList arrayList = new ArrayList();
Tag tag = ndefFormatable.getTag();
if (tag != null) {
arrayList.add(h(tag.getId()));
}
return arrayList;
}
public static String D(NdefRecord ndefRecord) {
byte[] payload = ndefRecord.getPayload();
return new String(payload, (payload[0] & 51) + 1, (payload.length - r0) - 1, (payload[0] & 128) == 0 ? t.T() : t.R());
}
public static void E(Context context, Tag tag, String str, String str2, String str3, List list) {
Handler p10 = ((InterfaceC4485m0) context.getApplicationContext()).p();
if (p10 == null) {
return;
}
Message obtainMessage = p10.obtainMessage();
obtainMessage.what = 2022;
Bundle bundle = new Bundle();
bundle.putString("nodename", str);
String[] strArr = {str2, XoneNFCRuntime.TAG_ID_FIELD, "data"};
if (!(list instanceof ArrayList)) {
list = new ArrayList(list);
}
bundle.putStringArrayList("data", (ArrayList) list);
bundle.putStringArray("params", strArr);
bundle.putString(str2, str3);
bundle.putString(XoneNFCRuntime.TAG_ID_FIELD, h(tag.getId()));
obtainMessage.setData(bundle);
p10.sendMessage(obtainMessage);
}
public static String F(String str) {
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Empty technology argument");
}
str.getClass();
switch (str) {
case "mifare_classic":
return MifareClassic.class.getName();
case "ndef":
return Ndef.class.getName();
case "nfc_a":
return NfcA.class.getName();
case "nfc_b":
return NfcB.class.getName();
case "nfc_f":
return NfcF.class.getName();
case "nfc_v":
return NfcV.class.getName();
case "nfc_barcode":
return NfcBarcode.class.getName();
case "mifare_ultralight":
return MifareUltralight.class.getName();
case "ndef_formatable":
return NdefFormatable.class.getName();
case "iso_dep":
return IsoDep.class.getName();
default:
throw new IllegalArgumentException("Unknown NFC tag technology " + str);
}
}
public static List G(ByteArrayOutputStream byteArrayOutputStream, int i10) {
if (byteArrayOutputStream != null) {
return H(byteArrayOutputStream.toByteArray(), i10);
}
throw new IllegalArgumentException("baos == null");
}
public static List H(byte[] bArr, int i10) {
if (bArr == null) {
throw new IllegalArgumentException("buffer == null");
}
if (i10 <= 0) {
throw new IllegalArgumentException("Split size must be greater than 0");
}
int length = bArr.length / i10;
ArrayList arrayList = new ArrayList();
int i11 = 0;
int i12 = 0;
while (i11 < length) {
int i13 = i12 + i10;
arrayList.add(Arrays.copyOfRange(bArr, i12, i13));
i11++;
i12 = i13;
}
if (i12 < bArr.length - 1) {
byte[] copyOfRange = Arrays.copyOfRange(bArr, i12, bArr.length);
byte[] bArr2 = new byte[i10];
System.arraycopy(copyOfRange, 0, bArr2, 0, copyOfRange.length);
arrayList.add(bArr2);
}
return arrayList;
}
public static void I(ByteArrayOutputStream byteArrayOutputStream, int i10) {
byteArrayOutputStream.write(i10);
}
public static void J(ByteArrayOutputStream byteArrayOutputStream, byte[] bArr) {
byteArrayOutputStream.write(bArr, 0, bArr.length);
}
public static void K(String str, MifareUltralight mifareUltralight, NdefMessage ndefMessage) {
byte[] byteArray = ndefMessage.toByteArray();
int length = byteArray.length;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
I(byteArrayOutputStream, 3);
I(byteArrayOutputStream, (byte) length);
J(byteArrayOutputStream, byteArray);
I(byteArrayOutputStream, -2);
int i10 = 4;
Iterator it = G(byteArrayOutputStream, 4).iterator();
while (it.hasNext()) {
L(str, mifareUltralight, i10, (byte[]) it.next());
i10++;
}
}
public static void L(String str, MifareUltralight mifareUltralight, int i10, byte[] bArr) {
if (TextUtils.isEmpty(str)) {
str = "";
}
if (mifareUltralight == null) {
throw new IllegalArgumentException(str + "(): Tag argument cannot be null");
}
if (i10 == -1) {
throw new IllegalArgumentException(str + "(): Page index must not be empty");
}
if (i10 < 0) {
throw new IllegalArgumentException(str + "(): Invalid page index");
}
if (bArr == null) {
throw new IllegalArgumentException(str + "(): Data array for page index " + i10 + " is empty");
}
if (bArr.length == 4) {
try {
mifareUltralight.writePage(i10, bArr);
} catch (IOException e10) {
throw AbstractC3084f.e(e10);
}
} else {
throw new IllegalArgumentException(str + "(): Data array for page index " + i10 + " must have a length of 4 bytes");
}
}
public static void M(String str, MifareUltralight mifareUltralight, int i10, int i11, byte[] bArr) {
if (TextUtils.isEmpty(str)) {
str = "";
}
if (mifareUltralight == null) {
throw new IllegalArgumentException(str + "(): Tag argument cannot be null");
}
if (i10 == -1) {
throw new IllegalArgumentException(str + "(): Start page index must not be empty");
}
if (i10 < 0) {
throw new IllegalArgumentException(str + "(): Invalid start page index");
}
if (i11 < i10) {
throw new IllegalArgumentException(str + "(): Invalid end page index");
}
if (bArr == null) {
throw new IllegalArgumentException(str + "(): Data array for page index " + i10 + " is empty");
}
if (bArr.length < 4) {
throw new IllegalArgumentException(str + "(): Data array for page index " + i10 + " must have at least a length of 4 bytes");
}
Iterator it = H(bArr, 4).iterator();
while (it.hasNext()) {
try {
mifareUltralight.writePage(i10, (byte[]) it.next());
i10++;
} catch (IOException e10) {
throw AbstractC3084f.e(e10);
}
}
}
public static void a(CharSequence charSequence) {
Utils.k("XOneNFC", charSequence);
}
public static boolean b(MifareClassic mifareClassic, int i10) {
if (mifareClassic == null) {
throw new IllegalArgumentException("mifareClassic == null");
}
if (i10 < 0 || i10 > 15) {
throw new IllegalArgumentException("Invalid sector index " + i10 + ", cannot authenticate tag");
}
try {
if (mifareClassic.authenticateSectorWithKeyA(i10, MifareClassic.KEY_DEFAULT) || mifareClassic.authenticateSectorWithKeyA(i10, MifareClassic.KEY_MIFARE_APPLICATION_DIRECTORY)) {
return true;
}
return mifareClassic.authenticateSectorWithKeyA(i10, MifareClassic.KEY_NFC_FORUM);
} catch (IOException e10) {
throw AbstractC3084f.e(e10);
}
}
public static String c(Tag tag) {
String[] techList = tag.getTechList();
StringBuilder sb2 = new StringBuilder();
for (String str : techList) {
sb2.append(str);
}
return sb2.toString();
}
public static NdefRecord d(String str) {
return new NdefRecord((short) 4, f32608b, null, m(str));
}
public static String e(byte[] bArr) {
return new String(bArr, StandardCharsets.US_ASCII);
}
public static String f(byte[] bArr, int i10, int i11) {
return new String(bArr, i10, i11, StandardCharsets.US_ASCII);
}
public static ArrayList g() {
ArrayList arrayList = new ArrayList();
arrayList.add("##EMPTY_TAG##");
return arrayList;
}
public static String h(byte[] bArr) {
return t.M(bArr);
}
public static NdefMessage i(String str) {
byte[] m10 = m(str);
byte[] k10 = k("en");
int length = k10.length;
int length2 = m10.length;
int i10 = length + 1;
byte[] bArr = new byte[i10 + length2];
bArr[0] = (byte) length;
System.arraycopy(k10, 0, bArr, 1, length);
System.arraycopy(m10, 0, bArr, i10, length2);
return new NdefMessage(new NdefRecord[]{new NdefRecord((short) 1, NdefRecord.RTD_TEXT, new byte[0], bArr)});
}
public static NdefMessage j(String str, String str2) {
byte b10;
ArrayList arrayList = new ArrayList();
if (!TextUtils.isEmpty(str)) {
arrayList.add(d(str));
}
Uri parse = Uri.parse(str2);
if (parse == null) {
throw new NullPointerException("uri is null");
}
String uri = s(parse).toString();
if (TextUtils.isEmpty(uri)) {
throw new IllegalArgumentException("uri is empty");
}
int i10 = 1;
while (true) {
String[] strArr = f32607a;
if (i10 >= strArr.length) {
b10 = 0;
break;
}
if (uri.startsWith(strArr[i10])) {
b10 = (byte) i10;
uri = uri.substring(strArr[i10].length());
break;
}
i10++;
}
byte[] m10 = m(uri);
byte[] bArr = new byte[m10.length + 1];
bArr[0] = b10;
System.arraycopy(m10, 0, bArr, 1, m10.length);
arrayList.add(new NdefRecord((short) 1, NdefRecord.RTD_URI, null, bArr));
return new NdefMessage((NdefRecord[]) arrayList.toArray(new NdefRecord[0]));
}
public static byte[] k(String str) {
return TextUtils.isEmpty(str) ? new byte[0] : str.getBytes(StandardCharsets.US_ASCII);
}
public static String l(byte[] bArr, int i10, int i11) {
return new String(bArr, i10, i11, StandardCharsets.UTF_16);
}
public static byte[] m(String str) {
return TextUtils.isEmpty(str) ? new byte[0] : str.getBytes(StandardCharsets.UTF_8);
}
public static String n(byte[] bArr) {
return new String(bArr, StandardCharsets.UTF_8);
}
public static String o(byte[] bArr, int i10, int i11) {
return new String(bArr, i10, i11, StandardCharsets.UTF_8);
}
public static boolean p(String str) {
int indexOf;
if (TextUtils.isEmpty(str) || (indexOf = str.indexOf(124)) <= 0) {
return false;
}
int i10 = indexOf + 1;
int indexOf2 = str.indexOf(124, i10);
if (indexOf2 < indexOf) {
indexOf2 = str.length();
}
String substring = str.substring(i10, indexOf2);
if (TextUtils.isEmpty(substring)) {
return false;
}
return substring.toLowerCase().equals("hex");
}
public static boolean q(Tag tag, Class cls) {
return r(tag, cls.getName());
}
public static boolean r(Tag tag, String str) {
for (String str2 : tag.getTechList()) {
if (str2.equals(str)) {
return true;
}
}
return false;
}
public static Uri s(Uri uri) {
String scheme = uri.getScheme();
if (scheme != null) {
String lowerCase = scheme.toLowerCase(Locale.ROOT);
if (!scheme.equals(lowerCase)) {
return uri.buildUpon().scheme(lowerCase).build();
}
}
return uri;
}
public static void t(Context context, Tag tag, String str, Throwable th) {
E(context, tag, str, "readerror", Utils.M2(th), new ArrayList());
}
public static void u(Context context, Tag tag, String str, List list) {
E(context, tag, str, "readerror", "", list);
}
public static void v(InterfaceC4483l0 interfaceC4483l0, Tag tag, String str, Throwable th) {
E(interfaceC4483l0.getApplicationContext(), tag, str, "writeerror", Utils.M2(th), new ArrayList());
}
public static void w(InterfaceC4483l0 interfaceC4483l0, Tag tag, String str) {
E(interfaceC4483l0.getApplicationContext(), tag, str, "writeerror", "", new ArrayList());
}
public static String x(MifareClassic mifareClassic, int i10, int[] iArr, boolean z10, C3642a c3642a) {
try {
if (!(c3642a != null ? c3642a.a(mifareClassic, i10) : b(mifareClassic, i10))) {
throw new SecurityException("No valid keys found for Mifare Classic tag sector " + i10);
}
int sectorToBlock = mifareClassic.sectorToBlock(i10);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
for (int i11 : iArr) {
if (!mifareClassic.isConnected()) {
throw new IllegalStateException("NFC disconnected");
}
byteArrayOutputStream.write(mifareClassic.readBlock(i11 + sectorToBlock));
}
String h10 = z10 ? h(byteArrayOutputStream.toByteArray()) : byteArrayOutputStream.toString().trim();
Utils.N(byteArrayOutputStream);
return h10;
} catch (Throwable th) {
Utils.N(byteArrayOutputStream);
throw th;
}
} catch (IOException e10) {
throw AbstractC3084f.e(e10);
}
}
public static NdefMessage y(MifareUltralight mifareUltralight, C3644c c3644c) {
try {
int j10 = c3644c.j();
int b10 = c3644c.b();
byte[] readPages = mifareUltralight.readPages(j10);
if (readPages[0] != 3) {
return null;
}
int i10 = readPages[1];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byteArrayOutputStream.write(readPages);
int i11 = 4;
for (int i12 = j10 + 4; i12 < b10; i12 += 4) {
byteArrayOutputStream.write(mifareUltralight.readPages(i12));
i11 += 4;
if (i11 > i10) {
break;
}
}
byte[] bArr = new byte[i10];
System.arraycopy(byteArrayOutputStream.toByteArray(), 2, bArr, 0, i10);
return new NdefMessage(bArr);
} catch (FormatException | IOException e10) {
throw AbstractC3084f.e(e10);
}
}
public static List z(MifareUltralight mifareUltralight, C3644c c3644c) {
return A(y(mifareUltralight, c3644c));
}
}