Skip to content

Commit

Permalink
Merge pull request #45 from Mingyueyixi/v2.1/dev
Browse files Browse the repository at this point in the history
V2.1/dev
  • Loading branch information
Mingyueyixi committed Mar 3, 2024
2 parents 8950373 + 73c5c22 commit bceae45
Show file tree
Hide file tree
Showing 39 changed files with 2,472 additions and 320 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
4. 模块会抓取糊脸Id(微信用户的唯一id),并弹出对话框。
5. 确认后,点击对话框确定按钮。再次进入聊天页即隐藏与此用户的聊天记录

### 2.0版本变更

1. 全局配置移动不再个人弹窗中出现,而是移动到了配置中心
2. 配置中心打开路径为:“微信设置->关怀模式->开启按钮(长按)”


### 临时解除隐藏(Since v1.6)

v1.6版本:
Expand Down Expand Up @@ -75,7 +81,8 @@ v1.13版本开始,默认隐藏App在桌面的图标。隐藏以后,打开模
8.0.43 (2480) 2023-11-06
8.0.44 (2502) 2023-12-04
8.0.45 (2521) 2024-01-02

8.0.46 (2540) 2024-01-23
8.0.47 (2560) 2024-02-01

**PS.**
- 仅支持上述版本,所有其他版本号以及32位版本未经测试,预计百分之九十九不可用
Expand Down Expand Up @@ -139,8 +146,12 @@ SHA1: 38525994D6D69106CDB3D6F9F62B045CFF9CC4D5

