Skip to content

Commit

Permalink
适配性bug修复
Browse files Browse the repository at this point in the history
修复防撤回;修复模拟定位;
  • Loading branch information
su committed Sep 15, 2018
1 parent 4852703 commit 7728fbb
Show file tree
Hide file tree
Showing 9 changed files with 381 additions and 340 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Xposed 微信辅助模块,实现消息防撤回、模拟位置、运动步数
## 下载
- release from [github](https://github.com/wuxiaosu/XposedWechatHelper/releases)
- ~~release from [酷安](https://www.coolapk.com/apk/180057)~~(被和谐了)
## 交流
Q群:[123320001]
群主人很好
## v1.12
修复了模拟定位;
修复了防撤回;
移除了隐藏“发现页”;
## v1.11
更改了实现方式;
## v1.09
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'


Expand Down
4 changes: 2 additions & 2 deletions wechathelper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.wuxiaosu.wechathelper"
minSdkVersion 21
targetSdkVersion 23
versionCode 12
versionName "1.11"
versionCode 13
versionName "1.12"
}

signingConfigs {
Expand Down
235 changes: 117 additions & 118 deletions wechathelper/src/main/java/com/wuxiaosu/wechathelper/Main.java
Original file line number Diff line number Diff line change
@@ -1,118 +1,117 @@
package com.wuxiaosu.wechathelper;

import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.wuxiaosu.wechathelper.hook.EmojiGameHook;
import com.wuxiaosu.wechathelper.hook.ExdeviceRankHook;
import com.wuxiaosu.wechathelper.hook.ExtDeviceWXLoginUIHook;
import com.wuxiaosu.wechathelper.hook.LauncherUIHook;
import com.wuxiaosu.wechathelper.hook.WalletHook;
import com.wuxiaosu.wechathelper.hook.RevokeMsgHook;
import com.wuxiaosu.wechathelper.hook.StepHook;
import com.wuxiaosu.wechathelper.hook.TencentLocationManagerHook;
import com.wuxiaosu.wechathelper.hook.UIHook;

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

/**
* Created by su on 2017/12/29.
*/

public class Main implements IXposedHookLoadPackage {

private final String WECHAT_PACKAGE = "com.tencent.mm";

@Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {

if (lpparam.appInfo == null || (lpparam.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM |
ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) {
return;
}

final String packageName = lpparam.packageName;
final String processName = lpparam.processName;

if (BuildConfig.APPLICATION_ID.equals(packageName)) {
XposedHelpers.findAndHookMethod("com.wuxiaosu.wechathelper.activity.MainActivity", lpparam.classLoader,
"showModuleActiveInfo", boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.args[0] = true;
super.beforeHookedMethod(param);
}
});
}

if (WECHAT_PACKAGE.equals(packageName)) {
try {
XposedHelpers.findAndHookMethod(Application.class,
"attach",
Context.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Context context = (Context) param.args[0];
ClassLoader appClassLoader = context.getClassLoader();
StepHook.hook(appClassLoader);
}
});
} catch (Throwable e) {
XposedBridge.log(e);
}
if (WECHAT_PACKAGE.equals(processName)) {
// 只HOOK UI进程
try {
// 由于微信Tinker的存在,hook Application.attach 不如 ContextWrapper.attachBaseContext稳定
// 参见 :https://github.com/Gh0u1L5/WechatMagician/blob/master/src/main/java/com/gh0u1l5/wechatmagician/backend/WechatHook.kt
XposedHelpers.findAndHookMethod(ContextWrapper.class,
"attachBaseContext",
Context.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Context context = (Context) param.args[0];
ClassLoader appClassLoader = context.getClassLoader();
handleHook(appClassLoader,
getVersionName(context, WECHAT_PACKAGE));
}
});
} catch (Throwable e) {
XposedBridge.log(e);
}
}
}
}

private void handleHook(ClassLoader classLoader, String versionName) {
new TencentLocationManagerHook(versionName).hook(classLoader);
EmojiGameHook.getInstance().init(classLoader, versionName);
WalletHook.getInstance().init(classLoader, versionName);
UIHook.getInstance().init(classLoader, versionName);
LauncherUIHook.getInstance().init(classLoader, versionName);
ExdeviceRankHook.getInstance().init(classLoader, versionName);
RevokeMsgHook.getInstance().init(classLoader, versionName);
ExtDeviceWXLoginUIHook.getInstance().init(classLoader, versionName);
// XLogHook.getInstance().init(classLoader, versionName);
}

private String getVersionName(Context context, String pkgName) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packInfo = packageManager.getPackageInfo(pkgName, 0);
return packInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "";
}
}
package com.wuxiaosu.wechathelper;

