Compare commits

..

No commits in common. '7089b8eb5d36ee89c56fb0bf478a53f9295c0676' and '36a1ec350daf2e1b7b8c095dab45307497a4d455' have entirely different histories.

@ -11,8 +11,8 @@ android {
applicationId "moe.tqlwsl.aicemu" applicationId "moe.tqlwsl.aicemu"
minSdk 24 minSdk 24
targetSdk 33 targetSdk 33
versionCode 4 versionCode 2
versionName "1.0-Beta3" versionName "1.0-Beta"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

@ -20,6 +20,7 @@ public class xp implements IXposedHookLoadPackage {
ClassLoader mclassloader = null; ClassLoader mclassloader = null;
Context mcontext = null; Context mcontext = null;
// from https://github.com/OLIET2357/HCEFUnlocker
@Override @Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
@ -27,26 +28,72 @@ public class xp implements IXposedHookLoadPackage {
if (lpparam.packageName.equals("com.android.nfc")) { if (lpparam.packageName.equals("com.android.nfc")) {
// XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", lpparam.classLoader,
// "isValidSystemCode", String.class, new XC_MethodReplacement() {
// @Override
// protected Object replaceHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
// String systemCode = (String) param.args[0];
// if (systemCode == null) {
// return false;
// }
//
// if (systemCode.length() != 4) {
// Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
// return false;
// }
// // check if the value is between "4000" and "4FFF" (excluding "4*FF")
// if (!systemCode.startsWith("4") || systemCode.toUpperCase().endsWith("FF")) {
// // Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
// // return false;
// }
// try {
// Integer.parseInt(systemCode, 16);
// } catch (NumberFormatException e) {
// Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
// return false;
// }
// return true;
// }
// });
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", lpparam.classLoader, XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", lpparam.classLoader,
"isValidNfcid2", String.class, new XC_MethodReplacement() { "isValidNfcid2", String.class, new XC_MethodReplacement() {
@Override @Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
String nfcid2 = (String) param.args[0];
if (nfcid2 == null) {
return false;
}
if (nfcid2.length() != 16) {
Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
return false;
}
// check if the the value starts with "02FE"
if (!nfcid2.toUpperCase().startsWith("02FE")) {
// Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
// return false;
}
try {
Long.parseLong(nfcid2, 16);
} catch (NumberFormatException e) {
Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
return false;
}
return true; return true;
} }
}); });
XposedHelpers.findAndHookMethod("com.android.nfc.NfcApplication",
// XposedHelpers.findAndHookMethod("com.android.nfc.NfcApplication", lpparam.classLoader, "onCreate", new XC_MethodHook() {
// lpparam.classLoader, "onCreate", new XC_MethodHook() { @Override
// @Override protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
// protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable { XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate");
// XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate"); super.beforeHookedMethod(param);
// super.beforeHookedMethod(param); Application application = (Application) param.thisObject;
// Application application = (Application) param.thisObject; mcontext = application.getApplicationContext();
// mcontext = application.getApplicationContext(); XposedBridge.log("Got context");
// XposedBridge.log("Got context"); }
// } });
// });
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation",
@ -55,26 +102,24 @@ public class xp implements IXposedHookLoadPackage {
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable { protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param); super.afterHookedMethod(param);
XposedBridge.log("Inside android.nfc.cardemulation.NfcFCardEmulation#isValidSystemCode"); XposedBridge.log("Inside android.nfc.cardemulation.NfcFCardEmulation#isValidSystemCode");
XposedBridge.log("Got classloader");
// mclassloader = mcontext.getClassLoader(); String path = getSoPath();
// XposedBridge.log("Got classloader"); XposedBridge.log("So path = " + path);
// String path = getSoPath(); int version = android.os.Build.VERSION.SDK_INT;
// XposedBridge.log("So path = " + path); try {
// int version = android.os.Build.VERSION.SDK_INT; if (!path.equals("")) {
// try { XposedBridge.log("Start injecting libpmm.so");
// if (!path.equals("")) { if (version >= 28) {
// XposedBridge.log("Start injecting libpmm.so"); XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader);
// if (version >= 28) { } else {
// XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader); XposedHelpers.callMethod(Runtime.getRuntime(), "doLoad", path, mclassloader);
// } else { }
// XposedHelpers.callMethod(Runtime.getRuntime(), "doLoad", path, mclassloader); XposedBridge.log("Injected libpmm.so");
// } }
// XposedBridge.log("Injected libpmm.so"); } catch (Exception e) {
// } XposedBridge.log(e);
// } catch (Exception e) { e.printStackTrace();
// XposedBridge.log(e); }
// e.printStackTrace();
// }
// Unlocker // Unlocker
param.setResult(true); param.setResult(true);

@ -2,6 +2,5 @@
<host-nfcf-service xmlns:android="http://schemas.android.com/apk/res/android" <host-nfcf-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/desc_service"> android:description="@string/desc_service">
<nfcid2-filter android:name="02FE000000000000" /> <nfcid2-filter android:name="02FE000000000000" />
<t3tPmm-filter android:name="00F1000000014300" /> <system-code-filter android:name="4000" />
<system-code-filter android:name="88b4" />
</host-nfcf-service> </host-nfcf-service>
Loading…
Cancel
Save