8.0.45(2521):[https://dldir1.qq.com/weixin/android/weixin8045android2521_0x28002d34_arm64_1.apk](https://dldir1.qq.com/weixin/android/weixin8045android2521_0x28002d34_arm64_1.apk)
SHA1: F44F35663E2A2C3BF9EA671270D65902AB5727DA


8.0.46(2540): [https://dldir1.qq.com/weixin/android/weixin/android/weixin8046android2540_0x28002e34_arm64.apk](https://dldir1.qq.com/weixin/android/weixin/android/weixin8046android2540_0x28002e34_arm64.apk)
SHA1: 173D8632093949D7AB1DA6D8B8CB5C1252876BEB

8.0.47(2560): [https://dldir1.qq.com/weixin/android/weixin8047android2560_0x28002f36_arm64.apk](https://dldir1.qq.com/weixin/android/weixin8047android2560_0x28002f36_arm64.apk)
SHA1: 79F1341563A9CCCAF3090D27A5E9D529008EEC42


推荐适配的最后两个版本,因为其他版本,作者自己不再使用
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ android {
applicationId "com.lu.wxmask"
minSdk 24
targetSdk 34
versionCode 24
versionName "1.23-bug"
versionCode 1001
versionName "2.1-bug"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/lu/wxmask/Constrant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class Constrant {
const val WX_CODE_8_0_43 = 2480
const val WX_CODE_8_0_44 = 2502
const val WX_CODE_8_0_45 = 2521
const val WX_CODE_8_0_46 = 2540
const val WX_CODE_8_0_47 = 2560
}

}
73 changes: 61 additions & 12 deletions app/src/main/java/com/lu/wxmask/MainHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import android.app.Application;
import android.app.Instrumentation;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.XModuleResources;
import android.nfc.Tag;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;
Expand All @@ -16,30 +19,44 @@
import com.lu.wxmask.plugin.CommonPlugin;
import com.lu.wxmask.plugin.WXConfigPlugin;
import com.lu.wxmask.plugin.WXMaskPlugin;
import com.lu.wxmask.util.Rm;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;

import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

@Keep
public class MainHook implements IXposedHookLoadPackage {
public class MainHook implements IXposedHookLoadPackage, IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static final String TARGET_PACKAGE = "com.tencent.mm";
public static CopyOnWriteArraySet<String> uniqueMetaStore = new CopyOnWriteArraySet<>();
private boolean hasInit = false;
private List<XC_MethodHook.Unhook> initUnHookList = new ArrayList<>();
private static String MODULE_PATH = null;

@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (BuildConfig.APPLICATION_ID.equals(lpparam.packageName)) {
SelfHook.getInstance().handleLoadPackage(lpparam);
return;
}
if (!"com.tencent.mm".equals(lpparam.processName)) {
// if (BuildConfig.APPLICATION_ID.equals(lpparam.packageName)) {
// SelfHook.getInstance().handleLoadPackage(lpparam);
// return;
// }


HashSet<String> allowList = new HashSet<>();
allowList.add(BuildConfig.APPLICATION_ID);
allowList.add(TARGET_PACKAGE);

if (!allowList.contains(lpparam.processName)) {
return;
}

LogUtil.setLogger(new SimpleLogger() {
@Override
public void onLog(int level, @NonNull Object[] objects) {
Expand Down Expand Up @@ -81,7 +98,7 @@ public void onLog(int level, @NonNull Object[] objects) {
return new byte[]{};
}
if (Short.TYPE.equals(returnType) || Short.class.equals(returnType)) {
return (short)0;
return (short) 0;
}
if (BuildConfig.DEBUG) {
LogUtil.w("setOnErrorReturnFallback", throwable);
Expand Down Expand Up @@ -163,6 +180,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {

private void initPlugin(Context context, XC_LoadPackage.LoadPackageParam lpparam) {
if (context == null) {
LogUtil.w("context is null");
return;
}
if (hasInit) {
Expand All @@ -171,18 +189,49 @@ private void initPlugin(Context context, XC_LoadPackage.LoadPackageParam lpparam
LogUtil.i("start init Plugin");
hasInit = true;
AppUtil.attachContext(context);

if (BuildConfig.APPLICATION_ID.equals(lpparam.packageName)) {
initSelfPlugins(context, lpparam);
} else {
initTargetPlugins(context, lpparam);
}

for (XC_MethodHook.Unhook unhook : initUnHookList) {
if (unhook != null) {
unhook.unhook();
}
}
LogUtil.i("init plugin finish");
}

private void initSelfPlugins(Context context, XC_LoadPackage.LoadPackageParam lpparam) {
SelfHook.getInstance().handleHook(context, lpparam);
}

private void initTargetPlugins(Context context, XC_LoadPackage.LoadPackageParam lpparam) {
//目前生成的plugin都是单例的
PluginRegistry.register(
CommonPlugin.class,
WXConfigPlugin.class,
WXMaskPlugin.class
).handleHooks(context, lpparam);
for (XC_MethodHook.Unhook unhook : initUnHookList) {
if (unhook != null) {
unhook.unhook();
}

}

@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}

@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
if (BuildConfig.APPLICATION_ID.equals(resparam.packageName)) {
return;
}
if (TARGET_PACKAGE.equals(resparam.packageName)) {
// XModuleResources xRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
// Rm.mask_layout_plugin_manager = resparam.res.addResource(xRes, R.layout.mask_layout_plugin_manager);
}
LogUtil.i("init plugin finish");
}

}
37 changes: 34 additions & 3 deletions app/src/main/java/com/lu/wxmask/SelfHook.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
package com.lu.wxmask;

import android.app.Activity;
import android.app.Application;
import android.content.Context;

import androidx.annotation.Keep;

import com.lu.lposed.api2.XC_MethodHook2;
import com.lu.lposed.api2.XposedHelpers2;
import com.lu.lposed.plugin.IPlugin;
import com.lu.magic.util.AppUtil;
import com.lu.magic.util.ResUtil;
import com.lu.magic.util.log.LogUtil;
import com.lu.wxmask.plugin.ui.MaskManagerCenterUI;
import com.lu.wxmask.util.ext.ResUtilXKt;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

@Keep
public class SelfHook {
private static class Holder {
public class SelfHook implements IPlugin {


private final static class Holder {
private static final SelfHook INSTANCE = new SelfHook();
}

Expand All @@ -23,7 +36,8 @@ public boolean isModuleEnable() {
return false;
}

public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) {
@Override
public void handleHook(Context context, XC_LoadPackage.LoadPackageParam lpparam) {
XposedHelpers.findAndHookMethod(
SelfHook.class.getName(),
lpparam.classLoader,
Expand All @@ -36,5 +50,22 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
);

if (BuildConfig.DEBUG) {
handleDebugHook(context, lpparam);
}

}

private void handleDebugHook(Context context, XC_LoadPackage.LoadPackageParam lpparam) {
XposedHelpers.findAndHookMethod(
ClazzN.from("android.app.Activity"),
"onResume",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Activity act = (Activity) param.thisObject;
act.findViewById(ResUtilXKt.getViewId(ResUtil.INSTANCE, "action_bar")).setOnClickListener(v -> new MaskManagerCenterUI(act).show());
}
});
}
}
23 changes: 22 additions & 1 deletion app/src/main/java/com/lu/wxmask/bean/MaskItemBean.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,36 @@ import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.lu.magic.util.GsonUtil
import com.lu.wxmask.Constrant
import com.lu.wxmask.util.ext.toJsonObject
import org.json.JSONObject

@Keep
class MaskItemBean(
var maskId: String,
var tagName: String = "",
var tipMode: Int = Constrant.WX_MASK_TIP_MODE_SILENT,
var tipData: JsonElement? = JsonObject()
var tipData: JsonElement? = JsonObject(),
//伪装映射id
var mapId: String = "officialaccounts"
) {

companion object {
fun fromJson(jsonText: String): MaskItemBean {
val json = try {
JSONObject(jsonText)
} catch (e: Exception) {
JSONObject()
}
return MaskItemBean(
maskId = json.optString("maskId", ""),
tagName = json.optString("tagName", ""),
tipMode = json.optInt("tipMode", Constrant.WX_MASK_TIP_MODE_SILENT),
tipData = GsonUtil.fromJson(json.optString("tipData", "{}"), JsonObject::class.java),
mapId = json.optString("mapId", "officialaccounts")
)
}
}

@Keep
class TipData(var mess: String = Constrant.WX_MASK_TIP_ALERT_MESS_DEFAULT) {
companion object {
Expand Down
31 changes: 31 additions & 0 deletions app/src/main/java/com/lu/wxmask/bean/OptionData.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.lu.wxmask.bean

import androidx.annotation.Keep
import org.json.JSONObject

@Keep
class OptionData private constructor(
var hideMainSearch: Boolean,
var enableMapConversation: Boolean,
var hideSingleSearch: Boolean,
var hideMainSearchStrong: Boolean
) {

companion object {
fun fromJson(jsonText: String): OptionData {
val json = try {
JSONObject(jsonText)
} catch (e: Exception) {
JSONObject()
}
return OptionData(
hideMainSearch = json.optBoolean("hideMainSearch", true),
enableMapConversation = json.optBoolean("enableMapConversation", false),
hideSingleSearch = json.optBoolean("hideSingleSearch", true),
hideMainSearchStrong = json.optBoolean("hideMainSearchStrong", false)
)
}

}
}

12 changes: 12 additions & 0 deletions app/src/main/java/com/lu/wxmask/plugin/CommonPlugin.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
package com.lu.wxmask.plugin

import android.content.Context
import android.content.res.XModuleResources
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.lu.lposed.api2.XC_MethodHook2
import com.lu.lposed.api2.XposedHelpers2
import com.lu.lposed.plugin.IPlugin
import com.lu.magic.util.ResUtil
import com.lu.wxmask.ClazzN
import com.lu.wxmask.plugin.ui.MaskManagerCenterUI
import com.lu.wxmask.util.HookPointManager
import com.lu.wxmask.util.ext.getViewId
import de.robv.android.xposed.callbacks.XC_LoadPackage

class CommonPlugin : IPlugin {
Expand Down
Loading

0 comments on commit bceae45

Please sign in to comment.