remove dobby inject (ver 1.0-beta3)

master 1.0
wlt233 2 years ago
parent 6c4cbf12c2
commit 7089b8eb5d

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

@ -20,7 +20,6 @@ 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 {
@ -28,72 +27,26 @@ 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",
lpparam.classLoader, "onCreate", new XC_MethodHook() { // XposedHelpers.findAndHookMethod("com.android.nfc.NfcApplication",
@Override // lpparam.classLoader, "onCreate", new XC_MethodHook() {
protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable { // @Override
XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate"); // protected void beforeHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param); // XposedBridge.log("Inside com.android.nfc.NfcApplication#onCreate");
Application application = (Application) param.thisObject; // super.beforeHookedMethod(param);
mcontext = application.getApplicationContext(); // Application application = (Application) param.thisObject;
XposedBridge.log("Got context"); // mcontext = application.getApplicationContext();
} // XposedBridge.log("Got context");
}); // }
// });
XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation", XposedHelpers.findAndHookMethod("android.nfc.cardemulation.NfcFCardEmulation",
@ -102,24 +55,26 @@ 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");
String path = getSoPath(); // mclassloader = mcontext.getClassLoader();
XposedBridge.log("So path = " + path); // XposedBridge.log("Got classloader");
int version = android.os.Build.VERSION.SDK_INT; // String path = getSoPath();
try { // XposedBridge.log("So path = " + path);
if (!path.equals("")) { // int version = android.os.Build.VERSION.SDK_INT;
XposedBridge.log("Start injecting libpmm.so"); // try {
if (version >= 28) { // if (!path.equals("")) {
XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader); // XposedBridge.log("Start injecting libpmm.so");
} else { // if (version >= 28) {
XposedHelpers.callMethod(Runtime.getRuntime(), "doLoad", path, mclassloader); // XposedHelpers.callMethod(Runtime.getRuntime(), "nativeLoad", path, mclassloader);
} // } else {
XposedBridge.log("Injected libpmm.so"); // XposedHelpers.callMethod(Runtime.getRuntime(), "doLoad", path, mclassloader);
} // }
} catch (Exception e) { // XposedBridge.log("Injected libpmm.so");
XposedBridge.log(e); // }
e.printStackTrace(); // } catch (Exception e) {
} // XposedBridge.log(e);
// e.printStackTrace();
// }
// Unlocker // Unlocker
param.setResult(true); param.setResult(true);

Loading…
Cancel
Save