正在查看: Minits v4.9.3.32 应用的 AbstractC0814a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Minits v4.9.3.32 应用的 AbstractC0814a.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.AbstractC0751f;
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.C0848a;
import m9.C0850c;
import ua.InterfaceC1036l0;
import ua.InterfaceC1038m0;
public abstract class AbstractC0814a {
public static final String[] a = {"", "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[] b = "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 p = ((InterfaceC1038m0) context.getApplicationContext()).p();
if (p == null) {
return;
}
Message obtainMessage = p.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);
p.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 i) {
if (byteArrayOutputStream != null) {
return H(byteArrayOutputStream.toByteArray(), i);
}
throw new IllegalArgumentException("baos == null");
}
public static List H(byte[] bArr, int i) {
if (bArr == null) {
throw new IllegalArgumentException("buffer == null");
}
if (i <= 0) {
throw new IllegalArgumentException("Split size must be greater than 0");
}
int length = bArr.length / i;
ArrayList arrayList = new ArrayList();
int i2 = 0;
int i3 = 0;
while (i2 < length) {
int i4 = i3 + i;
arrayList.add(Arrays.copyOfRange(bArr, i3, i4));
i2++;
i3 = i4;
}
if (i3 < bArr.length - 1) {
byte[] copyOfRange = Arrays.copyOfRange(bArr, i3, bArr.length);
byte[] bArr2 = new byte[i];
System.arraycopy(copyOfRange, 0, bArr2, 0, copyOfRange.length);
arrayList.add(bArr2);
}
return arrayList;
}
public static void I(ByteArrayOutputStream byteArrayOutputStream, int i) {
byteArrayOutputStream.write(i);
}
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 i = 4;
Iterator it = G(byteArrayOutputStream, 4).iterator();
while (it.hasNext()) {
L(str, mifareUltralight, i, (byte[]) it.next());
i++;
}
}
public static void L(String str, MifareUltralight mifareUltralight, int i, byte[] bArr) {
if (TextUtils.isEmpty(str)) {
str = "";
}
if (mifareUltralight == null) {
throw new IllegalArgumentException(str + "(): Tag argument cannot be null");
}
if (i == -1) {
throw new IllegalArgumentException(str + "(): Page index must not be empty");
}
if (i < 0) {
throw new IllegalArgumentException(str + "(): Invalid page index");
}
if (bArr == null) {
throw new IllegalArgumentException(str + "(): Data array for page index " + i + " is empty");
}
if (bArr.length == 4) {
try {
mifareUltralight.writePage(i, bArr);
} catch (IOException e) {
throw AbstractC0751f.e(e);
}
} else {
throw new IllegalArgumentException(str + "(): Data array for page index " + i + " must have a length of 4 bytes");
}
}
public static void M(String str, MifareUltralight mifareUltralight, int i, int i2, byte[] bArr) {
if (TextUtils.isEmpty(str)) {
str = "";
}
if (mifareUltralight == null) {
throw new IllegalArgumentException(str + "(): Tag argument cannot be null");
}
if (i == -1) {
throw new IllegalArgumentException(str + "(): Start page index must not be empty");
}
if (i < 0) {
throw new IllegalArgumentException(str + "(): Invalid start page index");
}
if (i2 < i) {
throw new IllegalArgumentException(str + "(): Invalid end page index");
}
if (bArr == null) {
throw new IllegalArgumentException(str + "(): Data array for page index " + i + " is empty");
}
if (bArr.length < 4) {
throw new IllegalArgumentException(str + "(): Data array for page index " + i + " must have at least a length of 4 bytes");
}
Iterator it = H(bArr, 4).iterator();
while (it.hasNext()) {
try {
mifareUltralight.writePage(i, (byte[]) it.next());
i++;
} catch (IOException e) {
throw AbstractC0751f.e(e);
}
}
}
public static void a(CharSequence charSequence) {
Utils.k("XOneNFC", charSequence);
}
public static boolean b(MifareClassic mifareClassic, int i) {
if (mifareClassic == null) {
throw new IllegalArgumentException("mifareClassic == null");
}
if (i < 0 || i > 15) {
throw new IllegalArgumentException("Invalid sector index " + i + ", cannot authenticate tag");
}
try {
if (mifareClassic.authenticateSectorWithKeyA(i, MifareClassic.KEY_DEFAULT) || mifareClassic.authenticateSectorWithKeyA(i, MifareClassic.KEY_MIFARE_APPLICATION_DIRECTORY)) {
return true;
}
return mifareClassic.authenticateSectorWithKeyA(i, MifareClassic.KEY_NFC_FORUM);
} catch (IOException e) {
throw AbstractC0751f.e(e);
}
}
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, b, null, m(str));
}
public static String e(byte[] bArr) {
return new String(bArr, StandardCharsets.US_ASCII);
}
public static String f(byte[] bArr, int i, int i2) {
return new String(bArr, i, i2, 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[] m = m(str);
byte[] k = k("en");
int length = k.length;
int length2 = m.length;
int i = length + 1;
byte[] bArr = new byte[i + length2];
bArr[0] = (byte) length;
System.arraycopy(k, 0, bArr, 1, length);
System.arraycopy(m, 0, bArr, i, 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 b2;
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 i = 1;
while (true) {
String[] strArr = a;
if (i >= strArr.length) {
b2 = 0;
break;
}
if (uri.startsWith(strArr[i])) {
b2 = (byte) i;
uri = uri.substring(strArr[i].length());
break;
}
i++;
}
byte[] m = m(uri);
byte[] bArr = new byte[m.length + 1];
bArr[0] = b2;
System.arraycopy(m, 0, bArr, 1, m.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 i, int i2) {
return new String(bArr, i, i2, 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 i, int i2) {
return new String(bArr, i, i2, StandardCharsets.UTF_8);
}
public static boolean p(String str) {
int indexOf;
if (TextUtils.isEmpty(str) || (indexOf = str.indexOf(124)) <= 0) {
return false;
}
int i = indexOf + 1;
int indexOf2 = str.indexOf(124, i);
if (indexOf2 < indexOf) {
indexOf2 = str.length();
}
String substring = str.substring(i, 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(InterfaceC1036l0 interfaceC1036l0, Tag tag, String str, Throwable th) {
E(interfaceC1036l0.getApplicationContext(), tag, str, "writeerror", Utils.M2(th), new ArrayList());
}
public static void w(InterfaceC1036l0 interfaceC1036l0, Tag tag, String str) {
E(interfaceC1036l0.getApplicationContext(), tag, str, "writeerror", "", new ArrayList());
}
public static String x(MifareClassic mifareClassic, int i, int[] iArr, boolean z, C0848a c0848a) {
try {
if (!(c0848a != null ? c0848a.a(mifareClassic, i) : b(mifareClassic, i))) {
throw new SecurityException("No valid keys found for Mifare Classic tag sector " + i);
}
int sectorToBlock = mifareClassic.sectorToBlock(i);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
for (int i2 : iArr) {
if (!mifareClassic.isConnected()) {
throw new IllegalStateException("NFC disconnected");
}
byteArrayOutputStream.write(mifareClassic.readBlock(i2 + sectorToBlock));
}
String h = z ? h(byteArrayOutputStream.toByteArray()) : byteArrayOutputStream.toString().trim();
Utils.N(byteArrayOutputStream);
return h;
} catch (Throwable th) {
Utils.N(byteArrayOutputStream);
throw th;
}
} catch (IOException e) {
throw AbstractC0751f.e(e);
}
}
public static NdefMessage y(MifareUltralight mifareUltralight, C0850c c0850c) {
try {
int j = c0850c.j();
int b2 = c0850c.b();
byte[] readPages = mifareUltralight.readPages(j);
if (readPages[0] != 3) {
return null;
}
int i = readPages[1];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byteArrayOutputStream.write(readPages);
int i2 = 4;
for (int i3 = j + 4; i3 < b2; i3 += 4) {
byteArrayOutputStream.write(mifareUltralight.readPages(i3));
i2 += 4;
if (i2 > i) {
break;
}
}
byte[] bArr = new byte[i];
System.arraycopy(byteArrayOutputStream.toByteArray(), 2, bArr, 0, i);
return new NdefMessage(bArr);
} catch (FormatException | IOException e) {
throw AbstractC0751f.e(e);
}
}
public static List z(MifareUltralight mifareUltralight, C0850c c0850c) {
return A(y(mifareUltralight, c0850c));
}
}