import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.wuxiaosu.wechathelper.hook.EmojiGameHook;
import com.wuxiaosu.wechathelper.hook.ExdeviceRankHook;
import com.wuxiaosu.wechathelper.hook.ExtDeviceWXLoginUIHook;
import com.wuxiaosu.wechathelper.hook.LauncherUIHook;
import com.wuxiaosu.wechathelper.hook.RevokeMsgHook;
import com.wuxiaosu.wechathelper.hook.StepHook;
import com.wuxiaosu.wechathelper.hook.TencentLocationManagerHook;
import com.wuxiaosu.wechathelper.hook.WalletHook;

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

/**
* Created by su on 2017/12/29.
*/

public class Main implements IXposedHookLoadPackage {

private final String WECHAT_PACKAGE = "com.tencent.mm";

@Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {

if (lpparam.appInfo == null || (lpparam.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM |
ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) {
return;
}

final String packageName = lpparam.packageName;
final String processName = lpparam.processName;

if (BuildConfig.APPLICATION_ID.equals(packageName)) {
XposedHelpers.findAndHookMethod("com.wuxiaosu.wechathelper.activity.MainActivity", lpparam.classLoader,
"showModuleActiveInfo", boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.args[0] = true;
super.beforeHookedMethod(param);
}
});
}

if (WECHAT_PACKAGE.equals(packageName)) {
try {
XposedHelpers.findAndHookMethod(Application.class,
"attach",
Context.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Context context = (Context) param.args[0];
ClassLoader appClassLoader = context.getClassLoader();
StepHook.hook(appClassLoader);
}
});
} catch (Throwable e) {
XposedBridge.log(e);
}
if (WECHAT_PACKAGE.equals(processName)) {
// 只HOOK UI进程
try {
// 由于微信Tinker的存在,hook Application.attach 不如 ContextWrapper.attachBaseContext稳定
// 参见 :https://github.com/Gh0u1L5/WechatMagician/blob/master/src/main/java/com/gh0u1l5/wechatmagician/backend/WechatHook.kt
XposedHelpers.findAndHookMethod(ContextWrapper.class,
"attachBaseContext",
Context.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Context context = (Context) param.args[0];
ClassLoader appClassLoader = context.getClassLoader();
handleHook(appClassLoader,
getVersionName(context, WECHAT_PACKAGE));
}
});
} catch (Throwable e) {
XposedBridge.log(e);
}
}
}
}

private void handleHook(ClassLoader classLoader, String versionName) {
TencentLocationManagerHook.hook(classLoader);
EmojiGameHook.getInstance().init(classLoader, versionName);
WalletHook.getInstance().init(classLoader, versionName);
// UIHook.getInstance().init(classLoader, versionName);
LauncherUIHook.getInstance().init(classLoader, versionName);
ExdeviceRankHook.getInstance().init(classLoader, versionName);
RevokeMsgHook.getInstance().init(classLoader, versionName);
ExtDeviceWXLoginUIHook.getInstance().init(classLoader, versionName);
// XLogHook.getInstance().init(classLoader, versionName);
}

private String getVersionName(Context context, String pkgName) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packInfo = packageManager.getPackageInfo(pkgName, 0);
return packInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ public class MainActivity extends BaseActivity {
@BindView(R.id.rl_step)
RadioGroup rlStep;

private final String[] wechatSupportVersions =
new String[]{"6.6.0", "6.6.1", "6.6.2", "6.6.3", "6.6.5", "6.6.6"};

private final static int EXTERNAL_STORAGE_REQUEST_CODE = 999;

@Override
Expand Down Expand Up @@ -208,7 +205,7 @@ private void showInfo() {
TextView mTvVersionName = view.findViewById(R.id.tv_version_name);
TextView mTvInfo = view.findViewById(R.id.tv_info);
final TextView mTvUrl = view.findViewById(R.id.tv_url);
mTvUrl.setText(Html.fromHtml("<a href=''>https://www.coolapk.com/apk/com.wuxiaosu.wechathelper</a>"));
mTvUrl.setText(Html.fromHtml("<a href=''>https://github.com/wuxiaosu/XposedWechatHelper</a>"));
mTvUrl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -228,7 +225,7 @@ public void onClick(View v) {

private String getContactInfo() {
return "\nQ群:[123320001]\n" +
"微信群加:[CSYJZF]\n";
"群主人很好\n";
}

private void sendURLIntent(String url) {
Expand Down
Loading

0 comments on commit 7728fbb

Please sign in to comment.