xiongzhu 10 months ago
parent
commit
190cc22272

+ 29 - 32
app/src/main/java/com/example/modifiermodule/Hook13.java

@@ -16,6 +16,7 @@ import de.robv.android.xposed.XC_MethodHook;
 import de.robv.android.xposed.XposedHelpers;
 import de.robv.android.xposed.callbacks.XC_LoadPackage;
 
+@SuppressLint("DefaultLocale")
 public class Hook13 extends BaseHook {
     public Hook13(ClassLoader classLoader) {
         super(classLoader);
@@ -42,6 +43,7 @@ public class Hook13 extends BaseHook {
                         public void onReceive(Context context, Intent intent) {
                             String sender = Optional.ofNullable(intent.getStringExtra("sender")).orElse("1234");
                             String message = Optional.ofNullable(intent.getStringExtra("message")).orElse("test");
+                            log(String.format("Injecting SMS, sender=%s, message=%s", sender, message));
 
                             Intent i1 = RcsHackTool.createSmsIntent(application, sender, message);
                             i1.setAction("android.provider.Telephony.SMS_RECEIVED");
@@ -49,6 +51,7 @@ public class Hook13 extends BaseHook {
 
                             i1.setAction("android.provider.Telephony.SMS_DELIVER");
                             application.sendBroadcast(i1);
+                            log("SMS sent");
                         }
                     }, filter);
                     log("register broadcast receiver success");
@@ -62,28 +65,28 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(PhoneInterfaceManager, "getLine1NumberForDisplay", int.class, String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof PhoneInterfaceManager.getLine1NumberForDisplay");
+                    log(String.format("PhoneInterfaceManager.getLine1NumberForDisplay(%d, %s, %s)", param.args[0], param.args[1], param.args[2]));
                     param.setResult(getProperty(PROP_NUMBER, ""));
                 }
             });
             XposedHelpers.findAndHookMethod(PhoneInterfaceManager, "getNetworkCountryIsoForPhone", int.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof PhoneInterfaceManager.getNetworkCountryIsoForPhone");
+                    log(String.format("PhoneInterfaceManager.getNetworkCountryIsoForPhone(%d)", param.args[0]));
                     param.setResult(getProperty(PROP_COUNTRY, ""));
                 }
             });
             XposedHelpers.findAndHookMethod(PhoneInterfaceManager, "getImeiForSlot", int.class, String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof PhoneInterfaceManager.getImeiForSlot");
+                    log(String.format("PhoneInterfaceManager.getImeiForSlot(%d, %s, %s)", param.args[0], param.args[1], param.args[2]));
                     param.setResult(getProperty(PROP_IMEI, ""));
                 }
             });
             XposedHelpers.findAndHookMethod(PhoneInterfaceManager, "getMeidForSlot", int.class, String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof PhoneInterfaceManager.getMeidForSlot");
+                    log(String.format("PhoneInterfaceManager.getMeidForSlot(%d, %s, %s)", param.args[0], param.args[1], param.args[2]));
                     String imei = getProperty(PROP_IMEI, "");
                     String meid = imei;
                     if (imei.length() > 14) {
@@ -97,7 +100,7 @@ public class Hook13 extends BaseHook {
                 protected void beforeHookedMethod(MethodHookParam param) {
                     int carrierId = getIntProperty(PROP_CARRIER_ID, -1);
                     if (carrierId != -1) {
-                        log("spoof PhoneInterfaceManager.getSubscriptionSpecificCarrierId");
+                        log(String.format("PhoneInterfaceManager.getSubscriptionSpecificCarrierId(%d)", param.args[0]));
                         param.setResult(carrierId);
                     }
                 }
@@ -105,7 +108,7 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(PhoneInterfaceManager, "getSubscriptionCarrierId", int.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) {
-                    log("spoof PhoneInterfaceManager.getSubscriptionCarrierId");
+                    log(String.format("PhoneInterfaceManager.getSubscriptionCarrierId(%d)", param.args[0]));
                     int carrierId = getIntProperty(PROP_CARRIER_ID, -1);
                     if (carrierId != -1) {
                         param.setResult(carrierId);
@@ -115,7 +118,7 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(PhoneInterfaceManager, "getDeviceIdWithFeature", String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) {
-                    log("spoof PhoneInterfaceManager.getDeviceIdWithFeature");
+                    log(String.format("PhoneInterfaceManager.getDeviceIdWithFeature(%s, %s)", param.args[0], param.args[1]));
                     param.setResult(getProperty(PROP_IMEI, ""));
                 }
             });
@@ -126,6 +129,16 @@ public class Hook13 extends BaseHook {
                     param.setResult(getProperty(PROP_IMEI, ""));
                 }
             });
+            XposedHelpers.findAndHookMethod(PhoneInterfaceManager, "getCarrierIdFromMccMnc", int.class, String.class, boolean.class, new XC_MethodHook() {
+                @Override
+                protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
+                    log(String.format("PhoneInterfaceManager.getCarrierIdFromMccMnc(%d, %s, %d)", param.args[0], param.args[1]));
+                    int carrierId = getIntProperty(PROP_CARRIER_ID, -1);
+                    if (carrierId != -1) {
+                        param.setResult(carrierId);
+                    }
+                }
+            });
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -136,7 +149,7 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(SubscriptionController, "getPhoneNumberFromFirstAvailableSource", int.class, String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof SubscriptionController.getPhoneNumberFromFirstAvailableSource");
+                    log(String.format("SubscriptionController.getPhoneNumberFromFirstAvailableSource(%d, %s, %s)", param.args[0], param.args[1], param.args[2]));
                     param.setResult(getProperty(PROP_NUMBER, ""));
                 }
             });
@@ -144,7 +157,7 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(SubscriptionController, "getActiveSubscriptionInfoList", String.class, new XC_MethodHook() {
                 @Override
                 protected void afterHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof SubscriptionController.getActiveSubscriptionInfoList");
+                    log(String.format("SubscriptionController.getActiveSubscriptionInfoList(%s)", param.args[0]));
                     List<SubscriptionInfo> list = (List<SubscriptionInfo>) param.getResult();
                     for (SubscriptionInfo info : list) {
                         XposedHelpers.setObjectField(info, "mMcc", getProperty(PROP_MCC, ""));
@@ -166,7 +179,7 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(SubscriptionController, "getActiveSubscriptionInfoList", String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void afterHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof SubscriptionController.getActiveSubscriptionInfoList");
+                    log(String.format("SubscriptionController.getActiveSubscriptionInfoList(%s, %s)", param.args[0], param.args[1]));
                     List<SubscriptionInfo> list = (List<SubscriptionInfo>) param.getResult();
                     for (SubscriptionInfo info : list) {
                         XposedHelpers.setObjectField(info, "mMcc", getProperty(PROP_MCC, ""));
@@ -188,7 +201,7 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(SubscriptionController, "getSimStateForSlotIndex", int.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof SubscriptionController.getSimStateForSlotIndex");
+                    log(String.format("SubscriptionController.getSimStateForSlotIndex(%d)", param.args[0]));
                     param.setResult(5);
                 }
             });
@@ -202,14 +215,14 @@ public class Hook13 extends BaseHook {
             XposedHelpers.findAndHookMethod(PhoneSubInfoController, "getIccSerialNumberForSubscriber", int.class, String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof PhoneSubInfoController.getIccSerialNumberForSubscriber");
+                    log(String.format("PhoneSubInfoController.getIccSerialNumberForSubscriber(%d, %s, %s)", param.args[0], param.args[1], param.args[2]));
                     param.setResult(getProperty(PROP_ICCID, ""));
                 }
             });
             XposedHelpers.findAndHookMethod(PhoneSubInfoController, "getSubscriberIdForSubscriber", int.class, String.class, String.class, new XC_MethodHook() {
                 @Override
                 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof PhoneSubInfoController.getSubscriberIdForSubscriber");
+                    log(String.format("PhoneSubInfoController.getSubscriberIdForSubscriber(%d, %s, %s)", param.args[0], param.args[1], param.args[2]));
                     param.setResult(getProperty(PROP_IMSI, ""));
                 }
             });
@@ -236,32 +249,16 @@ public class Hook13 extends BaseHook {
             protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                 String key = (String) param.args[0];
                 if ("gsm.sim.operator.iso-country".equals(key)) {
-                    log("spoof SystemProperties.get(" + key + ")");
+                    log(String.format("spoof SystemProperties.get(%s)", key));
                     param.setResult(getProperty(PROP_COUNTRY, ""));
                 } else if ("gsm.sim.operator.numeric".equals(key)) {
-                    log("spoof SystemProperties.get(" + key + ")");
+                    log(String.format("spoof SystemProperties.get(%s)", key));
                     param.setResult(getProperty(PROP_MCC, "") + getProperty(PROP_MNC, ""));
                 } else if ("gsm.operator.numeric".equals(key)) {
-                    log("spoof SystemProperties.get(" + key + ")");
+                    log(String.format("spoof SystemProperties.get(%s)", key));
                     param.setResult(getProperty(PROP_MCC, "") + getProperty(PROP_MNC, ""));
                 }
             }
         });
-
-        try {
-            Class<?> CarrierResolver = XposedHelpers.findClass("com.android.internal.telephony.CarrierResolver", lpparam.classLoader);
-            XposedHelpers.findAndHookMethod(CarrierResolver, "getCarrierIdFromSimMccMnc", new XC_MethodHook() {
-                @Override
-                protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
-                    log("spoof CarrierResolver.getCarrierIdFromSimMccMnc");
-                    int carrierId = getIntProperty(PROP_CARRIER_ID, -1);
-                    if (carrierId != -1) {
-                        param.setResult(carrierId);
-                    }
-                }
-            });
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
     }
 }

+ 1 - 1
app/src/main/res/values/arrays.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string-array name="xposed_scope">
-<!--        <item>com.google.android.apps.messaging</item>-->
+        <item>com.google.android.apps.messaging</item>
 <!--        <item>com.google.android.gms</item>-->
 <!--        <item>com.kee.SIMdeviceinfo</item>-->
         <item>com.android.phone</item>